如何获取动态创建的影片剪辑的实例名称或名称?

发布于 2024-08-13 02:25:00 字数 388 浏览 3 评论 0原文

对于 AS 3

我有一个类,它创建一个带有关闭按钮的面板。我创建了这个类的一个实例 像这样

function _smallThumbClick(evt:MouseEvent):void {
   var _popup:Popup=new Popup( square.width ,evt.currentTarget.y, evt.currentTarget);
   addChild(_popup);
  }

和缩略图中的鼠标事件(假设),所以如果我单击缩略图,它将创建弹出窗口。所以我想关闭所有其他或以前打开的弹出窗口。

如何让弹出类对象从另一个类关闭..

或者是否有任何替代方法来检测影片剪辑或类的实例..

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..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

去了角落 2024-08-20 02:25:00

您可以将弹出窗口的引用存储在公共变量中并从外部访问它。

public var popup:Popup;
function _smallThumbClick(evt:MouseEvent):void
{
    popup = new Popup( square.width ,evt.currentTarget.y, evt.currentTarget);
    addChild(popup);
}

现在,您可以从此类调用 this.removeChild(popup); 或从另一个类调用 obj.removeChild(obj.popup);

如果您使用的是 Flex,则可以使用 PopUpManager班级。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文