Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Duplicate Function Error

New Here ,
Nov 03, 2014 Nov 03, 2014

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();

}

TOPICS
ActionScript
149
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 03, 2014 Nov 03, 2014
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines