PDA

Click to See Complete Forum and Search --> : I need help please



sum
07-09-2001, 03:50 PM
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.name" 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

VAYKENT
07-09-2001, 04:07 PM
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?

sum
07-09-2001, 05:00 PM
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

VAYKENT
07-09-2001, 07:41 PM
No prob'! Anytime....