控制主 Swf 内的外部 Swf(场景、帧)

发布于 2024-10-11 10:20:16 字数 1249 浏览 3 评论 0原文

我要创建一个百科全书程序,包含许多章节。我在控制主 swf 内的外部 swf 方面遇到困难。这是我在 Actionscript 3

public class utama extends MovieClip {
 var loader:Loader;
 var urlReq:URLRequest;
 public function utama() {
 hal1.visible=true;
 hal2.visible=true;
 hal1.addEventListener(MouseEvent.CLICK, keHal1);
 home.addEventListener(MouseEvent.CLICK, backHome);
 sebelum.addEventListener(MouseEvent.CLICK, prevPage);
 sesudah.addEventListener(MouseEvent.CLICK, nextPage);
}

function prevPage(e:MouseEvent):void {
 //this is were I controlled the Prev page
 trace(parent.numChildren);   
}
function nextPage(e:MouseEvent):void {
 //this is were I controlled the Next page
}
function backHome(e:MouseEvent):void {
//If home button clicked then goes here
parent.removeChild(loader);
hal1.visible=true;
hal2.visible=true;
}
function keHal1(e:MouseEvent):void {
 //this is were I Load Page 1
 var url:String="./hal1.swf";
 urlReq=new URLRequest(url);
 loader=new Loader();
 loader.load(urlReq);

 parent.addChild(loader);

 hal1.visible=false;
 hal2.visible=false;
}
}

Am 中的 Main.as,使用 eksternal 页面作为章节,并且章节由许多页面组成(它使用场景) 例如:

第 1 章 -->第 1 页将表示为 hal1.swf-->Scene 1 第1章-->第2页它将被表示为hal1.swf-->场景2

现在,如何控制它,我还是不明白?

Am gonna create an encyclopedia program, consist many of Chapter. I have difficulties about controlling external swf inside my Main swf. This is my Main.as in Actionscript 3

public class utama extends MovieClip {
 var loader:Loader;
 var urlReq:URLRequest;
 public function utama() {
 hal1.visible=true;
 hal2.visible=true;
 hal1.addEventListener(MouseEvent.CLICK, keHal1);
 home.addEventListener(MouseEvent.CLICK, backHome);
 sebelum.addEventListener(MouseEvent.CLICK, prevPage);
 sesudah.addEventListener(MouseEvent.CLICK, nextPage);
}

function prevPage(e:MouseEvent):void {
 //this is were I controlled the Prev page
 trace(parent.numChildren);   
}
function nextPage(e:MouseEvent):void {
 //this is were I controlled the Next page
}
function backHome(e:MouseEvent):void {
//If home button clicked then goes here
parent.removeChild(loader);
hal1.visible=true;
hal2.visible=true;
}
function keHal1(e:MouseEvent):void {
 //this is were I Load Page 1
 var url:String="./hal1.swf";
 urlReq=new URLRequest(url);
 loader=new Loader();
 loader.load(urlReq);

 parent.addChild(loader);

 hal1.visible=false;
 hal2.visible=false;
}
}

Am using eksternal page as a Chapter, and A Chapter consist of many Pages (it using Scene)
For an example :

Chapter 1 --> Page 1 it will be represented as hal1.swf-->Scene 1
Chapter 1 --> Page 2 it will be represented as hal1.swf-->Scene 2

Now, How to control it, I still didn't get it ??

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

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

发布评论

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

评论(1

意中人 2024-10-18 10:20:16

加载后检查swf的类型。如果是MovieClip,您可以从中调用gotoAndStop(frameNumber)来设置当前帧。如果它是AVM1Movie,它就是AS2 swf,你无法控制它。

Check the type of swf after loading. If it is MovieClip, you can call gotoAndStop(frameNumber) from it to set current frame. If it is AVM1Movie, it is AS2 swf and you cannot control it.

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