January 16th, 2011

  • Flash

checkPolicyFile with redirects

Happy New Year everybody!  Thought I would start it off right by sharing a little tidbit about working with cross domain files when there are redirects.  Normally if you needs to access the bitmapdata from a file loaded on another domain you need to explicitly tell Flash to check the crossdomain.xml file.  I'm not sure why this isn't the default.

loaderContext = new LoaderContext(true);
loaderContext.checkPolicyFile = true;
...
var yourLoader:Loader = new Loader();
yourLoader.load(YourURLRequest, loaderContext);

This works most of the time, unless the file you're loading is redirected, e.g., Facebook profile images.  Flash isn't smart enough to check for the new domains crossdomain.xml file after a redirect, so you have to manually tell it.  Like so:

Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");

I typically put that right above the LoaderContext code. Problem solved and now you can use an open graph url to load a Facebook profile image.

September 16th, 2009

  • Flash

VideoEvent.COMPLETE and SoundMixer.stopAll()

I just ran across a strange behavior in flash that might save you a few mnutes of head scratching. I had a video playing using a FLVPlayback component.  I also had a button with a roll over sound on it.  On roll over I used SoundMixer.stopAll() to kill any extra roll over sounds.  Well this also kills the video sound and triggers the video complete event.  My best guess is the SoundMixer class is killing all of the video streams in addition to any audio streams.  Lesson learned.

June 1st, 2009

  • Flash

FLVPlayback Not Playing

I ran across an interesting bug within the FLVPlayback component include with CS4 today.  About half the time the component wouldn't play a video (I think its related to a combination of other classes imported in my FLA).  I tried setting just about every property I could to no avail.  I manage to track down the problem to the event model.  The video progress event would say that the entire video was downloaded, but the video complete event woudn't fire.  The workaround I came up with was to check if the video was downloaded in the progress event then fire the play command.  Its seems to have fixed my problem for now.  Hopefully you won't have to waste a few hours of troubleshooting like me.

May 7th, 2009

  • Flash

Orphans and Widows

If I've only learned one thing from designers, its that they hate orphans/widows. As a flash developer I often have to work with external text and there is a good chance you'll end up with an orphan.

Archive of Previous Entries