swfmill导入swf在库中的参数

时间:2012-04-07 14:23:07

标签: parameters global flashvars swfmill

我使用这段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.

第二次更新

经过一些搜索后,我找到了一种方法来建立在swfmill输出swf中将变量传递给嵌入式SWF的正确方法。当然使用@little更新的方法非常错误。

现在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>

我的动作脚本(AS 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在第一帧包含了fallowing声明:

_global.aa = 'Hello world';
_global.bb = 'someimage.jpg';

不管怎样,即使这看起来很好,但似乎变量不能用作全局变量。

1 个答案:

答案 0 :(得分:0)

Haxe和SWFMill的组合完成了这项工作。