简体   繁体   English

Flash AS3根文档链接

[英]Flash AS3 Root Document Linking

Hi I have a main document/fla, and ive created a game class, instantiated it in the document/fla file and it runs now i want to put a button inside that game class that can tell the root document/fla to jump to a certain frame. 嗨,我有一个主要的document / fla,并且ive创建了一个游戏类,在document / fla文件中实例化了它,现在它可以运行了,我想在该游戏类中放一个按钮,该按钮可以告诉根document / fla跳转到一定的帧。 How would i go about this? 我将如何处理?

Thanks 谢谢

Your game class could dispatch an event (GameEvent.SUPER_ACTION). 您的游戏类可以调度事件(GameEvent.SUPER_ACTION)。 Then in your fla : 然后在你的fla:

var targetFrame:int=10;
var game:Game = new Game();
game.addEventListener(GameEvent.SUPER_ACTION,gameSuperAction);

function gameSuperAction(e:GameEvent):void{
    gotoAndStop(targetFrame);
}

or if the game's button is public : 或游戏按钮为公开按钮:

var targetFrame:int=10;
var game:Game = new Game();
game.button.addEventListener(MouseEvent.CLICK,gameButtonClick);

function gameButtonClick(e:MouseEvent):void{
    gotoAndStop(targetFrame);
}

Here is an AS3 event flow example : http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e53.html 这是一个AS3事件流示例: http : //help.adobe.com/zh_CN/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e53.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM