Copy link to clipboard
Copied
The code below is used to make a play, pause and stop button.
Flash keeps giving Duplicate Function Errors. It would be much appreciated if someone with more actionscript expertise could fix this error.
THANK YOU
stop();
start_btn.addEventListener(MouseEvent.CLICK, startMove);
stop_btn.addEventListener(MouseEvent.CLICK, stopMove);
pause_btn.addEventListener(MouseEvent.CLICK, pauseMove);
function startMove(e:MouseEvent):void {
play();
}
function stopMove(e:MouseEvent):void {
gotoAndPlay(1, 'Scene 1')
stop();
}
function pauseMove(e:MouseEvent):void {
stop();
}
Copy link to clipboard
Copied
The code itself appears to be fine. If you happen to be planting this same code in more than one frame of the timeline then that is where you are duplicating functions.
You can resue the event listener assignments as often as you meed to, but you can only define a function using a particular name once in the file. If you want the same functions to be used thoughout the timeline then place them in the first frame of a layer that you extend for the length of the timeline. If the functions need to change depending on where you are in the timeline, either use new functions/names or build condirional logic into the functions based on currentFrame values or other criteria.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now