Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




String To Array



Heya, i need to create a new array based on a String .

Is this possible ?


ActionScript Code:
var cArray:String = "Array" + colourN;

...and somehow i need to turn cArray into an Array .



ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 10-21-2008, 05:32 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

String Into Array 2
ok i explain
i have an Array like
Arraysection = new Array("section0", "section1", "section2", "section3", "section4", "section5", "section6");

and i have a varible section this variable change by director cause my flash was in director and director only send string an not number to flash

section="section0"

i have to compare this variable to receive the number 0

i need this to know in wich section my director was

scuse my english

String To Array ?
Hi!



this is my string i want to convert it into array just like this ASP Function do...


myArray = Split(myString, ",", 1, -1)


where string is myString = "a,b,c,d"

after that myArray will be like this


myArray[0] = "a"
myArray[1] = "b"
myArray[2] = "c"
myArray[3] = "d"


i want to do this in Flash MX

please help me regarding this.... i would be thankful

thanks
Irfan.

String To ARRAY ?
(MX)

hi all,

i need to transform a String into an Array.

so far i tried :
KEYS = new Array ();
KEYS.push("P,43,A0,143,P,30,A0,126,P,28,A0,175")

but when i do
trace(KEYS.length)

i get back "1".
but it should be "12" or not ?

confused...

thanks

String To Array ?
Hi.

I have some strings which look like this:

Code:
foo = "(4,5,6,7,3,2,3,4,5,6)"
is there any way to convert them into an array like:

Code:
fooArray=new Array( 4, 5, 6,7,...)
thanks, m

String To Array
Hello!

i have a string that i recive from External file that looks like this: "1,2,3,4,5,6,7" i want to make an array out of this, i know that arrays created like this:
Array("1","2","3","4","5");
but if i try:
my_arr=Array(my_str); flash inserts whole string in first position in array.
so how can i get my string turned into Array?

Array In A String
Hi every one, I have a big problem.

When I use a text file to store things and a "loadVariablesNum" to load it, it works.
Usely I transform it in a Array with a simple .split();
But here, the txt file is too long, and, when I use .split(), it takes a lot of time.

I'm trying to store a string that looks like a array : TestTot = "{tNom:Test, tScore:123}, {tNom:Test02, tScore:221}";
So I don't have to split anything.
But I can not manage to load it as an Array, or to transform it as a array.

Is there a way to do that ?

Thank you in advance.

Re. Array In A String
Hi. I have problems with .
I have :
--- TesTot = "123, 45, 78, 90, 12";
But I want it to become an Array, without using .split() for technical reasons.
So I try :
--- TestB = new Array(TesTot);
or
--- TestB = Object(TesTot);
but both fail.
--- trace(TestB[0]);
// return undefined

Anyone can help me on it ?
Please...

(I hope i do not upset this forum in posting two threads on a similar subject).

Thank you in advance.

String Into An Array
hey folks I've got a string

it goes soemthing like this

option1*option2*option3*option4*option5*option6*

now I need this into an array.


if I use this: (bringing it from xml)

MyArray = myXML.bullets2.childNodes.split("*");
trace(MyArray)

it brings up fack all. Even if I put it into a text field then try to split it it does fack all.

String To An Array Name? Or... What?
so, I have some dynamic text in a MC that has the name of an Array written in it (by hand)

lets say thats a dynamic text box who's 'var:' is "fff" and has "arrayname" written in it

in another MC (in the actionscript) I have:

Code:
arrayname = Array();
arrayname.push(new GlowFilter(0x00FFFF, 1, 10, 10, 3, 1, false, false));
(on load)

and

Code:
bla = _parent.othermovieclip.fff
this.filters = bla
...it doesn't work...

when I trace "_parent.othermovieclip.fff" from there I get "arrayname"

my guess is that it's a string, and that "this.filters = " isn't taking it because of that

so, I tried:

Code:
this.filters = _parent.othermovieclip.fff
and that didn't work either.

to test it I tried:

Code:
bla = arrayname
and it WORKED, but not in the way that's usefull

I traced "bla" and it gave me "[object Object]"

so, now I'm confused as hell

any tips?

String To Array?
Hey! I am making a tile game map editor, and i want to save a map. I would like my editor to be able to load a "copy and paste" code, but i dont know how. Here is an example of the code generated by my editor. Each number is a tile type.


