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

Show and hide objects without timeline

Participant ,
Nov 12, 2018 Nov 12, 2018

Hi there,

I have a pretty straight forward problem.

I have 2 buttons. YesBtn and NoBtn.

Both buttons should show their respective answer.

YesBtn would reveal text 'yes this is correct' ("end" label), NoBtn would reveal text 'No this is incorrect' ("Incorrect" Label)

I tried doing this on the timeline - but it doesn't work the way I would like it to.

I want to be able to click either button respectively and not worry about where the person may be on the timeline - Hence, if I click on only 'yes' then I don't want the No Button to appear (it does due to timeline).

How could I go about showing and hiding (with opacity over a set time) without using the timeline?

Thanks!

1.2K
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

Community Expert , Nov 13, 2018 Nov 13, 2018

convert each text/background into movieclips (if they're not already movieclips), eg yes_ans and no_ans.:

then if as3, use:

yes_ans.visible = false;

no_ans.visible=false;

yesBtn.addEventListener(MouseEvent.CLICK,yesF);

noBtn.addEventListener(MouseEvent.CLICK,noF);

function yesF(e:MouseEvent):void{

yes_ans.visible=true;

}

function noF(e:MouseEvent):void{

no_ans.visible=true;

}

Translate
Community Expert ,
Nov 13, 2018 Nov 13, 2018

convert each text/background into movieclips (if they're not already movieclips), eg yes_ans and no_ans.:

then if as3, use:

yes_ans.visible = false;

no_ans.visible=false;

yesBtn.addEventListener(MouseEvent.CLICK,yesF);

noBtn.addEventListener(MouseEvent.CLICK,noF);

function yesF(e:MouseEvent):void{

yes_ans.visible=true;

}

function noF(e:MouseEvent):void{

no_ans.visible=true;

}

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
Participant ,
Nov 18, 2018 Nov 18, 2018

I'm using Html5 Canvas - but thanks big help.

Here's my personal solution.

this.yesAnswer.visible = false //sets the answer to be hidden

Also I found I can make simple tweens using TweenJS - can make things fade in and out instead of just appearing

createjs.Tween.get(target)

.wait(500)

.to({alpha:1, visible:true}, 1000);

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
Community Expert ,
Nov 19, 2018 Nov 19, 2018
LATEST

you're welcome.

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