ActionScript 2 Tip Of The Day

This info is available elsewhere on the web, but it was hard to find, so maybe reposting it here will make it easier (and if I need it again, I’ll be able to find it myself!).

If you are trying to use BitmapData.draw() to create BitmapData based on some file that you loaded from a remote server, e.g., via loadMovie(), and your output BitmapData is blank/empty/all white space, there is a good chance that you need to force your AS2 code to load the crossdomain.xml file from the remote server via System.security.loadPolicyFile() in order for it to work. Without this, Flash decides that it doesn’t have permissions to write the image to a new BitmapData object, even if it’s already happily displaying the loaded image to you on the screen. Makes no sense to me, but this is the workaround.:)

Hope this helps someone else who hasn’t made the move to AS3 yet.

Leave a Reply

Your email address will not be published. Required fields are marked *