|
-
[RESOLVED] dynamically loaded MovieClip won't bubble Events
Hi there!
I ran into a really strange problem today.
I'm dynamically loading an swf with several MovieClips and an "exported for ActionScript" MovieClip holding several Sub-Movieclips.
Code:
mcl = new Loader();
mcl.contentLoaderInfo.addEventListener( Event.COMPLETE, caveloadcomplete);
...
function caveloadcomplete(event : Event) : void {
var mc:MovieClip = MovieClip( mcl.content );
MovieClip(mainstage["bgh"]).addChild(mc);
var appDomain:ApplicationDomain =
mcl.content.loaderInfo.applicationDomain;
var maclass:Class = Class( appDomain.getDefinition("movearea") );
cavemas = new maclass();
mainstage.moveareaholder.addChild( cavemas );
}
So far, so easy, works like a charm (please mind I only post the relevant codeparts for readability).
Now for the strange Part: if I try to do the following:
Code:
cavemas.addEventListener( MouseEvent.CLICK, moveclick );
exactly *nothing* happens. No click events. If I try it this way:
Code:
cavemas["n2"].addEventListener( MouseEvent.CLICK, moveclick );
It produces every single Click Event correctly (n2 is one of cavemas Sub-Movieclips). So it really looks like the MouseEvent doesn't bubble.
If I just copy the whole "cavemas" clip to the loading clip, it also works as intended, so I suppose it has got something to do with the dynamic loading and adding of the clip.
If I couldn't explain this clear enough, I found a guy having exactly the same problem, but in another Forum: http://www.actionscript.org/forums/s....php3?t=180594
Any help would be highly appreciated, thank you in advance for your time!
-
half as fun, double the price
Could be a security domain issue. Events aren't allowed to bubble through different security domains. Try enforcing the same security domain for the loaded content.
-
I don't import swfs a lot these days but I believe each swf has it's own "root" which would catch all bubbling...you might try a manual bubbler at the top-level of the loaded swf. (Someone please correct me if I'm remembering this wrong)
-
a.k.a gltovar
have you tried:
cavemas["n2"].parent.addEventListener( MouseEvent.CLICK, moveclick )?
-
senocular, I tried your pointer, and it was exactly that: I tried to do this in the Debugger (local file domain), but loaded the files from a (again local) webserver (network domain, even though its 127.0.0.1). When switching to loading via File system, it worked like a charm!
Thank you all for your help!
Last edited by craftyfirefox; 08-22-2008 at 03:21 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|