-
How to make button load a webpage?
Hi, I'm really new to Flash CS3 and ActionScript 3, and need to make an online portfolio. How do I use ActionScript to make a button load a webpage?
Thanks!
-
function gotoAdobeSite(event:MouseEvent):void
{
var adobeURL:URLRequest = new URLRequest("http://www.adobe.com/");
navigateToURL(adobeURL);
}
linkButton.addEventListener(MouseEvent.CLICK, gotoAdobeSite);
-
-
-
if i'm using a flash navigation menu and want it to open in the same window how do i do that cos atm when clicking on a button it opens in a new window.
home_btn.addEventListener(MouseEvent.CLICK,clickHa ndler1);
browse_btn.addEventListener(MouseEvent.CLICK,click Handler2);
function clickHandler1(event:MouseEvent):void{
navigateToURL(new URLRequest("http://xxxxxxxxxx.com/"));
}
function clickHandler2(event:MouseEvent):void{
navigateToURL(new URLRequest("http://xxxxxxxxxx.com/browse.php"));
}
-
Add _self to the end of the urlRequest like I did here.
Code:
function clickHandler1(event:MouseEvent):void{
navigateToURL(new URLRequest("http://xxxxxxxxxx.com/"), "_self");
}
function clickHandler2(event:MouseEvent):void{
navigateToURL(new URLRequest("http://xxxxxxxxxx.com/browse.php"), "_self";
}
-
i get an error then.
1084: Syntax error: expecting rightparen before rightbrace.
-
sorry I forgot to add the other brace
Code:
function (event:MouseEvent):void{
navigateToURL(new URLRequest("http://xxxxxxxxxx.com/browse.php"), "_self");
}
-
i have no errors now but it is still the same before, it opens a new tab/window.
-
sorry askurat my bad it worked perfect lol.. i messed up.
thanx for your help.
-
no problem. I had another possible solution but I lost my internet connection last night.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|