1 Reply Latest reply on Jul 24, 2006 5:06 PM by Newsgroup_User

    Buttons

    Tomas_Srna
      I have a very simple problem but for me it is very difficult to solve. I have created a button with a dynamic text caption. It is in library. The var of the text is "text". I created 2 instances in my scene. One named "btn1" and the other "btn2". I have tried Actionscript: btn1.text = "Button 1"; btn2.text = "Button 2". This didn't work. After hours of anger I realized that when I write Actionscript: text = "Button 1"; It changes the text... But here comes my problem. It changed the text of both buttons. I have also noticed that when I change behavior to MovieClip, the first method works. But they have to be buttons.

      Finally, my question: Is there any way to change captions for each instance of buttons separately using actionscript?

      Thanks.
        • 1. Re: Buttons
          Level 7


          Tomas Srna wrote:
          > I have a very simple problem but for me it is very difficult to solve. I have
          > created a button with a dynamic text caption. It is in library. The var of the
          > text is "text". I created 2 instances in my scene. One named "btn1" and the
          > other "btn2". I have tried Actionscript: btn1.text = "Button 1"; btn2.text =
          > "Button 2". This didn't work. After hours of anger I realized that when I write
          > Actionscript: text = "Button 1"; It changes the text... But here comes my
          > problem. It changed the text of both buttons. I have also noticed that when I
          > change behavior to MovieClip, the first method works. But they have to be
          > buttons.
          >
          > Finally, my question: Is there any way to change captions for each instance of
          > buttons separately using actionscript?
          >
          > Thanks.

          in theory you can't target flash button timeline and its content.
          It's not working the way movie clip do.

          Instead of using instance name use variable name.
          On stage place

          bt1="something";
          bt2="more text";

          than inside the button, dynamic text with VARIABLE name _parent.bt1 or _root.bt1
          The trick is that you make the button look out for variable outside of the button
          instead of trying to pass it to the button directly.


          --
          Regards

          Urami


          --



          Happy New Year guys - all the best there is in the 2006 :)




          <urami>
          http://www.Flashfugitive.com
          </urami>

          <web junk free>
          http://www.firefox.com
          </web junk free>