3 Replies Latest reply on Oct 17, 2007 10:34 AM by schefz

    button instance not performing correctly

      i have a button that when it is held down for over 2 seconds it will jump to a frame, and jump to a different frame if just pressed and not held down. I have the code working, I am trying to apply it to an instance of another button(named fwd1). If i drop the actionscript in the first frame of my actions layer it works, but not just for the frames where the button instance is defined as fwd1, but all frames of the button that aren't given an instance name. If I give the button an instance name other that fwd1 somewhere on the timeline, then the button wont work on any frame past that point, even if i setup a keyframe and add the fwd1 instance to the button somewhere farther down the timeline. Isn't the point of button instance names to allow you to code them differently on different frames but not have to create a different button?? Should I just create a new button??
      thank you for any insight into this matter..
        • 1. Re: button instance not performing correctly
          i cudn't grasp all the things that u ve written but whateva i ve understood based on that i can give the explanation...probably it ll help u ....C when u ve a button on first frame and u provide it an instance name on frame 1 and ur timeline spans 100 frames then the button will ve that instance name for those 100 frames until and unless u change the instance name by creating a keyframe sumwhere in middle and renaming it. From that keyframe onwards that button ll b known by the new name...
          As far as i cud understand ur problem..if u want the button functionality to be available only on the frame where u ve given ur button a name and not after that u need to create an empty keyframe in ur actionscript layer right after it ( for eg if u ve a button on frame 1 and a code defines its functionality in action layer frame 1 then u need to create an empty keyframe on action layer frame 2)..this ll make sure that after that particular frame the button has no actionscript targeting it...After this empty keyframe now u can create another keyframe in action layer ( say for eg at frame 50 ) to give ur button another functionality and that functionality will remain with the button untill and unless u create another empty keyframe or a keyframe with different code..
          • 2. Re: button instance not performing correctly
            tegnegi Level 1
            Hey another important concept i forgot to tell u which is very much connected to ur problem is that whenever u give a frame scripting targeting sum button or movieclip then always remember that at the time of defining the code the targeted movieclip or button must ve existed otherwise ur code wont work...

            For eg u ve a code on frame 5

            but ur button instance name is defined at frame 10. it wont work because when the code was written it didnt know what is but1..therefore in ur problem when u remaned ur button to sumthing else and again later u changed it back to original name at sum far away frame it wont work because u ve redefined the name of the button though original but flash will consider as a new name i.e remaning a button....
            • 3. Re: button instance not performing correctly
              schefz Level 1
              thank you, that did help me clear things up.