May 31
Flash Team Tools
Hello Everybody,
I attended Flash camp the other day. The adobe guys/gals were all really nice. It seems to me that with Flash Catalyst and all the new flex features raw actionscript developers (like myself) are being compelled to jump on the flex bandwagon. I asked the flex engineers why they can’t break out flex functionality into libraries that raw actionscript developers could import as needed. I don’t know that I got a satisfactory answer. In any case the new Flex components are the first adobe components that I would actually feel good about using. Very skinable, very well architected. If you where there I was the tall persian guy with my wife wearing matching Apollo tee shirts. Now I am just getting ready to fly home to orange county and getting ready to present at O. C. Flash
I will be presenting flash team tools at OC flash on Tuesday June 2. I will cover a bunch of tools that I use and Love. My notes below:
Design:
Enterprise Architect: specifications, classes, database tables, sequences, export.
CASE Tool, supports full SDLC modeling with UML 2.1
http://www.sparxsystems.com.au/
GnanttProject: Gnant Charts
GanttProject is a cross-platform desktop tool for project scheduling and management. It runs on Windows, Linux and MacOSX, it is free and its code is opensource. Create work breakdown structure, draw dependencies, define milestones.
Assign human resources to work on tasks, see their allocation on the Resource Load chart.
Save charts as PNG images, generate PDF and HTML reports. Import projects from and export them to Microsoft Project formats. Export to spreadsheets with CSV.
http://www.ganttproject.biz/
Development:
Mantis: Task and Bug Tracking
Open source, php based, highly configurable
http://www.mantisbt.org/
Sharepoint: Task and Bug management
IIS, highly configurable
http://sharepoint.microsoft.com/Pages/Default.aspx
Tortoise: Commit, update, branch, Merge, Diff(code review)
A Subversion client, implemented as a windows shell extension.
http://tortoisesvn.tigris.org/
Winmerge: Merge, diff (code review):
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
http://winmerge.org/
XMLNotepad: Create XML.
XML Notepad 2007 provides a simple intuitive user interface for browsing and editing XML documents.
Paint.NET: Images
Paint.NET is free image and photo editing software for computers that run Windows.
http://www.getpaint.net/
FileZilla:
Free FTP.
http://filezilla-project.org/
Debug
Alcon
Alcon is a lightweight debugging tool for ActionScript developers that provides several straightforward and quickly accessible methods to debug any ActionScript 2 or ActionScript 3 application, be it from the Web Browser, the standalone Flash Player or an AIR Runtime
http://blog.hexagonstar.com/alcon/
De Monster Debugger
De MonsterDebugger is an open source debugger for Adobe Flash, Flex and AIR. De MonsterDebugger is made in Flex and AIR by design studio De Monsters.
http://demonsterdebugger.com/
PureMVC Consule
This project is intended to help Flex and AS3 application developers, that use the PureMVC framework for AS3 - simple or multicore version - by providing them deep insights on what happens at the framework level: Notifications, Commands, Mediators and Proxies.
http://lab.kapit.fr/display/puremvcconsole/PureMVC+Console
Wireshark
Wireshark is the world’s foremost network protocol analyzer, and is the de facto (and often de jure) standard across many industries and educational institutions.
http://www.wireshark.org/
Webload
The WebLOAD Open Source Load Generation Engine is an open source project sponsored by RadView Software.
http://www.webload.org/
Apr 30
Pure MVC Awesome practices
As I have worked extensively with PureMVC I have taken note of practices that make life easier. I wouldn’t call them “Best Practices” because who am I to say whats best. But these practices have saved me tons of time and I value my time, thus the titles.
#1: As we know each Mediator is responsible for exactly one view component. If you are loading the artwork from flash the visual elements of the view component should be stored in a single dedicated FLA (no monolith FLAs, one FLA/swf per viewcomponent). Its common work flow when you have a team of developers each gets assigned to a view component. This way you don’t get locking issues on the FLA or SWF.
#2: View components should aggregate Sprite (or MovieClip), not extend it. Extending Sprite has become an all to often practice for dealing with view components. Gang of Four tells us to prefer aggregation. If your Display Object hierarchy is defined in the Flash IDE, using the sprite instead of extending the sprite means you don’t have to link the sprite to your code inside of flash, and thus don’t have to compile code in the Flash IDE (which really helps out work flow and development time). View components should probably extend a “viewComponent” base class that comes with shared view component functionality (ie verifies the Display Object Hierarchy).
#3: Design a unit test for each view component. All to often when thinking about unit tests we think the class is the unit to test. Doing this usually creates constraints that take away from object oriented design. Remember, as front end developers our view components are our primary units, and they are event driven, so class testing becomes academic. Think of the view component as the unit to test. One view component should map to one swf so now all you need is a unit test that embeds or loads that swf, and runs the component through its paces. Every view component should pass its unit test before being integrated into the application.
#4: Use a “navigation” command and “navigation” notification: The navigation command should be tied to a navigation notification which is broadcast whenever the user wants to navigate to a new macro state of the application. The new macro state should have a name, which is carried in the payload of the notification. Allow for transition states with loading steps if you plan on tweening between states. The transition state and step should be stored in the state proxy as well.
Although its the mediators job to transition whenever a navigation notification is handled, it will be the navigation commands job to deep link using swfaddress, and update the stateproxy with the new application state. On the other hand the swfaddress.change event should send a navigation notification as well, via logic that parses the new address. Watchout though, responding to address change isn’t that simple as you need to make sure your application is sufficiently initialized before sending the navigation notification.
#5: Understand the difference between macro-states and view component states. Macro-states need to be accessible through-out the application. For example, any state information stored in the URL is a part of the macro-state. However only the given view component needs to know the view component state, so don’t store any view component state information in the model.
#6: Mediators should inherit from one of a few base Mediators. Your application represents certain visual metaphors to the user . For example the visual metaphors might consist of Pages, Popups, Modules and Menus. When this is the case, all of your mediators for pages should inherit from an Abstract Page Mediator, as with Popups , Modules and Menus. Before architecting your application, understand the view metaphors, and use those base metaphors as abstract mediators.
#7: Know what MVC will help you with, and what it wont help you with. MVC is all about a systematic way to startup, handle user gestures, and back-end events. This should be the starting point for designing out our architecture. The pure MVC tutorial’s fully cover startup best practices. As for user gestures, the view component should wisely keep some things to itself, while translating other gestures into dispatched events. The mediator will then respond to those events, sometimes by sending a notification, sometimes by accessing a proxy to change the model. It is important to separate what the gestures the view component needs to know about, versus what the mediator needs to know about, versus what the MVC layer needs to know about. The gestures should also change there name as they are passed from view component to mediator to MVC layer, because there significance changes in each separate context.
As for backed service calls, use the same proxy that handles the request to handle the response. Use a responder pattern and delegates to handle parsing.
If you need to handle some occurrence that is neither startup, a gesture, or back end event, consider handling it within a view component and not on the MVC layer . For example, MVC isn’t here to manage a game stream, so if you are writing a game use the MVC layer to navigate to the game, to manage widgets and the heads up display, but the game stream should be managed within a view component.
#8: Whenever the Model changes and view components need to be updated as a result , the proxy should send a DATA_REFRESH notification so Mediators may update data supplied to view components.
#9: All Vos should inherit from a base VO, all VOCollections should inherit from a base VOCollection. See the end of this article for example base VO and base VOCollection code.
#10: Don t worry about using the facade. One misunderstanding most developers have after reading the PureMVC tutorials is that they will be doing a bunch of work with the facade. Maybe this is true if you are creating a logic layer, and the facade exposes some complex api. Usually the facade only exposes startup and holds constants, and the applications entry point is the only entity that calls a function from the facade. Turns out the real work is under the hood of the facade for most RIAs.
#11: Here is a list of some proxies I always use and information about each:
ConfigProxy: Reads in the config.xml file. Uses a config VO custom to the data in the config.xml file. See ConfigProxy and LoadEXDelegate code below.
StartupMonitorProxy: Fully documented in PureMVC docs. Really makes loading easy.
TextProxy: Works a lot like the configProxy but reads a text.xml file and uses a textVO to contain all text that will be used in application.
#12: Use the PureMVC consule, this thing is wicked!!!
#13: A. Always, B. be, M. Multi coring, always be multi coring. Why use single core, its not easier, and it could paint you in a corner.
#14: Preload with a preloadorMediator that listens for the Loading Step notifications dispatched by the startupMonitor Proxy.
#15: Be happy you picked PureMVC. If it seems more complex than your needs are just wait until your client comes back with suggestions and you will be glad you picked a framework that can handle complexity.
Hey lets be friends,
add me to linked in: http://www.linkedin.com/pub/dir/?last=khabazian&first=iman
or come see me in person as I will be speaking at various Flash/Flex user groups throughout southern California in May or June (schedule will be posted soon but I have confirmed San Diego Users Group May 20th at 6pm and OC Flash at 7pm June second, and L.A. Flex in July).
///////////////////////////////////////////////////////////
// VO.as
// ActionScript 3.0 Implementation of the Class VO
// Created on: 03-May-2008 12:24:46 AM
// Original author: iMAN Khabazian
///////////////////////////////////////////////////////////
package com.iMANIT.ImplementationPatterns
{
/**
*
*
* public class VO
* {
* public var objectProxy:Proxy = new Proxy();
* public var voEvent:VOEvent;
*
* // id:String get/set
* public function get id():String { return objectProxy.getData(id)};
* public function set id( p_id:String ):void { objectProxy.setData(id , p_id)};
* }
* @author iMAN Khabazian
* @version 1.0
* @created 03-May-2008 12:24:46 AM
*/
public class VO
{
public var id: uint;
/**
* constructor.
*/
public function VO(tID: uint):void
{
if (tID)
{
id = tID;
}
}
public function toString():String
{
return (”VO: ” + id);
}
}//end VO
}
///////////////////////////////////////////////////////////
// VOCollection.as
// ActionScript 3.0 Implementation of the Class VOCollection
// Created on: 03-May-2008 12:24:46 AM
// Original author: iMAN Khabazian
///////////////////////////////////////////////////////////
package com.iMANIT.ImplementationPatterns
{
/**
* Contains all VOs of a particular type.
* @author iMAN Khabazian
* @version 1.0
* @created 03-May-2008 12:24:46 AM
*/
public class VOCollection
{
/**
* Array of VOs
* We need to support: add, removebyID
*/
// public var VOs: Array;
protected var localAr:Array;
protected var name:String = “Generic Collection”;
/**
* constructor, inits Array
*/
public function VOCollection(ar:Array=null, name:String = null)
{
if (name) this.name = name;
if (ar) localAr = ar;
else localAr = new Array();
}
/**
* @inheritDoc
*/
public function get length():int
{
return localAr.length;
}
public function getItemAt(index:int):Object
{
if (index < 0 || index >= length)
{
trace(” VOCollection.getItemAt OutOfBounds”);
return(new Object());
}
// trace (”VOCollection.getItemAt: ” + index + “)” + localAr[index]);
return localAr[index];
}
/*
*
*/
public function add(item:Object): int
{
// trace (”VOCollection.add: ” + item.toString());
localAr.push(item);
return localAr.length - 1;
}
/**
*
*/
public function setItemAt(item:Object, index:int):void
{
if (index < 0 || index >= length)
{
trace(” VOCollection.setItemAt OutOfBounds”);
}
else
{
localAr[index] = item;
}
}
public function getIndexFor(item:Object):int
{
for (var cntx:int =0; cntx < localAr.length; cntx++ )
{
if (localAr[cntx] == Object) return cntx;
}
return(-1);
}
public function getItemByName(name: String):Object
{
for (var cntx:int =0; cntx < localAr.length; cntx++ )
{
if (localAr[cntx].name == name)
{
return (localAr[cntx]);
}
}
return(undefined);
}
public function toString():String
{
var outputString: String = ” ” + this.name +”(”+localAr.length +”)” ;
if (localAr.length > 0)
for (var cntx:int =0; cntx < localAr.length; cntx++ )
{
outputString +=”\n “+ cntx+”)” + localAr[cntx].toString();
}
else
{
outputString = “:EMPTY”;
}
return outputString;
}
public function copy():VOCollection
{
var retCollection: VOCollection = new VOCollection();
for (var cntx:int =0; cntx < localAr.length; cntx++ )
{
retCollection.add(localAr[cntx].copy);
}
return retCollection;
}
public function sortOn(fieldName: Object): void
{
localAr.sortOn(fieldName,[Array.NUMERIC]);
}
}//end VOCollection
package AppMVC.Model.Business
{
import flash.errors.*;
import flash.events.Event;
import mx.rpc.IResponder;
import flash.net.URLLoader;
import flash.net.URLRequest;
import Utils.Debugger;
public class LoadEXDelegate
{
private var responder : IResponder;
private var url:String;
private var loader:URLLoader;
private var mainXML:XML;
public function LoadEXDelegate( responder : IResponder, url:String)
{
loader = new URLLoader();
this.url = url;
this.responder = responder;
}
public function load() : void
{
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest(url));
}
private function onComplete(evt:Event): void
{
try
{
mainXML = new XML(loader.data)
} catch(e:Error)
{
this.responder.fault(e);
return;
}
this.responder.result(mainXML);
}
}
}
package AppMVC.Model
{
///////////////////////////////////////////////////////////
// ConfigProxy.as
// Macromedia ActionScript Implementation of the Class ConfigProxy
// Generated by Enterprise Architect
// Created on: 03-Jul-2008 5:32:12 PM
// Original author: iMAN
///////////////////////////////////////////////////////////
import VOs.ConfigVO;
import org.puremvc.as3.patterns.proxy.Proxy;
import APPMVC.Model.Helpers.ConfigEXResource;
import D4MVC.Model.Business.LoadEXDelegate;
import D4MVC.ApplicationFacade;
import mx.rpc.IResponder;
import Utils.Debugger;
/**
* anything loaded from external Config file
* @author iMAN
* @version 1.0
* @created 03-Jul-2008 5:32:12 PM
*/
public class ConfigProxy extends Proxy implements IResponder
{
public static const NAME:String = “ConfigProxy”;
/**
* Constructor
*
* @param proxyName
* @param data
*/
public function ConfigProxy(data:Object = null )
{
super(NAME, data);
startupMonitorProxy = facade.retrieveProxy( StartupMonitorProxy.NAME ) as StartupMonitorProxy;
startupMonitorProxy.addResource( ConfigProxy.NAME, true );
}
public function load():void
{
// reset the data
this.data = new Object();
// create a worker who will go get some data
// pass it a reference to this proxy so the delegate knows where to return the data
var delegate : LoadEXDelegate = new LoadEXDelegate(this, ‘data/config.xml’);
delegate.load();
}
// this is called when the delegate receives a result from the service
public function result(rpcObject:Object ) : void
{
data= ConfigEXResource.parse(rpcObject);
this.startupMonitorProxy.resourceComplete( ConfigProxy.NAME );
}
// this is called when the delegate receives a fault from the service
public function fault(info:Object) : void
{
Debugger.log (”ConfigProxy.fault”);
// log.debug(”SuggestionProxy.fault”);
// send the failed notification
this.sendNotification( ApplicationFacade.LOAD_FAILED, “ConfigProxy Failed, ” + info.toString() );
}
Comments are off for this postMar 23
Flash Game Summit
I attended the first ever flash game summit. It was great to have one of those. Ada Chen from Mochi did a great job organizing everything.
My notes below:
MultiPlayer:
Types: Head to Head / Competitive, Cooperative.
Negatives: loss (try to minimize loss). Stuck
Problems: when a person is booted out while game is still going,
Good things: aggressively iterate on audience feedback.
How to get multi player games popular: 1) Long Alpha and Beta, High Scores, player recognition
“platform racer 2” great job getting player into game (millions of monthly plays).
Player drops, AI fills.
“puzzle pirates”
All multilayer should have single player modes for instruction, battle ground (get people comfortable).
Hosted site must be a community that will appreciate game, ie cooperative game should be hosted on social site.
Average Gamer likes things they know already: card game, puzzel game.
$$$: micro transactions maybe, figure it out later.
You need to build enough context for people to value things (ie story line, connections).
Multilayer monetize(credit card) at 3(5%-20% of active users), Single Player(credit card) at 2%.
Back end: Smart Fox, Electro-Server
Games: Scrapper, facebook games, pet society,
Face book is viral, Portals are not.
Viral-ness: url should link to session.
How do people play: most people use credit card, then pay pall, (sms??)
Grieving: More death, more grieving. “idiots expressing themselves”. In cooperative game match people by skill, not too many high level grievers.
even simple puzzle game should have hardcore components/elements
asynchronous multiplayer – go do something, leave, other people show up and do something and then leave, and then game state persists
blog: eric reese, startup lessons
Monetizing:
ads and non-exclusive license.
give traffic to your site or to sponser.
ad only works for top tier game.
In-game ads : some portals wont take your game. 30% more return w/o ingame ad.
Links: mindJolt, gimme5games (they pay you), flashgamelicence
Kongergate brings ad revenue.
Achievement can unlock a banner that people can put on there myspace and link back.
Retaining users is key.
*Ingame sharing mechanism (share something user builds or accomplishes).
Contests: make sure you dont give away rights, if you dont win can you get a nonexlusive.
Game is worth the most before its released (drivin off the lot).
If something works, create sequel, dont launch it to close, change more than content, new mechanism.
Game Maker Assets include Brand, IP
33% under 15 (more hardcore, ad revenue), 33% 15-25, 25+ (more casual, direct Pay)
analytics: quancast, com score demographics.
Down loadable size of game to distribution (a good game can be upto 15MB, sweet spot at 3MB.)
To be successful in distribution: devout a lot of time to distribute, lots of portals,
user created content by link incentives-es users to share.
Flashgamedistribution good way to distribute.
Problem with flash: easily scrap able.
Sites: newgrounds at the right hour.
Adobe:
Flash Media server is cheap (entry level = 1000), peer to peer.
Flash 10: Custom Filters and effects, 3D efects, Print-quality text, color manager
HardWare acceleration, Graphical rendering improvements, Vector,
Rich Media: Audio Processing, Dyncamic Streaming, Speex audio, XMP data, Next gen communication over UDP (RTMFP).
Pixel bender: multi threaded functionality.
RTMFP : Peer to peer audio video, udp.
Stratus (hosted version of rtmfp).
3 Questions: 1 round trip time, 2. concurrent connection pricing, 3. multiple peers?
Projects : WiiFlash, merapi
just released, distributable player: labs.adobe.com/technologies/distributableplayer
Flash player 9 on play station 10, wii flash player 7.
Monetization
vested time in developing character monetize well.
Lite wieght (3K), simple, gameplay, big game dimensions
CPM: (type of traffic). High CPM from US(2.50 CPM), not in china(.02 CPM).
Virtual currency powerful in china.
Links: Super Rewards, AddictingGames.
advertisers are interested in weeving there message into message of a game. Differentiation.
Social gaming.
Metrix developers should look at to value properties/games: RIA: length of play time (8 minutes +), probability of return.
LEADER BOARD (+30%), clean colorful simple thumbnail
building advergame for client.
Virtual currency
Comments are off for this post
Feb 3
Park Fifth sales center
About a year ago I wrote sales center software for a site called Park Fifth. I blogged about the whole thing here:
Recently I found pics of the sales center. The cool thing is, there is an actual 3D model of the site, and our software showcased a 3D model of the site, and when you clicked on a unit in the software, the unit in the model would light up. Its pretty kewl. Here are the pics:
http://www.flickr.com/photos/eecue/2074159617/in/photostream/
http://www.flickr.com/photos/eecue/2074953644/in/photostream/
http://www.flickr.com/photos/eecue/2074953946/in/photostream/
http://www.flickr.com/photos/eecue/2074159223/in/photostream/
http://www.flickr.com/photos/eecue/2074952100/in/photostream/
Dec 22
Enterprise Architect language template for haXe
I have just created a Enterprise Architect language template for haXe. If you use EA and would like to export haXe stub code based on your UML then this is for you.
Instructions:
- Download XML
- import the XML file into EA (Tools -> Import Reference Data, find the downloaded XML file, select both datasets, and click import.
- Now select haXe as your language and start building your UML. Note, the datasets are only applied to your current project and not at an application level.
Known issues:
currently files are being exported as with a .h extension instead of a .hx. This will be solved when I create an MGD technology file.
Request:
Please let me know if there are any issues. I will be taking feedback into consideration as I build the MGD Technology file for EA + haXe.
Comments are off for this postDec 21
My 25 lines
I made a little swf for the 25 lines contest. I did not make the finals, but wanted to share. This particular version was done in 16 lines. For the 25 lines contest I used the remaining 9 lines to create custom sound (which I can only imagine backfired since it sounded pretty bad).
my 25 lines swf
Sep 12
PureMVC: How to load assets and data in PureMVC.
Below I illustrate how I have been able to successfully load external assets (swfs) and data into pureMVC with a sequence diagram.
Actually you should probably just download the Diagram jpg to take a closer look …
http://www.imanit.com/blog/wp-content/2008/09/Sequence.jpg

Also Below is all the text from the diagram in case you want to cut and paste:
entry point class:
//The entry point class extends Sprite. This sprite in most instances is the stage.
// call facade.startup and send it a reference that can be casted to the application
facade.startup(this)
ApplicationFacade.as, override protected function initializeController( ) : void
super.initializeController();
//When startup dispatched, call preloaderCommand
// The preloaderCommand loads up the preloader asset
// Once the preloader asset the PRELOADER_LOADED is dispatched and the loaded asset is registers the
//with PreloaderMediator
// PreloaderMediator listens for Loading Nodifications and updates accordinly.
registerCommand( STARTUP, PreloaderCommand );
// once preloader loaded, run ModelPrepCommand
registerCommand( PRELOADER_LOADED, ModelPrepCommand );
// Once Model Loaded, Load the View.
registerCommand(MODEL_LOADING_COMPLETE, ViewPrepCommand);
ApplicationFacade.as, public function startup( app:Sprite ):void
//sends the “STARTUP” notification which initiates the “ApplicationStartupCommand” with a refrence to
//the application
sendNotification( STARTUP, app );
ModelPrepCommand.as, override public function execute( note:INotification ) :void
facade.registerProxy(new StartupMonitorProxy());
// register all of your proxies as well
// these proxies are responsible for loading data. lets look at one example called ConfigProxy
facade.registerProxy(new ConfigProxy());
// you should be able to get startupMonitorProxy code from a pureMVC demo
var startupMonitorProxy:StartupMonitorProxy = facade.retrieveProxy( StartupMonitorProxy.NAME ) as
StartupMonitorProxy;
startupMonitorProxy.app =note.getBody();
startupMonitorProxy.loadResources();
ConfigProxy.as, public function ConfigProxy ( data:Object = null )
super ( NAME, data );
startupMonitorProxy = facade.retrieveProxy( StartupMonitorProxy.NAME ) as StartupMonitorProxy;
// add the resource to load
startupMonitorProxy.addResource( ConfigProxy.NAME, true );
this.data = new ConfigVOCollection();
ConfigPorxy.as,public function load():void
// LoadEXDelegate uses the responder pattern so we need to define a result and a fault
// that are called from LoadEXDelegate accordingly
var delegateR: LoadEXDelegate = new LoadEXDelegate(this, “data/Config.xml”);
delegateR.load();
ConfigPorxy.as, public function result( rpcObject :Object ) : void
data = ConfigResource.parse(rpcObject);
this.startupMonitorProxy.resourceComplete( ConfigProxy.NAME );
ConfigPorxy.as, public function fault( info:Object ) : void
// this is called when the delegate receives a fault from the service
this.sendNotification( ApplicationFacade.LOAD_FAILED, ApplicationFacade.ERROR_LOAD_FILE );
ViewPrepCommand.as, override public function execute( note:INotification ) :void
// Register the ApplicationMediator
// Notice we are sending the stage to the application mediator.
facade.registerMediator( new ApplicationMediator( note.getBody() as Sprite ) );
ApplicationMediator.as, public function ApplicationMediator( viewComponent:Sprite )
super( NAME, viewComponent );
loader = LoadManager.getInstance();
loader.load(loader.ASSET,”assets/A.swf”,1,onALoadComplete,onLoadFail);
loader.load(loader.ASSET,”assets/B.swf”,1,onBLoadComplete,onLoadFail);
LoadManager.as, public static function getInstance() : LoadManager
if (instance == null)
{
//Its very important we keep a memory reference to everything we load or
// The garbage collector could kill it while we are waiting for the loadcomplete callback
aLAR = new Array();
instance = new LoadManager( );
}
return instance;
LoadManager.as, public function load(loadType:String, url:String, priority:uint, onLC:Function,onLF:Function): void
switch ( loadType )
{
case ASSET:
// define url, an onComplete function, and an onFail function.
aLAR.push(new AssetLoader(url, onLC, onLF ));
//When the complete or Fail comes back call the AssetLoader kill function for that AL to clean
//up memory.
break;
}
ApplicationMediator.as, protected function onALoadComplete(e:Event):void
app.A = e.target.content;
show(app.A as DisplayObject,2);
facade.registerMediator( new PanelMediator( app.panel) );
oneLoaded();
ApplicationMediator.as, private function show(myDO:DisplayObject,layer:uint, initAlpha:Number =0):void
//show takes care of layering and visibility. uses a private varaible called orderAr
var ind: uint = 0;
for (var cntx:uint= 0; cntx < orderAr.length; cntx++)
{
if (layer > orderAr[cntx]) ind++;
}
orderAr.push (layer);
trace (myDO + ” beats: ” + ind + ” with a score of:” + layer + ” in array:” + orderAr);
app.addChildAt(myDO, ind)
myDO.visible= true;
myDO.x = 0;
myDO.y =0;
myDO.alpha=initAlpha;
ApplicationMediator.as, private function oneLoaded():void
loaded++;
if (loaded == 2)
{
sendNotification( ApplicationFacade.LOADING_COMPLETE);
}
Aug 26
Object Oriented Concepts
Below is a short list of object oriented concepts.
Object:
An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.
Class:
A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavior.
Inheritance:
Inheritance provides a powerful and natural mechanism for organizing and structuring your software. This section explains how classes inherit state and behavior from their superclasses, and explains how to derive one class from another using the simple syntax provided by the Java programming language.
Package:
A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage. This section explains why this is useful, and introduces you to the Application Programming Interface (API) provided by the Java platform.
Interface:
An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface. This section defines a simple interface and explains the necessary changes for any class that implements it.
Encapsulation:
Encapsulation is the ability to bundle the property and method of the object and also operate them. It is the mechanism of combining the information and providing the abstraction as well.
Inheritance:
Inheritance provide the facility to drive one class by another using simple syntax. You can say that it is a process of creating new class and use the behavior of the existing class by extending them for reuse the existing code and adding the additional features as you need. It also use to manage and make well structured software.
Composition - Association and Aggregation
Composition is a slightly different sort of relationship - this is where it could be said that a class was “composed” of other classes. For instance, a wall is “composed” of bricks and a molecule is “composed” of atoms. Neither of these examples could be described as inheritance - the statement, “a wall is a brick” simply isn’t true. Composition can be described as “has a” and “uses a” relationships; a wall “has a” brick or a wall “uses a” brick.
Polymorphism:
In simple terms, polymorphism lets you treat derived class members just like their parent class’ members.
Polymorphism is the process of using an operator or function in different ways for different set of inputs given.
More precisely, polymorphism (object-oriented programming theory) is the ability of objects belonging to different types to respond to method calls of the same name, each one according to an appropriate type-specific behavior. The programmer (and the program) does not have to know the exact type of the object in advance, so this behavior can be implemented at run time (this is called late binding or dynamic binding).
The different objects involved only need to present a compatible interface to the clients (the calling routines). That is, there must be public methods with the same name and the same parameter sets in all the objects. In principle, the object types may be unrelated, but since they share a common interface, they are often implemented as subclasses of the same parent class. Though it is not required, it is understood that the different methods will also produce similar results (for example, returning values of the same type).
In practical terms, polymorphism means that if class B inherits from class A, it doesn’t have to inherit everything about class A; it can do some of the things that class A does differently. This means that the same “verb” can result in different actions as appropriate for a specific class, so controlling code can issue the same command to a series of objects and get appropriately different results from each one.
Overriding and Overloading:
If a Dog is commanded to speak(), this may emit a Bark. However, if a Pig is commanded to speak(), this may emit an Oink. They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism.
Overloading Polymorphism is the use of one method signature, or one operator such as “+”, to perform several different functions depending on the implementation. The “+” operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the concatenation operator, “+”, to work this way. This helps improve code readability.
Comments are off for this postAug 26
Web Development: How to get started
A friend asked me for some tips on getting started in the world of web development. Here is what I wrote:
Advice:
- You should try to get simple “Hello World” applications running in each. Then make the application more complicated.
- Also just learn Actionscript 3.0 . Dont waste time with 2.0
- Beyond actionscript you need: HTML, PHP, CSS, XML
- Don’t waste too much time on XML. If you get the concept your good.
- Make a program in php and actionscript that parses XML and traces to screen and your good.
To actually do work you will need to download,install, and master IDEs (Development Environments).
- for Actionscript 3.0 use flash and flex
- for HTML use dream weaver and eclipse (with an html plugin “HTML Tidy”)
- for PHP use eclipse with a php plugin
Make sure you download the 30 day trials of all of this stuff.
Tutorial links:
- http://www.virtualshowrooms.co.za/articlepage.php?cp=101
- http://imanit.com/blog/?p=60
- http://www.senocular.com/flash/tutorials/as3withflashcs3/
- http://www.w3.org/2002/03/tutorials
- http://www.php.net/tut.php
Once you mastered syntax, start mastering ood by joining a forum: http://oodforum.com/forums/
Most of all, enjoy!
Comments are off for this postAug 10
Tacori Male Microsite
here is a link to my latest work: http://gentlemensguide.tacori.com/
I did all the action scripting for this site. I used PureMVC, tweener, etc. I used Flex Builder (actionscript only project) and loaded asset swfs that where made in flash.
No comments