多页面的Flash应用程序 [英] Multi-pages Flash application
问题描述
我很新的Flash和我需要帮助来开始构建多页面的Flash应用程序。
我设法通过调用这个函数来打开另一个SWF文件主SWF中(称为第1页)
私有函数LoadExternalSwf():无效
{
VAR装载机:装载机=新的Loader();
VAR urlReq:的URLRequest =新的URLRequest(page1.swf);
loader.load(urlReq);
的addChild(装载机);
}
-
你如何添加一种后退按钮,第1页,这样它会自行关闭(这样我们又回到了主屏幕)?
-
如果第一页是一部电影,是它可以自动关闭播放完之后?
(我使用Flash CS3,Flex Builder中3,AS3)
感谢您
解决方法:
这是第1页:
//分派pageFinish事件装载机/父母/容器如果有的话
如果(loaderInfo.loader)
loaderInfo.loader.dispatchEvent(新的事件(pageFinish,真));
从主SWF:
//监听的pageFinish事件
loader.addEventListener(EVENT_PAGEFINISH,OnPageFinish);
...
私有函数OnPageFinish(事件:事件):无效
{
...
}
I am very new to Flash and I need help to get started with building multi-pages Flash application.
I managed to open another swf file (called Page1) from within the main swf by calling this function
private function LoadExternalSwf(): void
{
var loader:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("page1.swf");
loader.load(urlReq);
addChild(loader);
}
How do you add a sort of "Back" button to Page1 so that it will close itself (so that we are back to the main screen)?
If Page1 were a movie, is it possible to automatically close it after it finishes playing?
(I am using Flash CS3, Flex Builder 3, AS3)
Thank you
Solution:
From page1:
// Dispatch a "pageFinish" event to the loader/parent/container if any
if (loaderInfo.loader)
loaderInfo.loader.dispatchEvent(new Event("pageFinish", true));
From the main swf:
// Listen for the "pageFinish" event
loader.addEventListener(EVENT_PAGEFINISH, OnPageFinish);
...
private function OnPageFinish(event: Event): void
{
...
}
这篇关于多页面的Flash应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!