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

Show text on mouse click, hide on click

New Here ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

I'd like to show a block of text on a mouse click, but the add with wizard function for this doesn't seem to work. I'm guessing that's because I need to specify that it's hidden first, then comes the reveal on mouse click, then the hide on mouse click. I'm sure this is ultra simple. I'm brand new (clearly). Thanks!

Views

611

Translate

Translate

Report

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 ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

right click your text and click convert to symbol > movieclip and assign it an instance name.

what's the instance name of that text containing movieclip?

what do you want to click to show that t?

as3 or js?

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

There's no movie involved. I just want to click on something or press a button or symbol next to it, and show text. Javascript is preferable, in the HTML file. I need to use this on Squarespace, so I only get an add code box. Thanks.

Votes

Translate

Translate

Report

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 ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

you need to convert your text to an object so it can be referenced with code.

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

I see convert to symbol or bitmap. I guess symbol?

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

I'm able to make it do other things, like move. I can have it hidden to begin, but the on mouse over or click doesn't do anything.

Votes

Translate

Translate

Report

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
LEGEND ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

Here is a possible way to do it.

on off text.zip - Box

var root = this;

var change = true;

this.changeStatus.addEventListener("click", hideshow.bind(this));

function hideshow() {

    if (change) {

        root.myTxt.visible = false;

        change = false;

    } else {

        root.myTxt.visible = true;

        change = true

    }

}

Votes

Translate

Translate

Report

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
Explorer ,
Jun 06, 2019 Jun 06, 2019

Copy link to clipboard

Copied

Using your script, how can I incorporate createjs to make text fade-in when it becomes visible and fade-out when text goes to hide?

Thanks in advance:-)

Votes

Translate

Translate

Report

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 ,
Jun 06, 2019 Jun 06, 2019

Copy link to clipboard

Copied

this.text_movieclip.addEventListener("click", hideshowF); 

 

function hideshowF(e) { 

if (e.currentTarget.alpha>.5) { 

createjs.Tween.get(e.currentTarget).to({alpha:.01}, 1000)

} else { 

createjs.Tween.get(e.currentTarget).to({alpha:1}, 1000)

}

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 06, 2019 Jun 06, 2019

Copy link to clipboard

Copied

LATEST

resdesign  wrote

Here is a possible way to do it.

var root = this;

var change = true;

this.changeStatus.addEventListener("click", hideshow.bind(this));

function hideshow() {

     if (change) {

         root.myTxt.visible = false;

         change = false;

     }

     else {

         root.myTxt.visible = true;

         change = true

     }

}

Isn't your hideshow() functionally equivalent to this?

function hideshow() {

    root.myTxt.visible = !root.myTxt.visible;

}

Votes

Translate

Translate

Report

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 ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

read message 1.

Votes

Translate

Translate

Report

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
LEGEND ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

Your text needs to have an instance name then you can use the instance to hide it.

instance name: myTxt

var root = this;

// hide

root.myTxt.visible = false;

// show

root.myTxt.visible = true;

Votes

Translate

Translate

Report

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 ,
Jun 06, 2019 Jun 06, 2019

Copy link to clipboard

Copied

Always make sure you refer to your code snippets. Screen Shot 2019-06-06 at 3.55.41 PM.png

Votes

Translate

Translate

Report

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