Actually I solved this problem myself.

Bitmap.draw(source) has an (undocumented) security restriction:  source
movieclip has to be loaded from exactly the same domain as the hosted movie
(including the subdomain).

Otherwise draw() just silently fails, WITHOUT producing a security warning.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alec Matusis
Sent: Thursday, May 04, 2006 4:29 PM
To: [email protected]
Subject: [Flashcoders] bitmap.draw problem in flash 8 

 
I need to do the following:
 
1) load a jpg image into a movie clip A from a remote server (same as the
server where flash the movie resides)
2) create a bitmap 
3) attach this bitmap movie clip B
4) draw the jpg from movie clip A into the bitmap, so that it appears in
movie clip B
 
This works properly in the Flash composer, but stops working as soon as I
put the swf file on the server.
No security violation dialog appears, and it should not, since the image and
the movie are loaded from exactly the same domain. 
 
 
I use this code
 
 
downloadListener.onLoadInit = function(source:MovieClip){
     var bitmap = new flash.display.BitmapData(source._width,
source._height);
     _level0.mcB.attachBitmap(bitmap, _level0.mcB.getNextHighestDepth());
     bitmap.draw(source);
}
 
var imgLoader:MovieClipLoader = new MovieClipLoader();
imgLoader.addListener(downloadListener);
imgLoader.loadClip(image_url,_level0.mcA);
 
 
When I put the swf on the server, all pixels of mcB (the target) have color
value 16777215 , which is clearly an error, since this is 2^24 - 1, maximum
color value.
In the flash composer, the pixels have correct color values.
 
Any idea why this is happening?  

 
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to