2012-04-07 16 views
0

我有這樣的一段XML的,我爲了創造通過swfmill一個新的SWF文件中使用: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" />

謝謝!

小更新:

我試着給的參數是這樣

<clip id="test_swf" import="test.swf?theValue=Hello%20World"/> 

一個GET變量,但它沒有工作,並來到了copiling此錯誤:

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); 

我已獲得你在XML中看到的數據結構通過使用swfmill swf2xml test2.swf其中test2.swf在第一幀包含下面的聲明:

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

不知何故,即使這看起來不錯,看起來變量不能用作全局變量。

回答

0

Haxe和SWFMill的組合完成了這項工作。