Quote:




level_array = [[1,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,2,1], [3,1,2,1,1,1,1,2,2,1], [6,6,6,6,6,6,6,6,6,6] ];






In the load window, there is a text box input where you can paste this code. My problem is that I don't know how to transform the pasted text in an array.

Any hint?

Free donut for anyone who helps me!

String -> Array
My problem is a bit to complex to exlpain in full, but hopefully there's a simple soultion so I need not post it all.

Basically I have an array in a string, say for example:


ActionScript Code:
myArray = "[1,2,3,4,5]"

Trouble is, it's no good in a string, I can't read from it.

So I need a way of effectively removing the ""s so it's just a normal array.

String To Array
Hi

i have populated an array with a string. How do i make the array become a true array,i'm looking for the opposite of array.toString


my array list1=[] which I populate with mystring:

mystring=("f","d","b","m")

for (g=0; g<my_string.length; g++) {
list1.push(my_string.charAt(g))
}

my list will control some MCs on stage called f d b and m


cheers

w_lingo

String / Array
how can i list the _width values (in an array) of the following text fields in a separate text field called texter?

ActionScript Code:
for (var i:Number = 0; i <= 5; i++)
{
    var mNav:MovieClip = tClip.duplicateMovieClip("tClip" + i, tClip._parent.getNextHighestDepth() + i);
       tClip0.Text.text = "COMERCIAL SETS"; tClip1.Text.text = "CUSTOM FURNITURE"; tClip2.Text.text = "RETAIL DISPLAY"; tClip3.Text.text = "EVENTS"; tClip4.Text.text = "ART"; tClip5.Text.text = "VIEW ALL";

texter.text = mNav.( the array here) ._width;
}

so my results look something like: 22, 127, 23.6 ...

String To Array
hi,

i am having a string which i want to show in array. How can i do that ?

//string
str1 = "Hello";

//Result expected :-

result_str1 ="H","e","l","o"'

MyArray = new Array(result_str1);

trace(MyArray[0]) // H will be shown

Array In A String
Hi every one, I have a big problem.

When I use a text file to store things and a "loadVariablesNum" to load it, it works.
Usely I transform it in a Array with a simple .split();
But here, the txt file is too long, and, when I use .split(), it takes a lot of time.

I'm trying to store a string that looks like a array : TestTot = "{tNom:Test, tScore:123}, {tNom:Test02, tScore:221}";
So I don't have to split anything.
But I can not manage to load it as an Array, or to transform it as a array.

Is there a way to do that ?

Thank you in advance.

[FMX] String To Array
Hello,

(Using Flash MX)

I'm wondering if theres a way I can turn a variable of strings (separated by commas) into an array?

I'm using the loadVars object to import variables from a text file that I'd like to import to flash as an array.

For example if the variable I import from the text file looks like this:

&myVar=charlie,dog,cat,test&

I'd like to get it into an array in Flash like this

myArray = new Array["charlie","dog","cat","test"];

Is there any way to do that?

Thanks!

String To Array Help
I have a string with an array. I used my_array.split(), but the problem is that it doesnt work with bi-dimensional arrays. Suggestions?

String To Array? Plz Help :S
Hey! I am making a tile game map editor, and i want to save a map. I would like my editor to be able to load a "copy and paste" code, but i dont know how. Here is an example of the code generated by my editor. Each number is a tile type.


Quote:




level_array = [[1,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,2,1], [3,1,2,1,1,1,1,2,2,1], [6,6,6,6,6,6,6,6,6,6] ];




In the load window, there is a text box input where you can paste this code. My problem is that I don't know how to transform the pasted text in an array.

Any hint?

Free egg for anyone who helps me!

Array To String?
Is it possible to turn an array into a string? I'm stuck on project.


For example:

contents is an array containing: ("~a","~b","~c")



var my_str:String = var contents:Array;
contents = my_str.split("~");
trace(contents);

I'm trying to delete the ~ that's been inserted, (in another part of my code earlier)

The result should be:
(a,b,c)

how can I do this?

String Array Help
I know


Quote:




insideInput = String(xmlNode.childNodes[0].attributes.insider)
virusTarget = insideInput.indexOf("kz", [17]);
endTarget = insideInput.indexOf(".", [virusTarget+2]);
trace("VTTT"+virusTarget)
trace("ET"+ endTarget)

//endTarget = local.indexOf(".", ["vitesting"]);
clipTarget = virusTarget+3;
zebra = insideInput.substring(clipTarget, endTarget);
trace(zebra)




I'm trying extract info from a string, increment through it and add the data to an array

thing is I can't get the startIndex thing to work

any ideas thanks

[FMX] String To Array
Hello,

(Using Flash MX)

I'm wondering if theres a way I can turn a variable of strings (separated by commas) into an array?

I'm using the loadVars object to import variables from a text file that I'd like to import to flash as an array.

For example if the variable I import from the text file looks like this:

&myVar=charlie,dog,cat,test&

I'd like to get it into an array in Flash like this

myArray = new Array["charlie","dog","cat","test"];

Is there any way to do that?

Thanks!

Array To String, I Think.
Hi,


I have this AS script to put text in an textArea:


ActionScript Code:
myArray = new Array();
myArray.push("I'm ");
myArray.push("a ");
myArray.push("girl");
myTextArea.text = myArray


And the output in the textArea looks like:

" I'm ,a ,girl"

Does anyone knows how to get rid of the " , ".

String To Array
Hello...

I have a problem... let me explain...
I have an array... for example ["aa", "bb", "cc", "dd"]
Now i want to make as many arryas as there are string in my array... in this example 4. But of course i can not say how many there will be the next time. And the names of those 4 arryas should be the string from my first array. So the result would be 4 arrays: aa, bb, cc, dd

I would be like doing this :

var aa:Array = new Array();

4 times but each time for a different string which i would get from my main array.

If anyone can help i would appreciate it... and if i didn't explain good enough let me know...

thanks

Convert String To Array
Hi!!!!

i have a big trouble, I read a variable from mysql database, just like this:

posH=123,432,34,345....

But whe I read the variable in flash it comes in form of string and not like array.

I try with the funtion eval(); but dont work fine =[

Jus I like convert this:

x = "1,2,3"
// to
x = [1,2,3]

thx .... =]

Compare String Into Array
how can a compare a string to the same string in my Array to know is position


Thx
Eric

Splitting String Into An Array
Hi,

this should be incredibly easy: splitting a string into an array, where each character becomes an array element.

According to Flash help files it should work like this:


Code:
myString = "hello";
myArray = myString.split("");


ie. using an empty string as delimiter in the split function.

In practice however, this simply creates an array with a single element containing the complete string - ie. the same as when doing 'myString.split()'. Am I specifying the empty string incorrectly???

