Quicksearch |
Tuesday, March 25. 2008Runtime Sharing problems solved for good!
I stayed at work until 8:00 pm today because I could not figure out why I was getting a #1065 Reference Error when using Runtime Sharing.
The scenario A main ActionScript application loads multiple swf files (screens). These swf import various symbols from a central swf (global_asset_library). When I load the first screen, I can see in ServiceCapture that the global_assets_library is requested, because the screen imports assets from it. When I load a second screen that should import assets from the same library, it does not request it, probably because it’s cached. It however displays a #1065 error and leaves a blank where I should have seen my beautiful scenery. So I could not load any subsequent screens because they use Runtime Sharing. What happened internally? From good old-fashioned trial-and-error and some incomplete documentation, I figured out that each swf, by default, loads the global_asset_library in its own context (security domain). That means that any other screen is now prohibited from accessing whatever was loaded by the first screen. Our global_asset_library (and I stress Global) now became the sole property of the first screen. Not what we want. What do we do now? We use a nice little class called LoaderContext from the flash.system package (AS projects don’t need to be converted to Flex - yay!). This LoaderContext will allow us to load all swf into the application, instead of the swf that requests it. Show us the code! var request:URLRequest = new URLRequest(swfPath);
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Hi anna, I have a similar problem using the shared pictures on a products gallery, at first you just see a blank space instead of the pic, you need to go other seccion and then come back in order to see the imported image. (www.ibgempaques.com section "productos). Q. Can i use that code on as 2.0? Q.Where shall i put it, i.e.at the first fr.?. Thanks in advance!
This can only be used in ActionScript 3. The code goes into the function that you are using to load your swf.
From what I see on your site, I cannot tell why the image is blank at first. What I can tell you is that it is probably unrelated to runtime sharing, as runtime sharing problems will not show your image the second time you visit the page. I suspect that it has to do with the asynchronous loading operation and that your listener is improperly defined. I'll know more if you post some code and whatever errors the debugger is throwing. |
CategoriesSyndicate This BlogBlog Administration |
Powered by s9y - Design by Anna Filina