[英]Modifying the domain memory of a loaded SWF to control behavior
I have several flash games that cannot be paused from within the games. 我有几个Flash游戏,不能在游戏中暂停。 I would like to write a wrapper swf that allows me to pause them.
我想编写一个包装SWF文件,允许我暂停它们。 It is not feasible to recompile the games, so no functionality can be added to them.
重新编译游戏是不可行的,因此无法向其中添加任何功能。
What I would probably need to do is control when the loaded swf gets ENTER_FRAME events and redirect calls to flash.utils.getTimer to a function defined in the wrapper. 我可能需要做的是控制何时加载的swf获得ENTER_FRAME事件,并将对flash.utils.getTimer的调用重定向到包装中定义的函数。 Can this be done by modifying the domainMemory ByteArray of the loaded ApplicationDomain object?
可以通过修改已加载的ApplicationDomain对象的domainMemory ByteArray来完成此操作吗?
domainMemory
is definitely doesn't help you, it's just the API to access to the fast memory. domainMemory
绝对不会帮助您, 它只是访问快速内存的API。
What you can try to do is to decompile the game swf and find the dispatcher of main EnterFrame event (and after loading game swf you have to find this dispatcher through the display list for example if it doesn't turned out to be the stage or root), that is used as the game tick dispatcher, than you will be able to intercept the default EnterFrame event for this dispatcher. 您可以尝试做的是反编译游戏swf并找到主要EnterFrame事件的调度程序(并且在加载游戏swf之后,您必须通过显示列表找到该调度程序,例如,如果它不是舞台或根)(用作游戏滴答调度程序),您将能够拦截此调度程序的默认EnterFrame事件。 For interception just add your own listener with the higher priority:
对于拦截,只需添加您自己的具有更高优先级的侦听器:
//pause the game
dispatcher.addEventListener(Event.ENTER_FRAME, onGameEnterFrame, false, 1);
//resume the game
dispatcher.removeEventListener(Event.ENTER_FRAME, onGameEnterFrame);
protected function onGameEnterFrame(event:Event):void
{
event.stopImmediatePropagation();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.