PDA

View Full Version : What variables can i send to as3 and back to as2 via localConnection ?


Tenshi_rdk
10-10-2006, 11:42 AM
I tried a textfield ..does not work..and also array dont work..i DESPERATELY need an array..

What can i do ?

Tink
10-10-2006, 11:49 AM
convert the Array to a String and convert it back to an Array the other end?

Tenshi_rdk
10-10-2006, 11:59 AM
holy moly..how ? and won't it take ALOT of processing power ?

Tink
10-10-2006, 12:04 PM
var myArray:Array = [ 1, 2, 3, 4, 5, 6 ];
var myString:String = myArray.toString();

var myArray2:Array = myString.split( "," );

Tenshi_rdk
10-10-2006, 12:09 PM
amazing ! i've never seen this.
Thanks a BILLION !!

Tink
10-10-2006, 12:11 PM
if you want to use your own deliminator you can use

var myArray:Array = [ 1, 2, 3, 4, 5, 6 ];
var myString:String = myArray.join( ".tink." );

var myArray2:Array = myString.split( ".tink." );

just in case you have the coma character in items stored in your Array.

Tenshi_rdk
10-11-2006, 10:18 AM
i have a problem now..if i send the text of my textfield to the as3 with a NEWLINE in there , it does get through but it also gives an error which makes other parts not work correctly like getCharBoundaries....what can i do ?