[Flashcoders] Loading Flash 6 .swf files into a Flash 7 .swf
I have a Flash application which loads in external .swf files for drawing charts. My main .swf is compiled for the Flash 7 player, while the loaded .swf files are compiled for the Flash 6 player. The Flash 6 .swf is not able to access variables or functions which are defined in the _global context of the Flash 7 .swf file. But if I have two Flash 7 movies, or two Flash 6 movies, things work fine. Is there some known interaction I should know about? Specifically, shouldn't two .swf files compiled for different versions player still share the same _global scope? As an example, I've created flash6.fla and flash7.fla. They have the following action script: ---flash7.fla--- _global.callbackFunction = function() { trace(Got Callback); } loader_mc = _root.createEmptyMovieClip(loader_mc, 3); loader_mc.loadMovie(flash6.swf); ---flash6.fla--- trace(Loaded Flash6.swf); trace(_global.callbackFunction: + _global.callbackFunction); --- The trace function shows me that _global.callbackFunction is defined if flash6.fla is published for Flash 7 players. But if I republish, targeting the Flash 6 player, the function is longer defined. It is like they have totally separate _global scopes. If I switch from _global to _root, however, things work fine. So, I can work around the issue. But it strikes me as real odd that the two .swf files don't share the same _global variable space. Clues? - Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta. ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] Loading Flash 6 .swf files into a Flash 7 .swf
Flash Player creates two different _global objects for swfs of different versions. On 7/5/06, Todd Hivnor [EMAIL PROTECTED] wrote: I have a Flash application which loads in external .swf files for drawing charts. My main .swf is compiled for the Flash 7 player, while the loaded .swf files are compiled for the Flash 6 player. The Flash 6 .swf is not able to access variables or functions which are defined in the _global context of the Flash 7 .swf file. But if I have two Flash 7 movies, or two Flash 6 movies, things work fine. Is there some known interaction I should know about? Specifically, shouldn't two .swf files compiled for different versions player still share the same _global scope? As an example, I've created flash6.fla and flash7.fla. They have the following action script: ---flash7.fla--- _global.callbackFunction = function() { trace(Got Callback); } loader_mc = _root.createEmptyMovieClip(loader_mc, 3); loader_mc.loadMovie(flash6.swf); ---flash6.fla--- trace(Loaded Flash6.swf); trace(_global.callbackFunction: + _global.callbackFunction); --- The trace function shows me that _global.callbackFunction is defined if flash6.fla is published for Flash 7 players. But if I republish, targeting the Flash 6 player, the function is longer defined. It is like they have totally separate _global scopes. If I switch from _global to _root, however, things work fine. So, I can work around the issue. But it strikes me as real odd that the two .swf files don't share the same _global variable space. Clues? - Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Loading Flash 6 .swf files into a Flash 7 .swf
_global scope is different, as well as any prototypes you've created. However, it's not a security issue, simply a difference in how things were implemented. So, you can get around it by simply making a reference in the main SWF and re-referencing _global in the child SWF. For example (in the main SWF): _level0.global = _global; Then in the child SWF: _global = _level0.global; Now the child _global references the main _global. If you want a reference to the old child _global, you can specify (from within the child SWF): _level0._global; Even though _level0 really is the main SWF, _level0._global when referenced from the child SWF references the child SWFs original _global. Strange but true. Derek Vadneau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Todd Hivnor Sent: Wednesday, July 05, 2006 6:41 PM To: Flashcoders mailing list Subject: [Flashcoders] Loading Flash 6 .swf files into a Flash 7 .swf I have a Flash application which loads in external .swf files for drawing charts. My main .swf is compiled for the Flash 7 player, while the loaded swf files are compiled for the Flash 6 player. The Flash 6 .swf is not able to access variables or functions which are defined in the _global context of the Flash 7 .swf file. But if I have two Flash 7 movies, or two Flash 6 movies, things work fine. Is there some known interaction I should know about? Specifically, shouldn't two .swf files compiled for different versions player still share the same _global scope? As an example, I've created flash6.fla and flash7.fla. They have the following action script: ---flash7.fla--- _global.callbackFunction = function() { trace(Got Callback); } loader_mc = _root.createEmptyMovieClip(loader_mc, 3); loader_mc.loadMovie(flash6.swf); ---flash6.fla--- trace(Loaded Flash6.swf); trace(_global.callbackFunction: + _global.callbackFunction); --- The trace function shows me that _global.callbackFunction is defined if flash6.fla is published for Flash 7 players. But if I republish, targeting the Flash 6 player, the function is longer defined. It is like they have totally separate _global scopes. If I switch from _global to _root, however, things work fine. So, I can work around the issue. But it strikes me as real odd that the two .swf files don't share the same _global variable space. Clues? - Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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