Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-16-2012, 07:03 PM   PM User | #1
kumba
New to the CF scene

 
Join Date: Sep 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
kumba is an unknown quantity at this point
[AS2] Duplicate movie based on array data

Hello flash enthusiasts,

I am currently building a (mock up) to view subscriber information by duplicating a movie clip based on an array. I'm grabbing the data from an xml and trying to pass the array to duplicated clips. The problem I'm running into is that I can only get data to the first duplicated movie and the original remains blank.

Here is the xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<content>	
	<article>
		<last4id>1111</last4id>
		<fnameid>fname1</fnameid>
		<lnameid>lname1</lnameid>
		<expdate>11/11</expdate>
		<addressid>1111 First St</addressid>
		<cityid>Los Angeles</cityid>
		<stateid>CA1</stateid>
		<zipid>11111</zipid>		
	</article>
	<article>
		<last4id>2222</last4id>
		<fnameid>fname2</fnameid>
		<lnameid>lname2</lnameid>
		<expdate>22/22</expdate>
		<addressid>2222 Second St</addressid>
		<cityid>San Francisco</cityid>
		<stateid>CA2</stateid>
		<zipid>22222</zipid>		
	</article>
</content>
Here is how I'm loading the xml:
Code:
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		last4id = [];
		fnameid = [];
		lnameid = [];
		expdate = [];
		addressid = [];
		cityid = [];
		stateid = [];
		zipid = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			last4id[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			fnameid[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
			lnameid[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;			
			expdate[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
			addressid[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
			cityid[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
			stateid[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
			zipid[i] = xmlNode.childNodes[i].childNodes[7].firstChild.nodeValue;
		}
		nextFrame();
	} else {
		trace("Can not load edit card xml");
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("edittest.xml");
And on the next frame I'm running a for loop:
Code:
for (i=1; i<total; ++i) {
	item_mc.info_mc.duplicateMovieClip("info_mc"+i, i);
	item_mc["info_mc"+i]._y = item_mc["info_mc"+i]._height+15;
	item_mc["info_mc"+i].fname.text = fnameid[i];
	item_mc["info_mc"+i].lname.text = lnameid[i];
	item_mc["info_mc"+i].cdigits.text = last4id[i];
	item_mc["info_mc"+i].cdate.text = expdate[i];
	item_mc["info_mc"+i].caddress.text = addressid[i];
	item_mc["info_mc"+i].ccity.text = cityid[i];
	item_mc["info_mc"+i].cstate.text = stateid[i];
	item_mc["info_mc"+i].czip.text = zipid[i];
}
I'm wondering if I'm missing an initial load step or that I'm not splitting the array correctly.

Any and all help is greatly appreciated and thank you for taking a moment to look at this post.

Thanks,
Kumba
kumba is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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


All times are GMT +1. The time now is 09:49 PM.


Advertisement
Log in to turn off these ads.