Jump to content
Search Community

none

Members
  • Posts

    3
  • Joined

  • Last visited

none's Achievements

0

Reputation

  1. Hi Greensock, thanks for your response. But isn't the complete event fired in the "parent" swf? I mean some kind of event that is fired in the child, as the "unload" event that is called when unloading the swf.
  2. Hi mate, sorry for the long delay, never saw your answer! So I put the unload hook in and ADDED_TO_STAGE listener then and works great! But I have some related question to this, does the SwfLoader provide some kind of load event, like the unload one? I see everywhere that if I put an ADDED_TO_STAGE listener, is recommended to remove it the first time is call, to avoid weak references. But if I need to load and unload the same child swf multiple times, and do some kind of re-initialization and cleanup, is not clear to me how to do that, for example starting and stoping and animation in each cycle. I have the "unload" hook for doing the cleanup, but not sure how to do re-the initialization if the ADDED_TO_STAGE listener is removed. An example will be something like this 1-Child SWF Load 2-ADDED_TO_STAGE call, where an animation is created, the unload hook set, and this ADDED_TO_STAGE listener removed. 3-Child SWF is unload, the unload hook gets called and stop the animation. 4-Child swf load again, but no ADDED_TO_STAGE listener to start the animation again! Is there any "load" hook, like the "unload" one? Hope the question is understood, thanks in advance!
  3. Hi greensock team. I must say that your library looks great! Right now I'm testing SWFLoader and I have one doubt. I read that for better GC, is recommended to implement a method like this in the child swf. var curParent:DisplayObjectContainer = this.parent; while (curParent) { if (curParent.hasOwnProperty("loader") && curParent.hasOwnProperty("rawContent")) { //ContentDisplay objects have "loader" and "rawContent" properties. The "loader" points to the SWFLoader. Technically it would be cleaner to say if (curParent is ContentDisplay) but that would force ContentDisplay and some core LoaderMax classes to get compiled into the child swf unnecessarily, so doing it this way keeps file size down. Object(curParent).loader.addEventListener("unload", dispose, false, 0, true); } curParent = curParent.parent; } ... function dispose(event:Event):void { //do cleanup stuff here like removing event listeners, stopping sounds, closing NetStreams, etc... } Sorry for the stupid question, but where exactly do I need to put the first part of that code (the curParent part)? I suppose I can't do it in the constructor cause the parent will not be set. Do I have to listen for the ADDED_TO_STAGE event and put it there? Or maybe listen to the Event.INIT of the loaderInfo? Thanks!
×
×
  • Create New...