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

Actionscript 3.0 when button is pressed twice turns on/off

Guest
Jun 01, 2013 Jun 01, 2013

Alright I am new at actionscript but what I wanna do is when my button it is pressed once it brings up my input text("hiddentext") and when its pressed again it will remove it.

here is what I got.

button1_btn.addEventListener(MouseEvent.CLICK, shoot_1);

function shoot_1(event:MouseEvent):void

{

          gotoAndStop("hiddentext");{

and shoot_1 is just the identifier to make them work together.

Message was edited by: dogmer punchy

TOPICS
ActionScript
379
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

correct answers 1 Correct answer

LEGEND , Jun 01, 2013 Jun 01, 2013

A nice clean way of dealing with this is to put the text inside a movieclip and control the visibility of the movieclip with the button, toggling it to be the opposite of what it currently is.  If you were to assign an instance name to that movieclip like "hiddenText", the code for toggling it could be...

button1_btn.addEventListener(MouseEvent.CLICK, shoot_1);

function shoot_1(event:MouseEvent):void

{

          hiddenText,visible = !hiddenText.visible;

}

The use of the " ! " tells it to be what it is

...
Translate
LEGEND ,
Jun 01, 2013 Jun 01, 2013
LATEST

A nice clean way of dealing with this is to put the text inside a movieclip and control the visibility of the movieclip with the button, toggling it to be the opposite of what it currently is.  If you were to assign an instance name to that movieclip like "hiddenText", the code for toggling it could be...

button1_btn.addEventListener(MouseEvent.CLICK, shoot_1);

function shoot_1(event:MouseEvent):void

{

          hiddenText,visible = !hiddenText.visible;

}

The use of the " ! " tells it to be what it is not.

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