• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

flash simple button with text

Hello experts,

I have a simple Button in Flash cs5 - as3 called btn1 with a dynamic text called text_txt inside inside it.

The goal is simply to change the text BUT..

btn1.visible=true; // works fine
this.btn1.text_txt.text="hello"; // give a NULL error

My question is: how to programatically change the text that is inside that button ?


0
yarekGmail
Asked:
yarekGmail
1 Solution
 
dgofmanCommented:
btn1.label = "hello";
0
 
yarekGmailAuthor Commented:
I have this issue not with  a button component but a button movieclip.

Create a rectangle. Press F8 and coose  button
Edit thr buuton and add a text.

Regards
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Jeremy DaleySenior DeveloperCommented:
Unless I'm wrong on this, I don't believe chlidren of a "SimpleButton" object are dynamically accessible. Instead you should make it a MovieClip symbol, and manually create all of the rollOver/rollOut behaviors with Actionscript.

Putting a dynamic TextField inside of a MovieClip IS accessible, so I would recommend doing it that way.
0
 
blue-genieCommented:
i agree with Daleyjem.
either create your own button class to extend the movieclip or make it a basic movieclip with the up/over etc frames, and add listeners to trigger the states
shout if you need an example
0
 
Jeremy DaleySenior DeveloperCommented:
Just curious why you accepted the answer from blue-genie when he was just agreeing with what I put first... Shouldn't I at least get some points for this?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now