Reputation: 27855
For AS 3
I have a class which crate a panel with close button. and i create an instance of this class like this
function _smallThumbClick(evt:MouseEvent):void {
var _popup:Popup=new Popup( square.width ,evt.currentTarget.y, evt.currentTarget);
addChild(_popup);
}
and this mouse event from the thumbnail(suppose), so if i click on the thumb it will create popup. so i want to close all other or previously opened pop window.
How do u get the popup class object to close from another class..
or is there any alternate method for detect instance of the movieclip or class..
Upvotes: 0
Views: 395
Reputation: 59451
You can store a reference to the popup in a public variable and access it from outside.
public var popup:Popup;
function _smallThumbClick(evt:MouseEvent):void
{
popup = new Popup( square.width ,evt.currentTarget.y, evt.currentTarget);
addChild(popup);
}
Now you can call this.removeChild(popup);
from this class or obj.removeChild(obj.popup);
from another class.
If you are on flex, you can use PopUpManager class.
Upvotes: 2