Archive for February, 2009

Tips for things A-ne-pas-faire in flash

you should avoid doing the folowing habits/behaviors when dealaing with Flash:

  1. Never create animations directly on root of the timeline, better create a movie clip for your animations, then insid this created MC, insert your animation. This way, you can easily re-position your animation on the timeline (rather than modifying the position of every keyframe on your animations).
  2. Organize your timeline/library;  don’t create un-necessary MC’s, give items appropriate names.

Instance Names for Programmatically Created Display Objects

As it happens, like manually created instances, display objects created programmatically can also be assigned an instance name via the name variable. For example, the following code creates a TextField instance, gives it the instance name “price,” adds it to a container, and then retrieves a reference to it by name.


var t:TextField = new TextField( );
t.text = "$99.99";
t.name = "price"
var detailsPage:Sprite = new Sprite( );
detailsPage.addChild(t);
trace(detailsPage.getChildByName("price"));
// Displays: [object TextField]

Read the rest of this entry »