1 Reply Latest reply on Jun 4, 2006 3:34 PM by neil manuell


    neil manuell Level 1
      is it possible to create a BitmapData object from an externally loaded bitmap? or does it have to be in the libray?
        • 1. Re: BitmapData
          neil manuell Level 1
          fo thoughs who would know.... I did a search of this forum

          //import BitmapData
          import flash.display.BitmapData;
          //stop movie so it doesn't repeat over and over
          //load a pic into an mc on the stage
          content_mc.loadMovie("flash.jpg", 1);
          //create a function that runs every frame (only for this example, it keeps running and you won't want that
          _root.onEnterFrame = function() {
          //this is the interesting bit, basically the next line is your preloader 100% action, the pic has to actually have been fully loaded before we can do this
          if (_root.content_mc.getBytesLoaded() == _root.content_mc.getBytesTotal()) {
          //create a variable to hold the bitmapdata info
          myBitmapData = new flash.display.BitmapData(content_mc._width, content_mc._height, true, 0x00FFFFFF);
          //copy the bitmap into the bitmapdata variable we just created
          //now attach it to a different mc for the sake of example
          _root.content_mc2.attachBitmap(myBitmapData, 1, "auto", true);
          //rotate both movieclips so you can see the difference
          _root.content_mc._rotation = 30;
          _root.content_mc2._rotation = 30;

          thanks to myFlash83