0
flash button link using actionscript 2.0
New Here
,
/t5/animate-discussions/flash-button-link-using-actionscript-2-0/td-p/998188
Aug 17, 2008
Aug 17, 2008
Copy link to clipboard
Copied
Hey guys,
Need help creating a button link using actionscript 2.0. Geez, it used to be so easy using getURL. I've tried using the following code on the button and then the frame:
my_button.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(event:MouseEvent):void{
navigateToURL(new URLRequest(" http://www.mywebsite.com"));
}
But it's not working. I am using Flash CS3 and my publish settings are set to ActionScript 2.0. What's going on!?
Need help creating a button link using actionscript 2.0. Geez, it used to be so easy using getURL. I've tried using the following code on the button and then the frame:
my_button.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(event:MouseEvent):void{
navigateToURL(new URLRequest(" http://www.mywebsite.com"));
}
But it's not working. I am using Flash CS3 and my publish settings are set to ActionScript 2.0. What's going on!?

TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/animate-discussions/flash-button-link-using-actionscript-2-0/m-p/998189#M247078
Aug 17, 2008
Aug 17, 2008
Copy link to clipboard
Copied
Thats AS3 code you're using there, so you need to change your
Publish Settings to Actionscript 3.0.
Or you could just leave your settings as is and go back to using good old getURL.
Or you could just leave your settings as is and go back to using good old getURL.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
miss_jess
AUTHOR
New Here
,
/t5/animate-discussions/flash-button-link-using-actionscript-2-0/m-p/998190#M247079
Aug 18, 2008
Aug 18, 2008
Copy link to clipboard
Copied
oh, but i tried using getURL and that doesn't work. Is there
another way using actionscript 2.0?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/animate-discussions/flash-button-link-using-actionscript-2-0/m-p/998191#M247080
Aug 18, 2008
Aug 18, 2008
Copy link to clipboard
Copied
Usual disclaimer; I know nothing about Flash, but maybe it'll
still work
Adobe is definately paranoid... I can't write l-o-c-a-t-i-o-n in a post... so just remove the "-" in l-o-c-a-t-i-o-n below
In HTML:
<script type="text/javascript">
function setLocation(url){
document.l-o-c-a-t-i-o-n.href=url;
}
</script>
From what I read you need to allow script access explicitly for this to work.
<param name="allowScriptAccess" value="always" />
In AS:
import flash.external.*;
ExternalInterface.call("setLocation"," http://www.google.com");
Adobe is definately paranoid... I can't write l-o-c-a-t-i-o-n in a post... so just remove the "-" in l-o-c-a-t-i-o-n below
In HTML:
<script type="text/javascript">
function setLocation(url){
document.l-o-c-a-t-i-o-n.href=url;
}
</script>
From what I read you need to allow script access explicitly for this to work.
<param name="allowScriptAccess" value="always" />
In AS:
import flash.external.*;
ExternalInterface.call("setLocation"," http://www.google.com");
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
LATEST
/t5/animate-discussions/flash-button-link-using-actionscript-2-0/m-p/998192#M247081
Aug 18, 2008
Aug 18, 2008
Copy link to clipboard
Copied
Look down in your Properties panel. If it's showing the
following
Player: 9, Actionscript 3.0
then use your same script
my_button.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void{
navigateToURL(new URLRequest(" http://www.mywebsite.com"));
}
If you want to change to Actionscript 2.0, click on the Settings button in the Properties panel and change the Actionscript version under the Flash tab.
Then you can use getURL
my_button.onRelease = function(){
getURL(" http://www.mywebsite.com");
}
Player: 9, Actionscript 3.0
then use your same script
my_button.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void{
navigateToURL(new URLRequest(" http://www.mywebsite.com"));
}
If you want to change to Actionscript 2.0, click on the Settings button in the Properties panel and change the Actionscript version under the Flash tab.
Then you can use getURL
my_button.onRelease = function(){
getURL(" http://www.mywebsite.com");
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

