Add an action to a button in Flash CS3

Hi All

This might sound a bit dumb but I just can’t workout how to add an action to a button in the new version of flash (CS3).

I have created the button, put it on stage, selected it and gone to actions but the actions tab says “Current selection cannot have actions applied to it”.

All I want to do is make the timeline go to a frame label on click.

I thought I would just add it as a behaviour but action script 3 does not support that and I have to use action script 3 as there is video in the flash and action script 2 does not support that.

Any help would be great.

Many Thanks

mrmbarnes

In AS3, they have changed the evnet handling totally.

You must give your button a name, in Properties (let’s say it’s “_btn1”).

Then add the following code to the timeline (better create a separate “actions” layer):

_btn1.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
trace(“clicked”);
}

That should work :wink:

Hi

Thanks for that but I’m not too sure how this will work.

I now have the button and it is called _btn1 sitting in a keyframe with a label of home.

I have added:

_btn1.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
trace(“clicked”);
}

into the time line.

I need to get the button to go to the keyframe with a label called video1.

How do I do this?

Thank you very much for your help.

mrmbarnes