Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

flash button link using actionscript 2.0

New Here ,
Aug 17, 2008 Aug 17, 2008
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!?

TOPICS
ActionScript
4.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 17, 2008 Aug 17, 2008
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2008 Aug 18, 2008
oh, but i tried using getURL and that doesn't work. Is there another way using actionscript 2.0?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2008 Aug 18, 2008
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");
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 18, 2008 Aug 18, 2008
LATEST
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");
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines