after6ix

Declaration of stage instances

For ActionScript 2.0, whenever you are writing a class for a movieclip that contains other child movieclips, to obtain references to these movieclips, declarations for the child movieclips would typically be done within the parent class code.

class SampleApp extends MovieClip{
	private childClip1:MovieClip; //instance child mc
	private childClip2:MovieClip; //instance child mc
	...
}

However with the ActionScript 3.0 in Flash CS3, this can be done automatically without a manual declaration as shown in the class code above. To have this done automatically, under File > Publish Settings > Flash > ActionScript 3 settings, check on "Automatically declare stage instances".

By doing this, you should not be declaring any of the child movieclips as members of the parent movieclip class. They will automatically be accessible via their instance name.

Automatically declar stage instances

However, if you are like me who prefers to have more control and more verbose declaration of members in a class, you can choose not to opt for this automatic declaration. The child movieclips can be declared in the same manner as per the way done in ActionScript 2.0.

One thing to note is that the access modifier would have to be set to "public" else the compiler would complain that it cannot create the property. If you think about it, the access modifier has to be public since the child movieclips can be accessed anywhere via the dot notation.

class SampleApp extends MovieClip{
	public childClip1:MovieClip; //instance child mc
	public childClip2:MovieClip; //instance child mc
	...
}

COMMENTS

Fri 04 Apr10:05 PM
mike

mike

I have recently used custom essay writing on ActionScript 3.0 in Flash CS3.  This well-written article was cited among the used sources.

Fri 23 May10:56 PM
youtube

youtube

Be calm thank you very much

Sun 25 May05:21 PM
facebook

facebook

Good article

Thank you for the informations.!!!!!!!

kraloyun
kral oyun
oyun
minikperi
kraloyun
kral oyun
games

LEAVE A COMMENT

Commenting is not available in this weblog entry.
COMMENTS HAVE BEEN CLOSED ON THIS ENTRY