Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-01-2007, 04:23 AM   #1
tsj4
Senior Member
 
Join Date: May 2005
Location: San Francisco
Posts: 741
Default multi dimensional array w/ XML data

issue trying to populate a dynamic container from library with data.

I have an mc that lives in the library with a linkage identifier of "container".
It has a empty_mc labeled "holder" for the loaded image and a text field labeled "name". When I run the script it places 2 instances of the container mc on the stage but it should be placing 10 and it also doesn't populate the textfield with the name value. What am I doing wrong?

Code:
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success:Boolean):Void  {
	if (success) {
		var i:Number;
		var itemMens:Array = XPath.selectNodes(this, "/departments/department[@name='MENS']/item");
		var itemWomens:Array = XPath.selectNodes(this, "/departments/department[@name='WOMENS']/item");
		//For loop to attach our container movieclip and pass the array information
		//Starting x & y values
		var xPos = 60;
		var yPos = 60;
		for (i=0; i<itemMens.length; i++) {
			
			//attach the container clip
			attachMovie("container", "new"+i, i, {_x:xPos, _y:yPos});
			//increase the y postion each time
			xPos += this["new"+i]._width+5;
			//add the information
			this["new"+i].name.text = itemMens[i].attributes.name;
			this["new"+i].interest.text = itemMens[i].attributes.price;
			this["new"+i].link = itemMens[i].attributes.url;
			this["new"+i].image = itemMens[i].attributes.image;
			trace(itemMens[i].attributes.price);
		}
	} else {
		trace("Error Loading XML");
	}
};
xml.load("content.xml");
If I add trace (itemMens.length) inside the for loop it outputs 10 so why is it not places ten instances of container on the stage.
Attached Files
File Type: zip Gift Shop.zip (57.6 KB, 136 views)
tsj4 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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving XML Data Advocate ActionScript 3.0 12 05-25-2007 03:59 PM
trouble loading xml data into swf that loads into swf artlazaar Projectors and CDs 6 04-13-2007 08:52 PM
Array data not being passed to Final Score screen! Why??? orlando ActionScript 2.0 2 12-15-2006 04:12 PM
Storing data in array takes a toll in performance? Sir Patroclo Flash 8 General Questions 5 10-19-2006 08:44 PM
Assigning XML data into an array blondeh ActionScript 2.0 6 05-29-2006 08:56 PM


All times are GMT. The time now is 05:28 PM.

///
Follow actionscriptorg on Twitter

 


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