你需要反编译swf然后修改一些代码,然后编译成新的。
我已经试了你的swf,当你点击位置时,它会重定向到百度网站。
这里是changed swf
您需要两个软件,JPEXS 和 RABCDAsm
1.反编译swf,找到相关代码
JPEXS 用于将 swf 反编译为 code 和 png、jpg。点击城市可以找到action的代码,我发现是Map Class,gotoLocation函数。当我尝试打开你的swf时,报错,我直接找到了类名和函数名。
2。使用RABCDAsm反汇编swf,得到abc码
RABCDAsm 是一个ActionScript 3 汇编器/反汇编器,它将swf 转换成asasm 和abc 类型的许多文件,然后您可以在编辑器中修改该文件,RABCDAsm 工具可以将这些文件变成一个新的swf。
那么这里有一个问题,你怎么能在生成的文件中想要目标Map文件呢?
尝试在文件中搜索Map.class.asasm,与反编译的类同名。
3.编写一个包含gotoLocation函数的新Map类,获取目标abc代码
您需要使用新的 abc 代码替换 Map.class.asasm 中的 abc 代码。
尝试做一个项目,然后添加一个名为 Map 的类,像这样在里面放一个 gotoLocation 函数。
package
{
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.events.MouseEvent;
public class Map
{
public function Map()
{
}
public function gotoLocation(param1:int) : void
{
if(param1 != 999)
{
navigateToURL(new URLRequest("http://www.baidu.com"),"_blank");
}
}
private function closeMap(param1:MouseEvent = null) : void
{
}
}
}
获取新项目的release swf,然后重复第二步,就可以得到这样的类的abc代码
trait method QName(PackageNamespace(""), "gotoLocation")
method
refid "Map/instance/gotoLocation"
param QName(PackageNamespace(""), "int")
returns QName(PackageNamespace(""), "void")
body
maxstack 3
localcount 2
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
getlocal1
pushshort 999
ifeq L11
findpropstrict QName(PackageNamespace("flash.net"), "navigateToURL")
findpropstrict QName(PackageNamespace("flash.net"), "URLRequest")
pushstring "http://www.baidu.com"
constructprop QName(PackageNamespace("flash.net"), "URLRequest"), 1
pushstring "_blank"
callpropvoid QName(PackageNamespace("flash.net"), "navigateToURL"), 2
L11:
returnvoid
end ; code
end ; body
end ; method
end ; trait
通过搜索函数名很容易找到abc代码。
4.替换 abc 代码,用 RABCDAsm 创建新的 swf
第二步用新的abc代码替换目标body部分,然后用RABCDAsm生成新的swf。
这样的旧abc代码
trait method QName(PackageNamespace(""), "gotoLocation")
method
refid "com.binweevils.externalUIs.map:Map/instance/gotoLocation"
param QName(PackageNamespace(""), "int")
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 2
initscopedepth 10
maxscopedepth 11
code
getlocal0
pushscope
getlocal1
pushshort 999
ifeq L21
getlocal0
getproperty QName(PrivateNamespace(null, "com.binweevils.externalUIs.map:Map/instance#0"), "bin")
getproperty Multiname("crntLocID", [PrivateNamespace(null, "com.binweevils.externalUIs.map:Map/instance#0"), PackageNamespace(""), PackageNamespace("com.binweevils.externalUIs.map"), Namespace("http://adobe.com/AS3/2006/builtin"), PrivateNamespace(null, "com.binweevils.externalUIs.map:Map/instance#1"), PackageInternalNs("com.binweevils.externalUIs.map"), ProtectedNamespace("com.binweevils.externalUIs.map:Map"), StaticProtectedNs("com.binweevils.externalUIs.map:Map"), StaticProtectedNs("flash.display:MovieClip"), StaticProtectedNs("flash.display:Sprite"), StaticProtectedNs("flash.display:DisplayObjectContainer"), StaticProtectedNs("flash.display:InteractiveObject"), StaticProtectedNs("flash.display:DisplayObject"), StaticProtectedNs("flash.events:EventDispatcher")])
getlocal1
ifeq L19
注意
你可以找到 RABCDAsm for windows here,你可以在它的 github 页面找到 RABCDAsm 命令。
最后,如果项目很简单,有时你不需要RABCDAsm。尝试将反编译的代码放入项目中,然后修复编译错误。这种情况下,你需要运气。