A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: offline/online problems with BitmapData class

  1. #1
    Junior Member
    Join Date
    Apr 2001

    Question offline/online problems with BitmapData class

    I'm trying to understand why this code does not work when viewed online vs. offline.... and of course what can I do to fix it?

    this is a simple example of snapshotting an image that was loaded into an mc using loadClip lifted from flash8 livedocs.

    to test offline paste this into flash8

    online version here:

    please advise, thanks!

    import flash.display.BitmapData;
    scale=150 //scale percentage
    //normzalize the scale
    //create a new transformation matrix
    scaleMatrix = new Matrix()
    // create a clip with visual content
    original = this.createEmptyMovieClip("orig", this.getNextHighestDepth());
    loader = new MovieClipLoader();
    loader.loadClip("http://images.businessweek.com/ss/06/06/bills_milestones/image/windows.jpg", original);
    function onLoadInit()
    // create a BitmapData object with the same size
    var myBitmapData:BitmapData = new BitmapData(original._width, original._height);
    // attach the Bitmap to a clip so that it will be rendered on screen
    var copy:MovieClip = this.createEmptyMovieClip("cop", this.getNextHighestDepth());
    copy.attachBitmap(myBitmapData, this.getNextHighestDepth());
    copy._x = 100;
    // take a 'snapshot'
    Last edited by roninz; 08-30-2006 at 04:14 AM.

  2. #2
    Junior Member
    Join Date
    Jan 2006
    im having the exact same problem. cant find my way around it

  3. #3
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    It is a security issue, since you are calling a url outside from a different domain. Offline when you test movie, it is ok.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  4. #4
    Junior Member
    Join Date
    Apr 2001
    Quote Originally Posted by cancerinform
    It is a security issue, since you are calling a url outside from a different domain. Offline when you test movie, it is ok.
    so what's the solution?

  5. #5
    Junior Member
    Join Date
    Apr 2001

    can you point me to a solution to this problem?

    much appreciated!

  6. #6
    Junior Member
    Join Date
    Apr 2001
    this is the closest thing to a real answer I could get at least it points me to a direction for further investigation.


    here's the golden nugget:

    If you control both domains in a cross-domain situation, you can use System.security.allowDomain to permit BitmapData.draw to work across domains. Say that domain A is the one calling BitmapData.draw, and domain B is the one from which the media was loaded. If the media from domain B is a SWF, it can call System.security.allowDomain("domainA.com"), and then the SWF from domain A can call BitmapData.draw.

    Note that there is one problem with this permission mechanism: as of player 8, SWFs tend to speak only for themselves when they call allowDomain, and not for their entire domains. This means there's no obvious way to permit BitmapData.draw to work across domains when the out-of-domain media being rendered is a JPG, GIF, or PNG. The workaround in this situation is to embed your JPG, GIF, or PNG in a SWF, and have that wrapper SWF call allowDomain. Macromedia is aware of this limitation and we hope to fix it in a future release.
    livedoc comments page

    some more recent comments offer php and asp workarounds

    when I go thru and digest all this and build a working example I will post it here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center