PDA

View Full Version : Rofl?


Qued
09-30-2007, 10:37 PM
So I make a button, and I go to add a simple on(release) { gotoAndPlay(2); } action but I cannot add anything all it says is 'Current selection cannot have actions applied to it.' whats up with that?

DanontheMoon
09-30-2007, 11:09 PM
Are you sure it's tracking it as a button, and not an mc?

Qued
09-30-2007, 11:58 PM
Yup, you on msn? I might need your help lol.

ptobias
09-30-2007, 11:58 PM
In Flash CS3 you can only add actions to the timeline.

This should help:


btn.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(event:MouseEvent):void
{
gotoAndPlay(2);
}

DanontheMoon
10-01-2007, 12:11 AM
^Listen to him!

greggreg
10-01-2007, 07:21 AM
or you can change the AS version by clicking on the 'settings' button and changing the 'ActionScript version' to 2.0. then itll be just like the old flash.

flash_boy
10-01-2007, 05:15 PM
or the other option from this:

btn.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(event:MouseEvent):void
{
gotoAndPlay(2);
}

is to give your button an instance name and simply say:

btnName.onRelease = function(){
gotoAndPlay(2);
}

that is all that you need.

sprint
10-10-2007, 03:05 AM
i get this message when i put in the first code:

1120: Access of undefined property btn. - Space - btn.addEventListener(MouseEvent.CLICK, clickHandler);

second code i get this:

1120: Access of undefined property - Space - btnCorporate. btnCorporate.onRelease = function(){

now does it matter is you have capital letters? should i write everything i lowercase letters, would that help?

also, should i add this in the timeline or in the button?

ptobias
10-10-2007, 10:50 AM
What version of Actionscript are you using?

if AS3:
btnCorporate.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(evt:MouseEvent):void
{
gotoAndPlay(2);
}


if AS2:
btnCorporate.onRelease = function(){
gotoAndPlay(2);
}

where "btnCorporate" is the instance name. Make sure you give your button (or movieclip) an instance name. Without an instance name you will get those errors.

now does it matter is you have capital letters? should i write everything i lowercase letters, would that help?
Actionscript is case-sensitive. Therefore, using either of the code segments above is correct syntax.

also, should i add this in the timeline or in the button?
You should add actions on a frame on the timeline in Flash CS3.