I'm trying to load an image from a xml created menu
my menu is created and when I press a button within the menu my text in my linkTo node appears in my textfield called contents. this part works great.
but when I try to load my image that goes with the text is where my problem is.
EDIT: when I trace (item.image); I get " images/20.jpg" on first button and the second button traces "images/21.jpg" so the xml nodes are correct.
Please can someone help me THANKS A MILLION in advance
Sincerely Xiaz
1st try
Code:
//assign a "linkTo" variable. this contains the url where the menu will link to when clicked
menuItem.linkTo = button.linkTo.toString();
//assign a "image" variable. this contains the url where the menu will link to when clicked
menuItem.image = button.image.toString();
function itemClicked(e:Event):void (
var item:MenuItem = e.target as MenuItem;
contents.htmlText = item.linkTo;
/////////PROBLEM AREA////////////////////////////////////////////////////////
imageloader.load(new URLRequest (item.image));
trace (item.image);
//traces Error#1034: Type Coercion failed: cannot convert "images/20.jpg" to flash.net.URLRequest.
at Vertical_fla::MainTimeline/itemClicked
2nd try
Code:
var urlRequest:URLRequest = new URLRequest(item.image);
imageloader.load(urlRequest);
trace(urlRequest);
//traces "[object URLRequest]"
3rd try
Code:
var request:URLRequest = new URLRequest(item.image);
var variables:URLVariables = new URLVariables();
request.data = variables;
imageloader.load(request);
trace(request)
//traces "[object URLRequest]" and "Error #2044 Unhandled IOErrorEvent:.text=Error #2035: URL Not Found"