Passing a string array from C# to Flash

.NET Edition of the F-IN-BOX
Roomie
Posts: 22
Joined: Wed Dec 19, 2007 6:05 am

Passing a string array from C# to Flash

Postby Roomie » Wed Jan 30, 2008 6:43 pm

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.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Wed Jan 30, 2008 7:45 pm

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
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

Roomie
Posts: 22
Joined: Wed Dec 19, 2007 6:05 am

Postby Roomie » Thu Jan 31, 2008 3:39 pm

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.


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 9 guests