1 Reply Latest reply on Nov 23, 2010 5:10 AM by Ned Murphy

    Bringing in External images

    sellador315 Level 1

      Hi all,

       

      I'm using the following code to bring in external images, however, I would like the images to come in and be behind everything else instead of placing themselves on top of everything.

       

      var l:Loader;

       

      roll_btn.addEventListener(MouseEvent.ROLL_OVER, roll_btnClicked);

       

      function roll_btnClicked(evt:MouseEvent):void {

           l = new Loader();

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

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

           l.load(new URLRequest("jackdaw.jpg"));

           l.x = 0;

           l.y = 270.25;

      }

       

      function loop(e:ProgressEvent):void

      {

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

           percent.text = Math.ceil(perc*100).toString() +"%";

      }

       

      function done(e:Event):void

      {

           percent = null;

           addChild(l);

      }

       

       

       

      Anyone know how to do this? I'm assuming you need to tell it to sit on another layer. Not quite sure how to do this though.

       

      Thanks for any help.

       

      Cheers

      T