Be a Supporter!
pockets08
pockets08
  • Member since: Sep. 1, 2007
  • Offline.
Forum Stats
Member
Level 03
Artist
Flash CS6 Aug. 13th, 2012 @ 09:48 PM Reply

How do I link a Flash Button to a Website? :(

Attila0413
Attila0413
  • Member since: Dec. 10, 2009
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
pockets08
pockets08
  • Member since: Sep. 1, 2007
  • Offline.
Forum Stats
Member
Level 03
Artist
Response to Flash CS6 Aug. 14th, 2012 @ 12:59 PM Reply

At 8/13/12 09:49 PM, Attila0413 wrote: http://www.attiliocarotenuto.com/flash/93-as3-linking-to-web pages-with-navigatetourl

Okay, the problem I must be having, is WHERE to place the action script? I have over 50 buttons on one frame to be clicked, its not an animated flash, its just a screen with multiple buttons which all need to direct to a link to another page.

pockets08
pockets08
  • Member since: Sep. 1, 2007
  • Offline.
Forum Stats
Member
Level 03
Artist
Response to Flash CS6 Aug. 14th, 2012 @ 01:10 PM Reply

At 8/14/12 12:59 PM, pockets08 wrote:
At 8/13/12 09:49 PM, Attila0413 wrote: http://www.attiliocarotenuto.com/flash/93-as3-linking-to-web pages-with-navigatetourl
Okay, the problem I must be having, is WHERE to place the action script? I have over 50 buttons on one frame to be clicked, its not an animated flash, its just a screen with multiple buttons which all need to direct to a link to another page.

package {

import flash.display.SimpleButton;

import flash.net.navigateToURL;

import flash.net.URLRequest;

import flash.events.MouseEvent;

public class byers_btn extends SimpleButton{

public function LinkButton() {

addEventListener(MouseEvent.CLICK, onMouseClick);

}

function onMouseClick(event:MouseEvent):void{

navigateToURL(new URLRequest("http://www.google.com"), "_blank");

}

}
}

is IN the AS, on the button itself...is that correct? it doesnt work. lol

Kirk-Cocaine
Kirk-Cocaine
  • Member since: Aug. 17, 2003
  • Offline.
Forum Stats
Moderator
Level 38
Programmer
Response to Flash CS6 Aug. 14th, 2012 @ 01:25 PM Reply

At 8/14/12 01:10 PM, pockets08 wrote: is IN the AS, on the button itself...is that correct?

No, you can't place code in object in AS3. What you've got there is a class. Maybe you should go read some AS tutorials (like this one) rather than just copy and pasting code.


The water in Majorca don't taste like what it oughta.

| AS3: Main | AS2: Main | Flash Tutorials |

BBS Signature
pockets08
pockets08
  • Member since: Sep. 1, 2007
  • Offline.
Forum Stats
Member
Level 03
Artist
Response to Flash CS6 Aug. 14th, 2012 @ 01:35 PM Reply

At 8/14/12 01:25 PM, Kirk-Cocaine wrote:
At 8/14/12 01:10 PM, pockets08 wrote: is IN the AS, on the button itself...is that correct?
No, you can't place code in object in AS3. What you've got there is a class. Maybe you should go read some AS tutorials (like this one) rather than just copy and pasting code.

Well the thing thats urking me, is Ive done this before - but the codes all been erased, and its been like 3 years. So I have to redo it all - and Unfortunatley I have been searching for the tutorials that I need - but I dont have a lot of time to search from scratch. My deadline was Yesterday, and Ive got everything done visually, minus the vanished code. Its just a simple question - and the copy and pasted code, was from the link i was sent previously - which used the class, but didnt explain anything else.

pockets08
pockets08
  • Member since: Sep. 1, 2007
  • Offline.
Forum Stats
Member
Level 03
Artist
Response to Flash CS6 Aug. 14th, 2012 @ 02:16 PM Reply

http://www.republicofcode.com/tutorials/flash/as3link/

thats the tutorial I was using, and Ive used it before -

byers_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
navigateToURL(new URLRequest("http://www.fairlawnplaza.com/"), "_blank");
}

but in line two, the "Class or Interface of "MouseEvent" could not be loaded, is there a specefic Mouse function name, im supposed to use?

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to Flash CS6 Aug. 14th, 2012 @ 02:27 PM Reply

At 8/14/12 02:16 PM, pockets08 wrote: but in line two, the "Class or Interface of "MouseEvent" could not be loaded

import the class