Actionscript 3 XML issue
- Started
- Last post
- 6 Responses
- CyBrain
I'm working along with this tutorial from Republic of Code.
http://www.republicofcode.com/tu…
Their work is usually pretty reliable, but I'm getting a type coercion error on page 4 or the tutorial. Here is my as code:
http://pastebin.com/f74e4552
and here is my XML:
http://pastebin.com/f3d3099cMy file playlist.xml is in the same folder as my FLA and SWF.
I have some import statements on my frame script that are probably irrelevant. I get the same error with or without them. Is there something wrong here or am I cursed?
- noiseisthis0
you have an "h" in line 1 of your xml document. delete and retry
- CyBrain0
I removed the h in the first line of the XML doc but still get he error.
I found out that the line causing the problem is
my_total = my_songs.length();
Is it because my_total is defined as an XMLList data type?- trace(my_total);
after line 17noiseisthis - and what is my_total being used for? its not referenced anywhere else in the as docnoiseisthis
- trace(my_total);
- kumori040
In your code, you declare "my_songs" as an XMLList. But in your error line you're asking it to be a number (length() returns a number). You can't coerce an XMLList type to a Number.
- CyBrain0
I can't assign my_total without the whole thing crashing.
I was in the middle of a tutorial that said test it now. http://www.republicofcode.com/tu…
It's a music player that will use the number of songs to affect how the next and previous buttons work.
- Milan0
my_songs.length(); returns an int so try changing the datatype of my_total to int.