In Flash 9, you can have a Actionscript class associated with the _root of the Movie. You do this by creating a class that extends MovieClip and represents the _root, then in the properties pane, you assign it as the Document Class.
When attempting to use this new feature, I have had a lot of people asking me why they get the error
ReferenceError: Error #1056:
Cannot create property test1_btn on Test.
at flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at Test$iinit()
This is due to the fact that you must publicly declare any element (Buttons, MovieClips, TextFields, etc.) instance in your class that exist on the stage and is named.
For example, if you have a Movieclip drawn on the stage named "myMc" it would be defined as a public var in your Document class like :
-
package
-
{
-
import flash.display.MovieClip;
-
-
public class Test extends MovieClip
-
{
-
public var myMc:MovieClip;
-
-
public function Test()
-
{
-
}
-
}
-
}

Subscribe to RSS
#1 by John Giotta - July 12th, 2006 at 09:14
I find Sprite to be more of what I want (in AS2.0 perspective).