Actionscript 3.0: everything with the new operator
Thursday, January 31, 2008 Also with a view to "standardize", as happened with the events (see The new management of the events of Flash CS3 and Flash CS3: The new management of events), one of the many innovations in Actionscript 3.0 is the disappearance of all those ad hoc methods dedicated to the creation of specific items such as: createEmptyMovieClip() the famous attachMovie() Actionscript 3.0 with new new operator is sufficient to carry out all operations of creation. A new MovieClip, for example, is created (runtime) with the following code:
- = new MovieClip ( ) ; var mioClip: MovieClip = new MovieClip ();
- ; addChild (mioClip);
But to come then! If I have a symbol in the library and I want to add runtime proceed as if attachMovie() has disappeared? The solution is not very dissimilar from what happened in Actionscript 2.0. First you need to go to the library panel, select the symbol and open the property. Then check the box concatenation Export for ActionScript - as happened in Flash 8. A symbol library has always Class basis flash.display.MovieClip but that does not interest us much. The interesting thing, however, is the parameter class that is set by default (when you check Export for ActionScript) with the name of the symbol. What is important to note is that this is a new mode of Flash CS3 (and ActionScript 3.0). The symbol, to be exported must have a class reference. The curiosity is that we are not forced to create a strength for our Class (extended by flash.display.MovieClip even if we could do it. ... Continue reading "
































