Carefull with Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE
Use these events very carefully because the Flex Container class re-parents children. This is done during resizing. The Container class which is the super class of HBox/VBox etc tries to create scrollbars and in the process creates something called contentPane. Here is the method in the Container class that does the reparenting...
mx_internal function createContentPane():void {
....
....
....
for (var i:int = 0; i < n; i++)
{
// use super because contentPane now exists and messes up getChildAt();
var child:IUIComponent =
IUIComponent(super.getChildAt(_firstChildIndex));
newPane.addChild(DisplayObject(child));
child.parentChanged(newPane);
_numChildren--; // required
}
}
The above code results in firing the Event.REMOVED_FROM_STAGE and Event.ADDED_TO_STAGE. This can be dangerous if you are relying on these events to do something critical like destroying the view or its associated controllers etc. I have also seen implementations where a view listens to these methods and calls a dispose method to remove listeners, unwatch bindings and cleanup memory.
In short, these events become unreliable.
Labels: added to stage, removed from stage
1 Comments:
They are incessantly offered as much-appreciated bonus rewards or as a welcome bonus. It is sort of|is type of} frequent that players win free spins while enjoying in} on slot machines which can to} cause the machine to proceed to spin with out extra charges. Free spins are a highly desired reward in on-line casinos. Online 메리트카지노 slots are completely reliant on chance, but that doesn’t mean there aren’t things capable of to} do} to put your self in a greater position to win.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home