This content has been marked as final. Show 4 replies
Hi,1 person found this helpful
MovieClip itself is a built-in class. You're extending that class, that's all! For your purpose,
1. Draw a movie clip on the stage.
2. Open the library panel and right click on the movie clip you just created, and select 'linkage' from the list.
3. From the dialog box that appears, select the 'Export for ActionScript' check box.
4. In the AS 2.0 class field, type 'Test'. Click OK and close.
Now, test the movie and you will realize that how the original movie clip class has been extended.
Apart from this, you can create custom classes also.
Yeah, you can link a class with a MovieClip symbol, but then you have to use the attachMovie() function which is outdated actionscript 1.0 style. Additionally you have to have a blank MovieClip symbol defined in the library for each class that extends MovieClip. If you make children classes, you have to create new symbols for those, etc, etc. If a class extends MovieClip, instantiating it should create a MovieClip. That seems like the natural thing to do... But instead you have to use these funky attachMovie or createEmptyMovieClip functions. Is this fixed in AS 3.0?
Good analysis but I'm a novice in AS 3. Anybody can answer this? I'm also waiting for some nice replies.1 person found this helpful
Yes, I believe its more like you're used to in as3.
So in as2 extending a MovieClip is not "as it should be". But its not too difficult to get used to. If you're just starting with actionscript coming from another OOP language you may want to start with as3.
If you're doing it in as2 then cast the return type of attachMovie to your class.
var mynewThing:Thing = attachMovie("thingClip", "firstThing", nextdepth)
There are some 'tricks' to avoid using a library symbol:
"an empty movie clip is automatically created for your class in your library with the linkage id __Packages.[full class name]. So you could just use that without defining any symbols yourself."