(I know how to do this 'by hand' - but want to know why the split method isn't working).

Any thoughts welcome,

thx - n.

Converting A String Into A Array? Please Help
Hello,

I have the following Variable named strArray

strArray=Unknown,Pre-Underwriting,Processing,Final Underwriting,Closing,Team Leaders,Account Executive,Account Manager,Post Closer,Account Manager 1,Account Manager 2,Account Manager 3

>>I am then tring to delcare that array in flash with:

autoEntries = new Array ();
autoEntries = [eval(strArray)]
// I have also tryed: autoEntries = strArray


Please tell me what I need to do???
Thanks

Find String Value In Array?
Hey, everyone. A quick question regarding arrays and strings. (Flash 5)

I have an array that holds three values: my_array("one","two","thr") which correspond to movie clips on my stage with the same instance names. Then I have buttons that sets a variable "selected" equal to _root.one, _root.two or _root.thr. Now I have a function that takes "selected" and manipulates it. This all works fine so far.

My problem occurs because after "selected" performs its actions, I want to remove the corresponding value from the array. So first I have converted the movieclip object "selected" into a string using remove1 = String(selected), then I slice out the _root. using remove2 = remove1.slice(7,-1) so now remove2 is equal to a string "one" "two" or "thr".

How do I remove this string value from the array? Is there a way to search the array values for this string and return its index? Any help is appreciated.

Thanks!
japangreg

String From Server To Array
Hey guys... I have a perl script that is sending back a bunch of data to my flash movie... I want to store each piece of data into an array in flash.. right know all I know about is sending the data back as individual variables... is there a way to put that individual variables into an array?

Possible solutions that I have come up with are reading in 1 var as a whole string and then splitting up the string according to a delimiter, or dynamically naming new vars in the perl script and use the same name generation in the flash file and just transfer each variable over to a slot in an array... both of these methods seem to be a bit sloppy... anyone have any other ideas?

thanks so very much for your help!

-Jake

Evaluating String/array Help
I know I am doing this wrong...please help. In the following, the variable, _root.currentSection equals "mc_home" on the root. The value changes throughout the navigation.

I need to get the value from the following:
_root.mc_homebox_Xpositions[i]

The dynamic version would be something like this:
"_root."+_root.currentSection+"box_Xpositions" +"["+[i]+"]"

But what I get is the string and not the value:
_root.mc_homebox_Xpositions[1]

I tried this but it comes up undefined:
this["_root."+_root.currentSection+"box_Xpositions" +"["+[i]+"]"]

What am I doing wrong?

Thanks

Please Help String To Array Problem
I use on my site a feature that records what links the user has already visited ... this information is stored in an array ... I then convert the array into a string and send this as a cookie + using php sessions to save that data ...
that is all working - the problem is now by converting the string back to an array ... I use:
>> if (info_was_saved == 1) {
>> visited = new array (_root.myINFO)
>> } else {
>> visited = new array()
>> }
I realised that when I hardcode the same info as var (e.g. myINFO=",,1,,3,,6") into flash it works but when i for eg want to do the same from a text file (or what i want to do, from cookies) it wont work ....
can anyone please help me with that --- its the final touch to my website which i was working on for the past 6 months .. and ... arrgghhh ... i want to finally finish it --- PLEASSSEEEEE HELP!

Getting A Specific String From An Array
Hi all:

I'm jumping into Flash from the Director side and am trying to create a program that will get a random line of text and concatenate it with another random line of text.

In Lingo I would first get a random value and then get then correspond that value with the line of a text cast member. Easily done. In Actionscript, i'm a bit more lost. I suspect it would be pulled from an array but I'm not sure how it would be set up.

Anybody who can give me a good shove in the right direction?

Thanks.
Rob

Eval String As Array, Possible?
Hey Ho, stuck again
I Have found plenty on eval but can't see one like this, can anybopdy help me out or point me in the right direction

Is it possible to eval a string into the value of an array like this?

fC = new Array();
fC[0]= new Array();
fC[0][0] = "test string 0"
fC[0][1] = "test string 1"

myString = new String("fC[0][1]");
var evalTest = eval(myString);
trace("evalTest ="+evalTest);

I am having no joy, can anybody see why it isn't working? or is it just not possible this way?

Thanks,

Paul

Split String Into An Array
I want to split a string into an array, for example :

aString="a b c d";

The result should be an array :

a[1] = "a"
a[2] = "b"
a[3] = "c"
a[4] = "d"

Anyone know how to do this using actionscript ?

How Do I Convert A String To An Array?
myArray = "[ [1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,1,0,0,0,0,1],
[1,0,0,0,0,1,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1] ];

Convert String To Array
is there some way to convert a string to an array?

let's say I have a variable which contains a string:

mystring = "[20,546,60]"

and I want actionscript to pass this data to an array, and the result would be for example this.

mylist = [20,546,60]

like:

mylist[1] = 20
mylist[2] = 546
mylist[3] = 60



thanks

Converting String To Array Value
hey freinds...

heres a quick question.
say the user has an input box where he can type in a value. (ie: the user types -> ["one", "two", "three"] <- in the box.
can I get flash to read that as an array?

heres a quick script I did to demonstrate what I mean...

code:
importedNames = "["bob", "george", "paul"]";
trace(importedNames);
//returns:
//["bob", "george", "paul"]
thearray = new Array();
thearray = importedNames;
trace(thearray);
//returns:
//["bob", "george", "paul"]
trace(thearray[2]);
//returns:
//undefined
//desired return:
//paul


thanks all

Turn String Into Array
Hi all,
If i have the following:

Code:
sloj = "new Array(new Array(26,311,9062912,100,100,100,0,'spray',33), new Array(28,311,9062912,100,100,100,0,'spray',34));";
how can i change this so the sloj variable isn't a string but an actual multi demensional array? At the moment it is just a string.
Cheers,
macca

Array Coming In As A String - Eek
Hello,

I'm loading in an array from an external txt file (I'm bringing it in via LoadVars())

