7 Replies Latest reply on Jan 28, 2010 11:43 AM by kglad

    Code Not Entering Functions

    beno12345

      Hi;

      I have the following code in the first frame of the only layer of the timeline, and nothing else in the layer:

       

      var myTextField:TextField = new TextField();

      addChild(myTextField);

      myTextField.width = 250;

      myTextField.x = stage.stageWidth/2 - 50;

      myTextField.y = stage.stageHeight/2;

      myTextField.selectable = false;

      myTextField.border = true;

      myTextField.autoSize = TextFieldAutoSize.LEFT;

      var myFormat:TextFormat = new TextFormat();

      myFormat.color = 0xAA0000;

      myFormat.size = 24;

      myFormat.italic = true;

      myTextField.setTextFormat(myFormat);

       

      var l:Loader = new Loader();

      l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);

      l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);

      l.load(new URLRequest("main.swf"));

       

      function loop(e:ProgressEvent):void

      {

      trace('loop');

      var perc:Number = e.bytesLoaded/e.bytesTotal;

      myTextField.text = Math.ceil(perc*100).toString();

      }

       

      function done(e:Event):void

      {

      removeChildAt(0);

      myTextField = null;

      addChild(l);

      trace('done')

      }

       

      Nothing traces, but it does print out that it enters main.swf, since it prints out:

      at Main/HatAndFace()

      at Main/init()

      at Main()

       

      Please advise.

      TIA,

      beno