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

Textbox trigger interactive event

Community Beginner ,
Jan 03, 2023 Jan 03, 2023

I am having problems in making the whole text-box interactive. I want that a picture and a new text-box appear by clicking on another text-box. I only manage to do it by clicking precisely on the letters of my text-box. What I need is, that I can click on something like an outline for the interactivity to trigger, so the click doesn't need to be precise on the letters.

 

Thank you in advance.

551
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 , Jan 03, 2023 Jan 03, 2023

create a movieclip

add your textfield

draw a transparent or stage colored rectangle behind your textfield

 

add your movieclip to the main timeline

Translate
Community Expert ,
Jan 03, 2023 Jan 03, 2023

create a movieclip

add your textfield

draw a transparent or stage colored rectangle behind your textfield

 

add your movieclip to the main timeline

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 Beginner ,
Jan 03, 2023 Jan 03, 2023

Thank you very much for your response.

I just tested it and it workes exactly like I wanted it to.

 

Thank you very much and have a good day.

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 ,
Jan 03, 2023 Jan 03, 2023

you're welcome. (and happy new year!)

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 ,
Jan 03, 2023 Jan 03, 2023

Hi.

 

@kglad's approach works but you cannot use a full transparent shape to detect mouse events.

 

So an alternative would be to turn the text field into a button and move the rectangle to the Hit frame.

 

Regards,

JC

 

EDIT: if you're on as AS3 document, @kglad's approach is going to work. Sorry for not having asked for the document type first.

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 ,
Jan 03, 2023 Jan 03, 2023

you can with as3.  oops, i see your edit.

 

with html5, use an alpha of 1% and/or stage colored.

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 ,
Jan 03, 2023 Jan 03, 2023

Yeah, generally 1% is fine, but I have already faced situations in which even this low value didn't work. And using an alpha bigger than 0 feels like an workaround for me anyway.

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 Beginner ,
Jan 03, 2023 Jan 03, 2023

Hi

Thank you for the Response. Since I use HTML5 and have a colored stage this shouldn't be a problem.

But I realized, now i have a new problem. Before I was able to change the color by clicking on the text field. Now my code in the action panel doesn't work for it. I suppose, it's because it's not a text-field anymore but a movieclip. Do you know if it's possible to be able and change the color again?

Before I just changed it with this code:

 

var _this = this;
_this.Text_1.on('click', function(){

_this.Text_1.color = 'black';
_this.Text_2.visible = true;
});

 

Thanks in advance.

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 ,
Jan 03, 2023 Jan 03, 2023

double click that movieclip and you'll be on its timeline where you can edit the textfield, or if you want to use code, assign the textfield an instance name on the movieclip timeline (eg, tf) and use:

 

this.Text_1.tf

 

to reference the textfield (assuming the parent movieclip is the Text_1 instance).

 

 

var _this = this;
_this.Text_1.on('click', function(){

_this.Text_1.tf.color = 'black';
_this.Text_2.tf.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
Community Beginner ,
Jan 05, 2023 Jan 05, 2023

Thank you very much for your help. I tried it and it works perfectly fine.

Wish u a great day.

Greetings HSS

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 ,
Jan 05, 2023 Jan 05, 2023
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