&spectrumLeft=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]...]

but it appears to be coming in as a string! eg: (the output window displays this)
spectrumLeft:"[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]...]"

how do I convert this to an array when it's read in!!?? Or should I be loading this in a different way?

Thanks,

ss

Array?string? Hmmm
hey guys...i have 5 instances of the same mc (mcBall). i have named them mc0,mc1..and so on to mc4.

now i would like to script onRollOver() and onRollOut() functions that will work the same way for all 5 instances (regardless of their unique names). is this an array i need to declare
ex: var aMcBalls= ["mc0","mc1"...];
or am i trying to make a string? And how will Flash know what i am refering to? ANy ideas?

Array Comparison To String?
Hi

Im just working on an application and can any one tell me why this doesnt work and any possible ways round it?

trace(aArray[0].toString());
trace(["tField" + unique]);
if (aArray[0].toString() == ["tField" + unique]){
trace("ok");
}


right ok is never reported as a trace yet the first trace and the second report the exact same thing. so why is it that flash does not see them as the same if they are the same in trace?

trace(aArray[0].toString()); //traces tFieldOne
trace(["tField" + unique]); // trace tFieldOne

A little help?

Evaluate As Array Instead Of String
ok guys i am creating a applet that allows people to check their mail within my server, that is mail in my mysql databases, so what i do is perform a mysql query everything works fine the inbox info is transfered but one simple thing goes wrong, when i set the varaible after my load vars is done i go

my_lv.onLoad = function(success) {
if(success) {
messages=this.messages;
}
}

now my php script sends back a string to flash that looks like this

'{{from:"joe",subject:"Hello",date:"10/12/94"},{from:"josh",subject:"grr",date:"10/88/94"}}'

but that is evaluated as a string and i want it to turn into a multi depth array i tried eval but that doesn't work any suggestions?

here is php


PHP Code:



<?php

include("common.php");

$link = dbConnect();

$uname = $_COOKIE['hpuname'];

if($uname == "") {
    print ("&messages=wronguname");
    exit;
}

$query = "SELECT pass FROM users WHERE uname ='$uname'";
$result = @mysql_query($query);
$pass = mysql_result($result,0);

if($pass != $_COOKIE['hppass']) {
    print ("&messages=wrongpass");
    exit;
}

$query = "SELECT inbox FROM messages WHERE uname ='$uname'";
$result = @mysql_query($query);
$messages = mysql_result($result,0);

print ("&messages=$messages");
exit;

?>




and here is the flash code


PHP Code:



stop();

messageVars = new LoadVars();
messageVars.load("getinbox.php");
messageVars.onLoad = function(success) {
    if(success) {
        if(this.messages == 'wronguname') {
            _global.error = 'wronguname';
            gotoAndStop(3);
        }else if(this.messages == 'wrongpass') {
            _global.error = 'wrongpass';
            gotoAndStop(3);
        }else{
            _global.messages = this.messages;
            gotoAndStop(2);
        }
    }
};




thanks guys

[F8]String Index In Array?
Hey guys, in php you can use strings instead of numbers as the indices for arrays. I think it's like this:

PHP Code:




$array = array("indexString" => "value");





Anyone know of an equivalent in flash?

[F8] Converting A String To Array
Hello,

I'm not that up on actionscript like i used to be and i can't figure out where i am going wrong so please excuse me if this is blindly obvious or totally wrong. I'm reading in a text file using loadvars and i then want to load that data into an array by splittling it. where am i going wrong. please help!


Code:
adverts = new LoadVars();
adverts.load("advertList.txt");
adverts.onLoad = function(success) {
if (success) {
trace(this.publishedAdverts);
}
}
var adlist:String = adverts;
var adNosArray:Array = adverts.split(",");
for (var i = 0; i<adNosArray.length; i++)
{
holder.loadMovie(adNosArray[3]);
trace(adNosArray[i]);
}


any light shed on this would be greatly appreciated. Sorry again if it is utterly wrong!

cheers

neil.

Array/String Question
I have a string that I want in an array:

