[AS3] Integer confusion
- Started
- Last post
- 6 Responses
- rounce
Got some PHP generated XML and all is dandy except that I want to display the project "id" values in the reverse order. Not hard? Well it's been bothering me for like 6 hours now.
The obvious solution (the one I used) would be to take the number of XML nodes [ revId = folioFeed.project.length(); ] and the subtract 1 for every iteration of the ItemRenderer.
For some reason the number counts down from zero (it counts normally except the numbers are negative) whenever it's accessed from within the ItemRenderer's FlexEvent.REPEAT listener.
Something is obviously very wrong here (probably my understanding of ItemRenderers). Could anyone shed some light?
- PonyBoy0
can you show the loop?... need to see the script complete in order to really understand why it would start from 0 and go negative...
... you said you needed to reverse the order of the list... i have a feeling whatever is doing it is in the script you created that reverses the order.
- rounce0
I highlighted the lines where the int is accessed and added to the generic object that is used for both FolioItem labels and then provided to each FolioItem instance to be used inside that object's internal code.
- rounce0
I'm an idiot. Just read the XML class docs.
>> length():int
>> For XML objects, this method always returns the integer 1.
- akoni0
Why not make a value object in the model class that you can call instead of ar _pVarsObj:Object
That way you don't have to do a something .currentitem..blablabla multiple times?
then possibly do a reverse array
http://livedocs.adobe.com/flash/…)which will end up being your dataprovider
- akoni0
sorry if that link doesnt go through.. but just search for the reverse method
- iamaracinghorse0
Have you looked into convertin the XML object into an XMLList object? http://livedocs.adobe.com/flash/…
That should return the correct length.