Hello, I’m trying to finally dive into OOP and tie it into XMl that I am loading. I am using a custom class I created and I believe I’ve linked everything together that should be (paths and whatnot). The problem I’m having is I’m trying to trace 1 of the new portfolio objects I created so that I can reference to its properties. But whenever I trace i get an undefined. Anyone who could point me in the right direction would be awesome! Here is the XML code:
var ap:Array = new Array();
xmltw = new mx.transitions.Tween(xmlload, "_alpha", _global.transNone, 0, 100, 10);
xmltw.onMotionFinished=function(){
ap_xml = new XML();
ap_xml.ignoreWhite = true;
ap_xml.load('xml/webdesign.xml');
ap_xml.onLoad = function(sucess) {
if (sucess) {
var nodes:Array = this.firstChild.childNodes;
var portdir:String = this.firstChild.attributes.dir;
for(var i=0; i<nodes.length; i++){
xclient = nodes*.childNodes[0].firstChild.nodeValue;
xname = nodes*.childNodes[1].firstChild.nodeValue;
xurl = nodes*.childNodes[2].firstChild.nodeValue;
xsimg = nodes*.childNodes[3].firstChild.nodeValue;
xmimg = nodes*.childNodes[4].firstChild.nodeValue;
xlimg = nodes*.childNodes[5].firstChild.nodeValue;
xtools = nodes*.childNodes[6].firstChild.nodeValue;
xtype = nodes*.attributes.type;
xdir = nodes*.attributes.dir;
ap.push(new Portfolio(xclient,xname,xurl,xsimg,xmimg,xlimg,xtools,xtype,xdir));
}
parseFile(ap_xml);
totalpages = Math.ceil(ap.length/8)-1;
curpage = 0;
themin = 0;
themax = 7;
if(themax>=ap.length){
themax=ap.length-1;
}
viewinfo.thetext.text = (themin+1)+"-"+(themax+1)+" of "+ap.length;
xmldur = new mx.transitions.Tween(xmlload, "_alpha", _global.transNone, 100, 0, 10);
xmldur.onMotionFinished=function(){
startaniin();
}
trace(ap[0]);
}
};
}
Here is how I have my class setup:
class Portfolio
{
public var typex:Number;
public var dir:String;
public var client:String;
public var namex:String;
public var url:String;
public var simg:String;
public var mimg:String;
public var bimg:String;
public var tools:String;
public function Portfolio(ty:Number,di:String,cl:String,na:String,ur:String,si:String,mi:String,bi:String,to:String)
{
typex = ty;
dir = di;
client = cl;
namex = na;
url = ur;
simg = si;
mimg = mi;
bimg = bi;
tools = to;
}
}