我使用这段XML来通过swfmill创建一个新的swf文件:
<?xml version="1.0" encoding="iso-8859-1" ?>
<movie width="300" height="250" framerate="24">
<background color="#ffffff"/>
<frame>
<library>
<clip id="test_swf" import="test.swf"/>
</library>
<place id="test_swf"/>
</frame>
</movie>我想向这个swf传递一些变量,比如文本和要加载到舞台上的图像,就像使用FlashVars:<param name=FlashVars value="oneText=Hello%20World&oneImage=image.jpg" />一样。
谢谢!
小更新:
我试图将参数作为GET变量,如下所示
<clip id="test_swf" import="test.swf?theValue=Hello%20World"/>但是它不起作用,并且在复制时出现了这个错误:
WARNING: Cannot import test.swf?oneValue=Hello%20World (unknown extension), skipping.第二次更新
经过一些搜索之后,我找到了一种方法来建立将变量传递给swf输出中的嵌入式SWF的正确方法。当然,使用的方法“小更新”是非常错误的。
现在,xml代码如下所示:
<?xml version="1.0" encoding="iso-8859-1" ?>
<movie version="8" width="600" height="400" framerate="24">
<background color="#000000"/>
<frame>
<library>
<clip id="main" import="test.swf"/>
</library>
<DoAction>
<actions>
<Dictionary>
<strings>
<String value="_global"/>
<String value="aa"/>
<String value="Hello world"/>
<String value="bb"/>
<String value="image.jpg"/>
</strings>
</Dictionary>
<PushData>
<items>
<StackDictionaryLookup index="0"/>
</items>
</PushData>
<GetVariable/>
<PushData>
<items>
<StackDictionaryLookup index="1"/>
<StackDictionaryLookup index="2"/>
</items>
</PushData>
<SetMember/>
<PushData>
<items>
<StackDictionaryLookup index="0"/>
</items>
</PushData>
<GetVariable/>
<PushData>
<items>
<StackDictionaryLookup index="3"/>
<StackDictionaryLookup index="4"/>
</items>
</PushData>
<SetMember/>
<EndAction/>
</actions>
</DoAction>
<place id="main" />
</frame>
</movie>我的操作脚本(作为2.0)如下所示:
_root.text_input.text = _global.aa;
loadMovie( _global.bb ,dropzone,'GET');
trace (_global.aa+' '+_global.bb);我通过使用swfmill swf2xml test2.swf获得了您在xml中看到的数据结构,其中test2.swf包含第一个框架上的融合声明:
_global.aa = 'Hello world';
_global.bb = 'someimage.jpg';无论如何,即使这看起来不错,似乎也不能将这些变量用作全局变量。
发布于 2012-04-09 08:15:21
Haxe和SWFMill的组合完成了这项工作。
https://stackoverflow.com/questions/10055253
复制相似问题