Flash is annoying me

Soldato
Joined
27 Jun 2006
Posts
6,301
Hello all,

I've dug out the Flash (CS3) to make a banner ad for my site and I've rekindled my hatred for it.

I have made the entire ad and it looks okay but I'm having a nightmare making it 'clickable' throughout.

I have looked on several different websites and used the code recommended every time with the classic 'invisible' button, which has turned turquoise for me:

Code:
on (release){
getURL("http://www.url.com/", "blank");
}

However, I'm getting the error:

Location
Code:
Scene 1, Layer 'Link', Frame 1, Line 1
Description
Code:
1087: Syntax error: extra characters found after end of program.
Source
Code:
on (release){

I downloaded a sample file from one of these sites and the actionscript is exactly the same as mine.

I'm using an image (jpg) turned into a symbol (button), changed the button states to only be present on 'hit' (hence the turquoise) but still it's not playing nice.

I do have a 'stop' actionscript on a different layer (same frame) so the ad doesn't loop - would that be causing the problem? When I have added the 'getURL' actionscript on its own layer it has sometimes turned the stop off and the movie loops when tested.

Getting that, I then tried putting the stop and getURL into the same layer but that didn't work either.

Any ideas? Sort of at the end of tether with it.
 
is the sample code actionscript 3 or 2? because actionscript 3 is very different from previous versions so example code for actionscript 3 wouldn't work.

Gaunt
 
They have made things so much different in AS3, right pita.

In AS3, you need to create the symbol as a button, which by the sounds of it you have done. Then on the main stage, where the button is, single click on it and add an instance name (properties panel at the bottom). In this example, I have called this btn_link

Then, in the timeline, add this code to a keyframe (no code goes on the button):

Code:
btn_link.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent):void {
	var url:URLRequest = new URLRequest("http://www.overclockers.co.uk"); 
	navigateToURL(url, "_blank");
}

That should do it.
 
Thanks guys :)

I took mattgaunt's reply and went on a bit of a hunt - found out a lot has indeed changed. Bit annoying as I've been struggling all day to come to terms with it and never thought it would have been changes within the actionscripting but oh well.

Got it sorted in the end using the same code you provided, monkeysmith.

Another problem solved.
 
Back
Top Bottom