createEmptyMovieClip no more!!!

It has some months the ActionScript 3.0 this available one so that the developers know the new language of the Adobe/Macromedia. Rewrite practically of the zero. One of the changes it is that it was removed the methods “createEmptyMovieClip”,”attachMovie” among others. The questions, who use these methods in its scripts (like me), will have that to adapt for the new language.

Example create movieclip in action script 2.0 and load one image.
[as]class CreateMC_AS2 extends MovieClip {
var container:MovieClip;
public function CreateMC_AS2() {
container = _root.createEmptyMovieClip(“container”, this.getNextHighestDepth());
container.loadMovie(“c:\\super.jpg”);
}
}[/as]

Example create movieclip in action script 3.0 and load one image.
[as]package {
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.util.trace;
public class CreateMC extends MovieClip {
[Embed(source=’c:\super.jpg’)] public var MyImage:Class;//the image in C:\
public function CreateMC() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var img:MyImage = new MyImage();
addChild(img);
trace(img);
}
}
}[/as]

ActionScript 3
http://labs.macromedia.com/wiki/index.php/ActionScript_3:overview

Migrating Applications to Flex 2
http://livedocs.macromedia.com/labs/1/flex/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part5_ProgAS.html

Leave a Reply