Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 3.00 average. Display Modes
Old 12-19-2007, 04:32 AM   #1
manco
Registered User
 
Join Date: Dec 2007
Posts: 5
Default in AS3 is it necessary to put XML into array anymore?

Since XML is now an Object is it still recommended to transfer over the data into an array like you would in AS2? Doesn't seem that necessary to me anymore but wanted some opinions.

Thanks
manco is offline   Reply With Quote
Old 12-19-2007, 03:55 PM   #2
newblack
dondeEstanMisPantalones?
 
newblack's Avatar
 
Join Date: Nov 2005
Location: New York Proper
Posts: 1,173
Send a message via AIM to newblack
Default

when would you want to convert XML to Arrays? never heard of that before. it's a natively supported Object, there's no need to do any conversion.
__________________
i am gibreel farishta
general relativity
jellytanks alpha redux
newblack is offline   Reply With Quote
Old 12-19-2007, 04:12 PM   #3
manco
Registered User
 
Join Date: Dec 2007
Posts: 5
Default

Sorry my wording was wrong. I meant store XML objects in Arrays. In AS2 I use to load in XML, convert them to objects with each nodes properties, and store them in arrays for reference later on. I don't see the point of doing that anymore in AS3 but was looking for some opinions for or against that. Hopefully that clarifies my post.
manco is offline   Reply With Quote
Old 12-24-2007, 06:43 PM   #4
scootersim
Registered User
 
Join Date: Jun 2004
Location: Oviedo, Florida
Posts: 1
Default

Even in AS2 I don't think you were REQUIRED to write to an Array object. It certainly was an option, but not a mandate. Some used to think it was easier to work with arrays than it was with the XML object, but I don't see it.

Short answer is: No.
scootersim is offline   Reply With Quote
Old 01-05-2008, 05:21 PM   #5
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
Default

Hi Manco,

I used to do the same thing. It would much easier to do eventDates[5] than to do xml.firstChild.firstChild.firstChild.nextSibling.f irstChild.nodeValue.

However, XML/E4X in AS 3.0 is so easy to access, that kind of logic isn't needed. Read here: http://www.senocular.com/flash/tutor...s3/?page=4#e4x
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman
Flash Gordon is offline   Reply With Quote
Old 01-07-2008, 02:25 AM   #6
peptobismol
Senior Member
 
Join Date: Oct 2005
Posts: 282
Default

wow.. e4x does make the process easier. i'd have to switch to as3.0 one day.
peptobismol is offline   Reply With Quote
Old 02-19-2008, 12:14 PM   #7
mux
Registered User
 
Join Date: Oct 2004
Posts: 4
Smile

hi guys..
i had the same thinking regards arrays like the question
so before we looped the contents of an xml to store the contains to objects vars array etc.

now we can just call them by name once that XML var has the complete xml in it.

am i correct?

ps. this senocular tutorial is just great. god bless him
mux is offline   Reply With Quote
Old 08-06-2008, 06:12 AM   #8
ActionScription
Registered User
 
Join Date: Aug 2008
Location: Pacific northwest, usa and actionscription.wordpress.com
Posts: 2
Default Speed issue?

I'm researching the same thing. I've found several speed trials that compare the speed of looping an array, object, and dictionary. But haven't seen how looping through in xml compares. Anyone know if speed is an issue? And at what point is it worth converting data from a slower form to a faster one? B/c, although it is fully supported in AS3, xml may still be slower.

BTW: arrays are quickest, followed by dictionaries, and finally objects: Check out pixelwork's comparison test

( http://pixelwelders.com/blog/best-pr...-dictionaries/ )
ActionScription is offline   Reply With Quote
Old 08-06-2008, 12:04 PM   #9
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,758
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

In general, E4X is a little slower than other objects. There's an obvious overhead to sorting through an xml's hierarchy using the E4X syntax. However, when considering the extraction of data from an unknown XML structure where you're targeting a collection of nodes of a certain name, E4X is actually faster that using other techniques to traverse the tree manually. So in the end it's circumstantial.
__________________
(6)
senocular is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tracing array from a xml doesn`t work ferrarih ActionScript 2.0 1 11-03-2007 09:16 PM
XML to ARRAY problem and more vascq ActionScript 1.0 (and below) 1 06-06-2007 12:58 PM
Problem with a for...in loop in a for...in loop VictoriaWelby ActionScript 2.0 2 04-10-2007 12:20 AM
AS3 Loaded XML into DataGrid chuckgrenade Flex 2 & 3 11 03-27-2007 08:55 PM
releasing xml file from XML.onLoad() sophistikat ActionScript 2.0 2 02-21-2007 08:00 PM


All times are GMT. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.
You Rated this Thread: