Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
multidimensional array questions - from a director programmer (lon

multidimensional array questions - from a director programmer (lon

2004-02-25       - By rise4peace@(protected)

 Back
Hello,

I 've been using Macromedia Director for close to 8 years now and finally have an oppurtunity to create a web application using Flash MX.

The application I am designing is going to be using XML to store data on the server side and then be read into Flash MX during runtime to define internal movieclips, etc.

Since this is really my first large, scalable project written in Flash I have a couple of questions I hope someone can help define a little better for me.

1.) I 'm concerned about access speed using XML data. So is it a "best practice " to read XML data into Flash and then create an internal multidimensional array based upon the read in XML data?

2.) Director uses property lists as a way to granularize certain types of lists and make accessing the data contained within these lists a less tedious task. A simple example of a property list looks like this:

fruit_data = [#bowl1: [#apple: [#type: "macintosh ", #color: "red ", #price: 99], #orange: [#type: "sweet ", #color: "orange-yellow ", #price: 1.2500]], #bowl2: [#apple: [#type: "macoun ", #color: "redish white ", #price: 1.4000], #orange: [#type: "bitter ", #color: "orange ", #price: 99]]]

If I wanted to populate a sub-list that only contains the data from the #bowl1 property of the fruit_data list I 'd use the following syntax:
subList = fruit_data[#bowl1]

The subList list would look like this:
[#apple: [#type: "macintosh ", #color: "red ", #price: 99], #orange: [#type: "sweet ", #color: "orange-yellow ", #price: 1.2500]]

If I wanted to add an additional property called #bowl3 to the fruit_data list I 'd use the following syntax:
fruit_data[#bowl3] = [#apple: [#type: "red delicious ", #color: "red ", #price: 50], #orange: [#type: "juice ", #color: "orange-yellow ", #price: 89]]

The fruit_data list would then look like this:
[#bowl1: [#apple: [#type: "macintosh ", #color: "red ", #price: 99], #orange: [#type: "sweet ", #color: "orange-yellow ", #price: 1.2500]], #bowl2: [#apple: [#type: "macoun ", #color: "redish white ", #price: 1.4000], #orange: [#type: "bitter ", #color: "orange ", #price: 99]], #bowl3: [#apple: [#type: "red delicious ", #color: "red ", #price: 50], #orange: [#type: "juice ", #color: "orange-yellow ", #price: 89]]]


I 've done some research and it looks like Flash doesn 't support property lists so the next best thing is to create a multdimensional list in the same fashion.

Is there a way in flash to access data from a multidimensional list without having to refer to the index number within the multidimensional list? Like I pointed out previously Director allows you to grab sub list information by referring to the property value within a list like:
subList = fruit_data[#bowl1]

This makes accessing the data simpler because a routine can be created that the checks for the presence of the property and if it 's not available it 'll return false.

To achieve this same effect within Flash MX I think the only way to accomplish this is to a lists that refers to other lists indexes. This all sounds fine but can become rather convoluted the larger the multidimensional list becomes.

Another idea I had after looking at some examples at actionscipt toolbox is to create an object and populate it 's internal properties using a function. This way I could access the data stored in the object by referring to the object pointer itself:

function Donor(firstname, lastname, amount, state) {
this.firstname = firstname;
this.lastname = lastname;
this.amount = amount;
this.state = state;
}
firstDonor = new Donor( "John ", "Anderson ",18, "Ohio ");

trace( "John Anderson donated $ " + firstDonor.amount);


This is really good because I can then put these objects into an array. The only problem i am having with this solution is how I then access these objects data by referring to the object pointer?

In summary, I am basically trying to mimic the Director "property list " type within Flash MX to create a multidimensional list that I can access using the property value.

Any suggestions or pointers would be most welcome.

cheers,

rise4peace



=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:105238
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)