-
Hey people! Can someone shoot me and put me out of my misery?!?!?XML is driving me crazy.
Here is my code first before I get into my prob:
****(I hope it shows up right, I had to change my "for" statment it wont show up right "i is 0, i lessThan productCount, i incrememnt")
=============================================
//functions
function getLoaded(success){
productCount=xmlObj.firstChild.childNodes.length
nodeObj=xmlObj.firstChild.childNodes
for(i=0,i<productCount,i++){
duplicateMovieClip(gallery.pic,"pic"+i,i)
set("gallery.pic"+i+".picName",nodeObj.attributes. name)
setProperty("gallery.pic"+i,_x,80+(i*(width+10)))
}
}
//INIT Vars
dupCount=0
countX=0
countY=0
width=gallery.pic._width
//meat
stop()
//XML
xmlObj= new XML
xmlObj.load("mydoc.xml")
xmlObj.onLoad=getLoaded
================================================== ====
I am trying to get a MC to duplicate(which works fine), the movie consists of a pic and a lable. the movie duplicates the correct # of times but I cant get the lable to show up. I have tried the method above, as well as going directly into the mc and lableing the text field like this "picName=_parent._parent.nodeObj.attributes.na me" but it only come back as undefined. I am so confused. please help. Any resources or anything would be great!
Thanks in advance!
Greg Starr
tribaldyanamics.com
greg@bestnetpc.com
-
Uhh...
Righ off the bat - you're using the attributes method wrong. If you are setting an attribute use dot notation. If you are accessing the value held in an attribute you need to use the Array access operators - square brackets.
valueToHold = nameOFXMLObj.attributes['nameOfAttribute']
Cool?
-
You are the MAN!!!!
Vaykent,
Thanks man... I would have sat here for the next year bashing my head against the desk on that one. You da man!
Have phun!
..::$uM::..
Greg Starr
tribaldynamics.com
greg@tribaldynamics.com
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|