A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Listen for events bubbling from loaded Swf

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    23

    Listen for events bubbling from loaded Swf

    The setup:
    A swf (my game framework) loads another swf (a game). The game is loaded into a child domain which seems to be the default domain for loaded swfs.

    The framework listens for custom events bubbling up from the game. However, the framework only receives events dispatched directly from the games document class but not from any of the games children.

    Bubbling is set to true on everything, but it's not working? Is it only possible to dispatch events from the document class of the loaded swf.

    swf(Framework -> listen) -> swf(game document root -> child) = no go!

    Any help is very welcome - thanks

  2. #2
    Junior Member
    Join Date
    May 2006
    Posts
    23
    Okay - might have found the answer - maybe?

    Since my custom events are being dispatched from an object (EventDispatcher) that is not a displayObject and as such not added to the displayList - the events do not bubble up to the containing swf (framework).

    Found this line:
    "Make sure you dispatch your event on a displayobject that is added to the game's stage, otherwise events won't bubble up."

    In my case the loaded swf has a simple object (inherits EventDispatcher) instanciated in the document class. I thought dispatching events from this object would bubble up to the document class of the loaded swf and then further up to the containing swf (framework)?

    This doesn't seem to be the case, however, the document class of the loaded swf can easily receive the event and then dispatch the same event up to the framework. This just seems a bit dirty/hackish as it need to receive and pass on events in the document class - would be smoother if the events could just bubble all the way by themselves.

    Any thoughts on this?

    thanks
    Last edited by Crealive; 09-13-2010 at 05:22 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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center