-
1. Re: Loaded SWF runs code on parent timeline
kglad Nov 30, 2010 1:57 PM (in response to goddogsrunning)that's not default behavior. your child swf must be including that as file, too.
-
2. Re: Loaded SWF runs code on parent timeline
kglad Nov 30, 2010 2:02 PM (in response to kglad)actually, if your child swf included that file, you would get a loop of repeated loads. use trace(this) to see what you get and assign different document classes to your two swfs.
copy and paste the trace output.
-
3. Re: Loaded SWF runs code on parent timeline
goddogsrunning Nov 30, 2010 2:05 PM (in response to kglad)kglad:
That's just the problem - the child SWF does not include anything. Yet, it somehow runs that code anyway.
The only ActionScript in the child.swf is a single stop(); command in the first frame. If I remove that, then the child.swf doesn't run the parent code when it's pulled in. Doesn't make any sense...
-
4. Re: Loaded SWF runs code on parent timeline
kglad Nov 30, 2010 2:08 PM (in response to goddogsrunning)change the name of your fla and swf files to something other than Untitled-x and retest. if that fails:
use trace(this) to see what you get and assign different document classes to your two swfs.
copy and paste the trace output.
-
5. Re: Loaded SWF runs code on parent timeline
goddogsrunning Nov 30, 2010 2:16 PM (in response to kglad)Yes, it does load the code repeatedly.
The code is like:
loaderInfo.addEventListener(Event.COMPLETE, initMain,false,0,true); function initMain(e:Event):void { loaderInfo.removeEventListener(Event.COMPLETE, initMain); trace('initial load complete: '+ unescape(loaderInfo.url.replace(/^.+\/([^\/]+)$/, "$1"))); }And the resulting output, after the child.swf is loaded:
script.as is running initial load complete: parent.swf (loading clip: child) script.as is running initial load complete: child.swf
The stop() command in the child fails because of the errors that script.as is throwing by trying to access movie clips that don't exist on the child timeline, and so the child.swf plays in a continuous loop. Each time it plays, script.as is loaded and run again.
Question: how do you apply different document classes?
-
6. Re: Loaded SWF runs code on parent timeline
kglad Nov 30, 2010 3:04 PM (in response to goddogsrunning)comment-out all the code that leads to errors so you just execute the code shown in this forum. then copy and paste the output.


