?
Solved

flash simple button with text

Posted on 2011-04-30
6
Medium Priority
?
281 Views
Last Modified: 2012-05-11
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
Comment
Question by:yarekGmail
6 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 35499361
btn1.label = "hello";
0
 

Author Comment

by:yarekGmail
ID: 35500382
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35507918
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
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 35515085
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
 
LVL 4

Expert Comment

by:Jeremy Daley
ID: 35807822
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question