AS3.0 Replay the whole movie (*SWF file)

一世执手 提交于 2019-12-02 06:24:32

You can remove the swfObject and add it again. Look here. This is the swfObject reference.

Simply do this:

import flash.net.*;
//...
navigateToURL(new URLRequest(stage.loaderInfo.url), "_level0");

Reload the page, where you've embedded the swf into, may be the easiest way.

The programmers way would be to encapsulate your whole application into a single class (extending Sprite or MovieClip) which will be attached to the stage. For restarting the game you could simply remove that instance from the stage and add a newly created onto the stage.

Or make a loader swf, that loads your game. Then if the game should be restarted, discard (unload) the instance and load it again.

Its hard to tell you what you can do, if we don't know, how your project is structured.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!