简体   繁体   English

修改已加载的SWF的域内存以控制行为

[英]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.

相关问题 如何控制动态加载的SWF - How to control a dynamically loaded SWF AS3:编写跨域加载的SWF脚本 - AS3: scripting a cross domain loaded swf as3从网络外部加载swf以控制来自网络的外部加载的swf - as3 externally loaded swf from network to control externally loaded swf from network 使用来自另一个域的远程加载的类SWF - Working with remotely loaded class SWF from another domain 将AS2 SWF加载到AS3 SWF中时会发生奇怪的行为,有人对此有何解释? - Strange Behavior of AS2 swf breaking when loaded into AS3 swf can any one explain as to why this is? 主SWF和来自另一个域的运行时加载的SWF之间的类不匹配 - Classes don't match between main SWF and runtime loaded SWF from another domain AS3从外部加载SWF来控制舞台,MovieClips及其子级? - AS3 externally loaded swf to control stage and MovieClips and their children? as3-在“资产”瑞士法郎中重用已加载的图像,而无法控制“主要”瑞士法郎 - as3 - reusing a loaded image in an 'asset' swf with no control over the loading 'main' swf 在SWF中加载的字体在SWF中加载的SWF中! 文字消失 - font in swf loaded in a swf loaded in swf !!! the text disappear addEventListener加载程序? 或加载瑞士法郎? - addEventListener to loader? or loaded swf?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM