A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: button code error 1021

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    10

    button code error 1021

    Im trying to enter code for one of my buttons so that it goes back and plays frame one on the main/parent time line.

    my button also on the main time line (can be viewed throughot the whole sequence).

    i used this code on the main timeline for the page 2 instance button


    stop();

    import flash.events.MouseEvent;

    page2.addEventListener(MouseEvent.CLICK,Rtclick);

    function Rtclick(event:MouseEvent):void {
    gotoAndPlay(1)
    }


    i get the error code

    Scene 1, Layer 'As3', Frame 1, Line 7 1023: Incompatible override.
    Scene 1, Layer 'As3', Frame 1, Line 7 1021: Duplicate function definition.

    what am i doing wrong? Seemed to work for my old project..

    i am using AS3

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You've defined two functions called Rtclick in the same scope. If they are doing the exact same thing, just delete the second one, since it's redundant. If they are not, change the name of the second one.

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    stop();

    import flash.events.MouseEvent;

    btn_2.addEventListener(MouseEvent.CLICK,mainClick) ;

    function mainClick(event:MouseEvent):void {
    gotoAndPlay(2)
    }

    i change the btn name and that seemed to fix it. this it the code i used for my button

    stop();

    import flash.events.MouseEvent;

    btn_2.addEventListener(MouseEvent.CLICK,mainClick) ;

    function mainClick(event:MouseEvent):void {
    gotoAndPlay(2)
    }

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center