Skip to main content
eugener2418576
Inspiring
November 13, 2018
Answered

Show and hide objects without timeline

  • November 13, 2018
  • 3 replies
  • 1205 views

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!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer kglad

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;

}

3 replies

eugener2418576
Inspiring
November 19, 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);

kglad
Community Expert
Community Expert
November 19, 2018

you're welcome.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 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;

}