navigateToUrl as3 using xml variable links

TruthSeeker

New Member
\[quote\] Hi i have xml driven menu which uses navigateToUrl. evrithing is ok when i press ctrl+Enter and publish swf. It navigates to the url which is specified in menu.xml.But when i upload swf to website it is not working, navigates to like directory not a url. ex. on local swf navigates to "sites URL" on web site navigates with "/" sign to mydomain/"sites URL" (error404)\[code\]please help to solve thishere is my as3 script and xml<?xml version="1.0" encoding="utf-8"?><menu><item><posNum>1</posNum><label>label1</label><linkTo>link1</linkTo></item><item><posNum>2</posNum><label>label2</label><linkTo>link2</linkTo></item></menu>\[/code\]\[/quote\]//---------XML-MENU----// xmlPath:String = "menu.xml";\[code\]var xml:XML;var loader = new URLLoader();loader.load(new URLRequest(xmlPath));loader.addEventListener(Event.COMPLETE, xmlLoaded);function xmlLoaded(e:Event):void {if ((e.target as URLLoader) != null ) {xml = new XML(loader.data);createMenu(); // this creates menu buttons with instance name menuItem}}var numberOfItems:uint = 0;menuItem.linkTo = xml.linkTo;menuItem.mouseChildren = false;menuItem.buttonMode = true;menuItem.addEventListener(MouseEvent.CLICK, itemClicked);function itemClicked(event:MouseEvent):void {var link:String = event.target.linkTo;var url:URLRequest = new URLRequest(link);navigateToURL(new URLRequest(link),"_self"); // or"_blank"trace(link);}}\[/code\]
 
Back
Top