myString = "this,that,other";
myArray = new Array(myString);

Of course, this puts myString into the first element, but I want it to separate the words in between the commas and put each into its own element. As if I had done this:

myArray = new Array("this","that","other");

Any ideas on how to do this?

Array With String As Index
Hi,

Is it possible to do an array under AS3 with strings as index ?

something like :

myArray['item1']="Hello";
myArray['item2']="World";

thanks a lot,

A

Store String In A Array Xml Mp3
I am trying to build a mp3 player that takes an url from a xml file and plays the list. So far a was able to load the xml file but when I try to access the array of url from outside the fuction I lose the data. Please help how can I fix this.

download the fla you might need a mp3 file (rename to "a.mp3") it will play at load.

http://mason.gmu.edu/~eperez/children_array.zip

I want to be able to increse a index value and then take the data that was saved in the array to loaded in txt box and then play it.

thanks for helping

ActionScript Code:
// Create new XML Object and set ignoreWhite true
book_xml = new XML();
book_xml.ignoreWhite = true;
// Setup load handler which just invokes another function
// which will do the parsing of our XML
book_xml.onLoad = function(sucess) {
    if (sucess) {
        processBook(book_xml);
    }
};
// Load up the XML file into Flash
book_xml.load('book.xml');
// This is the function that will be called when
// our XML document is loaded succesfully

//* my code beloww
sid = new Array();
author = new Array();
song = new Array();
image = new Array();
mp3 = new Array();
//_global.variableName = "variableValue"

// end my code


   
function processBook(xmlDoc_xml) {
    var i = 0;
    // xmlDoc_xml is now a reference to the XML
    // object where our information is stored
    for (var n = 0; n<xmlDoc_xml.firstChild.childNodes.length; n++) {

        if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "Authors") {
            //trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild.nodeValue);
           
            author[i] = xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild.nodeValue;
                    //trace(i);
            i++;
        } else {
           
            if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "SID")
            {
                //trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
                sid[i-1] = xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue;               
                //trace(i-1);
                //i++;
            }
           
            if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "song")
            {
                //trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
                song[i-1] = xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue;            
                //trace(i-1);
                //i++;
            }
           
            if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "ImageUrlSmall")
            {
                image[i-1] = xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue;       
                //i++;
            }
           
            if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "mp3URL")
            {
                mp3[i-1] = xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue;               
                //i++;
            }
            //trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
           
        }

    }

    maxNum = i; //catch num of records
    max = maxNum;   // display it in txt box
   
    i++;
    SID = sid[0];
    Author = author[0];
    Song = song[0];
    Image = image[0];
    //MP3 = mp3[0];
   

   
    //mySound.loadSound(mp3[0],true);
    MP3 = mp3[xtrack];
    //MP3 = myObject[0].loc;
   
   
    // load the txt from dynamic text box and play
    mySound.loadSound(MP3,true);



}

   
   
    //MP3 = mp3[1];
   
/*
function funcPlay() {
    _root.MP3 = _root.mp3[1];   
}*/

[EDIT/CyanBlue] AS Tag applied... [/EDIT]

Getting Xml Array.length Using A String
Hi all,

I'm trying to pull the length of an array using a string with a variable. If I replace the variable with the value of it, I get my number. However, if I just use the variable, I just get the string. Perhaps I need to convert the string somehow?

this.loadXML("XML_loads/options1.xml", "list1");
function loadXML(path:String, objName) {
this[objName] = new XML();
this[objName].ignoreWhite = true;
this[objName].onLoad = function(success:Boolean) {
// When the data arrives, pass it to the menu.
if (success) {
//trace("list1 = "+list1);
olength = objName+".firstChild.childNodes.length";
trace("olength = "+olength);
} else {
trace("xml failed to load");
}
};
//insert path to the xml file for the menu
this[objName].load(path);
}

String To Array Reference?
hi,

is there a way to get a reference to an array by string? in AS2 you could do this:
ActionScript Code:
var myArray:Array = new Array();
var myString:String = 'myArray';

myArray[0] = 'blah';

trace( this[myString][0] ); // trace blah

maybe something like you can get child with getChildByName or class getDefinitionByName?

cheers

Copyright © 2005-08 www.BigResource.com, All rights reserved