[haXe] loadvars as array

Hertzel Armengol hertzel at osc.co.cr
Wed Jan 10 00:44:47 CET 2007


HI reading one of the past mail I noticed this syntax when using LoadVars

loadVars = new LoadVars();
loadVars["SomeProperty"] = "someValue";

but when I tried it on my machine I got this error


src/Test.hx:11: characters 13-27 : String should be Int
src/Test.hx:11: characters 4-12 : flash.LoadVars should be 
ArrayAccess<-Unknown<0>>

there's a way to use that syntax on my projects? because I need to 
assign variables on the fly to the loadVars object in this way..

var sendData:flash.LoadVars = new flash.LoadVars();

 for( f in flash.Lib.keys(flash.Lib._root) ) {
    var x : Dynamic = Reflect.field(flash.Lib._root,f);
     if (f.indexOf("sr_") != -1) {
     var y:Dynamic = f.substr(3);
      trace("Added: "+ y + " = " + x, "info");
     sendData[y] = x; //This must be added on the fly
     }


So I can access it later as

sendData.sr_test;

that must contain somevalue...

and my flash file is called like this

flash.swf?sr_test=somevalue;


tnks for your time..




More information about the Haxe mailing list