PDA

View Full Version : Rofl?



Qued
September 30th, 2007, 11: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
October 1st, 2007, 12:09 AM
Are you sure it's tracking it as a button, and not an mc?

Qued
October 1st, 2007, 12:58 AM
Yup, you on msn? I might need your help lol.

ptobias
October 1st, 2007, 12:58 AM
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
October 1st, 2007, 01:11 AM
^Listen to him!

greggreg
October 1st, 2007, 08: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
October 1st, 2007, 06: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
October 10th, 2007, 04: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
October 10th, 2007, 11: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.