thanks for the tip but when i try to trace the array to see if it was created
it says "undefined"
_root.createTextField("txtPos", 1, 5, 40, 100, 20);
var myData:LoadVars = new LoadVars();
myData.onLoad = function(success:Boolean){
if(success) {
var myArray:Array = this.split("****");
trace(myArray);
} else {
txtPos.text = "Error loading data";
}
}
myData.load("http://localhost/readdir.php");
BorosAdam - 22 Mar 2007 10:05 GMT
yes, because you try to split the LoadVars object! watch, you write:
myData.onLoad.... and then: this.split... in this case the word 'this' refers
to myData but your string is INSIDE myData! for example if you write in php:
stringed=value1****value2****value3... and so on, then in flash:
myData.onLoad = function (ok){
if (ok){
trace(myData.stringed);
var myArray:Array = myData.stringed.split("****"); //or you can use:
this.stringed...
}
}
because the received variable ("stringed" in the example) is placed INSIDE the
LoadVars object!!! clear? :)
adam
leaguer44 - 22 Mar 2007 16:04 GMT
makes sense...thanks...and i got it working but i have another question
so the only way i can reference that array data is by putting the code that
needs to use that data inside that If statement that checks if it was loaded
successfully?...or is there away to make the array global?