Skip to main content
September 21, 2010
Answered

linking local files

  • September 21, 2010
  • 1 reply
  • 888 views

Hey I'm stuck with linking some local files.

I made a movieclip into a button but I cant link it to local files

Can anybody tell me how ? Please because I have to do a school project

This topic has been closed for replies.
Correct answer kglad

This is my code I want that index.html to open but its not opening . What am I doing wrong

function makebtn(mc:MovieClip,aurl:String):void {

mc.aurl = aurl;

mc.buttonMode = true;

mc.addEventListener (MouseEvent.CLICK,gotoaurl);

}

function gotoaurl (e:MouseEvent):void{

var aurl:String = e.target.aurl;

navigateToURL(new URLRequest(aurl));

}

makebtn(btn, 'index.html');


e.target isn't always the same as e.currentTarget, aurl may be mis-defined and/or you may have a security sandbox issue.  start testing.

1 reply

kglad
Community Expert
Community Expert
September 21, 2010

what are you trying to do with local files?


September 21, 2010

I have some pdf an html files which I wanna link . They will go on a cd not online on the web. So basically I want the button to open the file

when I click it

kglad
Community Expert
Community Expert
September 21, 2010

you can use navigateToURL() for both those file types:

navigateToURL(new URLRequest("yourPDF.pdf"));

//navigateToURL(new URLRequest("yourHTML.html"));