Page 1 of 1

Passing a string array from C# to Flash

Posted: Wed Jan 30, 2008 6:43 pm
by Roomie
Hey if anyone could help me out here I would appreciate it.
I want to pass a string array (or actually two string arrays) from my C# app to my Flash movie that's running in my f_in_box__control.

I would like to pass these variables when I load the flash file (which if it matters is loaded from an embedded resource).

As I said, any help appreciated.

Posted: Wed Jan 30, 2008 7:45 pm
by Softanics
Thank you for your question.

Something like that:

Code: Select all

_root.onload = function() {
   var xml1 = new XML();
   xml1.ignoreWhite = true;
   xml1.load('data.xml');
   xml1.onLoad = function(sucess) {
      if (sucess) {
         parseFile(xml1); <-- decode XML and fill your array
      }
}


Handle 'data.xml' loading in C# code, provide XML with strings.

Also this topic could be useful (XML -> Array):
http://www.actionscript.org/forums/show ... adid=26402

Posted: Thu Jan 31, 2008 3:39 pm
by Roomie
Thanks for your answer Artem, you're always helpful.

I managed to solve my problem, but in a somewhat different way.
I used an ExternalInterface.call where the return object contains a nested array in the form of xml data. Like this:

Code: Select all

<array>
  <property id='0'>
    <array>
      <property id='0'>
        <string>Filename</string>
      </property>
      <property id='1'>
        <string>Description</string>
      </property>
    </array>
  </property>
  <property id='1'>
    <array>
      <property id='0'>
        <string>Filename</string>
      </property>
      <property id='1'>
        <string>Description</string>
      </property>
    </array>
  </property>
  <property id='2'>
    <array>
      <property id='0'>
        <string>Filename</string>
      </property>
      <property id='1'>
        <string>Description</string>
      </property>
    </array>
  </property>
</array>


Hopefully this can be usefull for someone else.