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

    Load a  external jpg in BitmapData

    Level 7
      Hello Everybody,

      I search a way to load a external jpg from my server in my swf to use
      it with the BitmapData-Class.
      The Method loadBitmap only works with images from my internal library.
      What do you think is the best way to solve this problem.
      For me it seems to be a little bit stupid to load the image in a MovieClip.
      Then Scan the Mc to write it in a BitmapData-Object.
      To Filter it. And then write it back to an MC.
      Do you know a way, where I can load it directly to and BitmapData-Object
      like this:

      1) load Image in BitmapData-Object
      2) Filter - Image
      3) attachBitmap to MovieClip

      I am a noob with Flash 8 and my english is very bad.
      So sorry and thanks for you help


        • 1. Re: Load a  external jpg in BitmapData
          neil manuell Level 1
          //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;
          supplied by myFlash83