swfmill import swf in library with parameters

369 views Asked by At

I have this piece of XML that I use in order to create a new swf file via swfmill:

<?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>

I would like to pass to this swf some variables like a text and a image to load on the stage like one could do using FlashVars: <param name=FlashVars value="oneText=Hello%20World&oneImage=image.jpg" />

Thank you!

Little update:

I tried to give the parameters as a GET variable like this

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

but it did not work and got this error on copiling:

WARNING: Cannot import test.swf?oneValue=Hello%20World (unknown extension), skipping.

2nd update

After some search I found a way to establish the correct way to pass variables to a embedded SWF in swfmill output swf. Of course the method used @little update was terribly wrong.

Now the xml code looks like this:

<?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>

and my action script (AS 2.0) looks like this:

_root.text_input.text = _global.aa;
loadMovie( _global.bb ,dropzone,'GET');
trace (_global.aa+' '+_global.bb);

I have obtained the data structure that you see in the xml by using swfmill swf2xml test2.swf where test2.swf contains the fallowing declaration on the very first frame:

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

Somehow even if this looks good it appears that the variables cannot be used as global variables.

1

There are 1 answers

0
Mike On BEST ANSWER

A combination of Haxe and SWFMill did the job.