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.

ActionScript

  1. class CreateMC_AS2 extends MovieClip {
  2.     var container:MovieClip;
  3.     public function CreateMC_AS2() {
  4.         container = _root.createEmptyMovieClip("container", this.getNextHighestDepth());
  5.         container.loadMovie("c:\\super.jpg");
  6.     }
  7. }

Example create movieclip in action script 3.0 and load one image.

ActionScript

  1. package {
  2.    import flash.display.MovieClip;
  3.    import flash.display.StageAlign;
  4.    import flash.display.StageScaleMode;
  5.    import flash.util.trace;
  6.    public class CreateMC extends MovieClip {
  7.       [Embed(source='c:\super.jpg')] public var MyImage:Class;//the image in C:\
  8.       public function CreateMC() {
  9.          stage.align     = StageAlign.TOP_LEFT;
  10.          stage.scaleMode = StageScaleMode.NO_SCALE;
  11.          var img:MyImage = new MyImage();
  12.          addChild(img);
  13.          trace(img);
  14.       }
  15.    }
  16. }

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

ActionScript 3.0, Flash, Flash Platform, Flex, Principal, RIA

Leave a Reply