flash issues
- Started
- Last post
- 7 Responses
- spmitch
I'm trying to open a url from an xml generated list. I can't get it to pass the url to the eventlistener, been working on this for hours
any help would be greatly appreciated.var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.CO... onLoaded);var xml:XML;
function onLoaded(e:Event):void {
xml = new XML(e.target.data);
var il:XMLList = xml.newoffers.item;
for(var i:uint=0; i<il.length(); i++) {
var listMC:MovieClip = new listMCMovieClip;
mc.addChild(listMC).name = "listMC" + i;
listMC.date.text = il.date[i];
listMC.description.text = il.description[i];
listMC.price.text = il.price[i];
var link:MovieClip = new linkMovieCLip;
mc.addChild(link).name = "link" + i;
//var linkURL:String = il.link[i];
this["link"+i].addEventListener... getLink);
function getLink(e:MouseEvent):void {
var url:String = il.link[i];
var request:URLRequest = new URLRequest("link" +i);
navigateToURL (request,"_blank");
trace("you clicked the icon");
}
link.x = 470;
link.y = i * listMC.height;
listMC.y = i * listMC.height;
}
newOffers.gotoAndStop(newOffers... = "on");
}
// load from xml file
loader.load(new URLRequest("../xml/news.xml"));
- uan0
on idea, but function inside another function doesn't look right...
- spmitch0
fixed but no go, still getting :: A term is undefined and has no properties.
I think it has to do with how I'm try in to access the url in the eventlistener but I can't figure it out
- spmitch0
Thanks, I forgot about pastebin
- kumori040
in your XML file, wrap the URL inside a CDATA section:
<![CDATA[urlhere]]>
That unparses the data inside the brackets, which is helpful for URLs, since they often contain illegal characters in XML.
- spmitch0
fixed