9 Replies Latest reply on Jun 30, 2009 10:39 PM by kglad

    Movie clip as button label

    ns ami

      Hi,

       

      I need to place a lot of buttons in the scene with different labels. I have created one button (not ui component). It is having custom look and feel. And I have placed many of the instances of this button in the scene.

       

      Now I need to add different labels two each button. These labels are not simply some texts, but movie clips.

       

      So how can I place these labels to each button? Placing an empty movie clip and calling attachMovie in action script failed...

       

      I am not sure how to achieve my requirement. If needed, I can give more explanation about the requirement.

       

      Thanks in advance.

        • 1. Re: Movie clip as button label
          kglad Adobe Community Professional & MVP

          if you need to add some text, add a dynamic textfield and give it an instance name, say tf.  you can then use:

           

          yourmovieclipInstance.tf

           

          to reference your textfield where yourmovieclipInstance is the instance name of your movieclip button.

           

          if you need to add a movieclip, with load a swf into a child target of your button movieclip or use attachMovie() to attach a library movieclip that has a linkage id which you use in attachMovie's first parameter.

          • 2. Re: Movie clip as button label
            ns ami Level 1

            Thank you for the reply.

             

            But I am not sure how to add the movieclip holder (with which I call .attachMovie) to the button. If I add it the UP location of the button, I cannot access it. What I need to do is attach the movieclips in the Library (with Linkage ID specified) to each buttons from the scene using AS.

             

            Example:

            In action script,

            myBtn1.myLabel_mc.attachMovie( "myLabelClip1_ID", ........ );

            myBtn2.myLabel_mc.attachMovie( "myLabelClip2_ID", ........ );

             

            So could you please suggest me a little more better?

            • 3. Re: Movie clip as button label
              kglad Adobe Community Professional & MVP

              you can't specify which frame to attach a movieclip dynamically.  if you want to add different movieclips to your button's up,down,over etc frames, add the movieclips in the authoring environment.

              • 4. Re: Movie clip as button label
                ns ami Level 1

                Thank you for the reply.

                 

                I am sorry. I cannot understand. Could you please make it more clear?

                • 5. Re: Movie clip as button label
                  Ned Murphy Adobe Community Professional & MVP

                  If you want to have code interacting with the contents of the buttons (such as loading movieclips into them dynamically) you have to create the buttons as movieclip symbols, not button symbols.  Otherwise, you will need to place whatever they need inside them in the editing mode.  Button symbols have a limited set of properties and methods, but movieclips support what you are trying to do.

                  • 6. Re: Movie clip as button label
                    kglad Adobe Community Professional & MVP

                    how many movieclips do you need to attach to a given button?  do you need to attach one movieclip to the up frame and a different movieclip to the over frame?

                    • 7. Re: Movie clip as button label
                      ns ami Level 1

                      Oh... I see. Thank you.

                       

                      When I put a movieclip named label_mc inside the button (inside the up frame movieclip), and called the trace( label_mc ); then I found that there is one unnamed instance (instanceX) between the button and the movieclip. Something like ....myButton.instance9.label_mc.

                       

                      Btw, I have to do more as per your answer. Creating a custom button like that Button UIComponent isn't possible?

                      • 8. Re: Movie clip as button label
                        ns ami Level 1

                        Only one movieclip is needed for one button and there is no need to have different kind of them on Up, Over, and all...

                        • 9. Re: Movie clip as button label
                          kglad Adobe Community Professional & MVP

                          then use attachMovie() to attach a library movieclip to your movieclip button.