| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Snarfarious
Join Date: Jan 2002
Posts: 203
|
I have been in the habit of making buttons with a dynamic text field. This way assigning a value to the var property of the text field would allow me to reuse the button symbol and assign different text to each.
In AS3 it looks like the text field Var property does not exist any longer. Does anyone have a suggestion for a work around? I would like to avoid having to make a new symbol for each button. The var property worked well because it allowed you to change the text field on different frames of a movie clip button. If each text field had the same Var name it would display the same text label. |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Jul 2007
Posts: 7
|
take a look at my posting earlier today. you may have a suggestion on how to solve my problem while you get what you need.
|
|
|
|
|
|
|
|
|
#3 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
give the text field an instance name You shouldn't have been using the var property since flash 5!
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#4 |
|
Snarfarious
Join Date: Jan 2002
Posts: 203
|
Thanks for the reply. This is not a good solution. Using the TextField.text property doesn't allow you to create a label at frame the button may display.
For example, let's say you have a movie clip button with a text field inside. the text field is on a layer with two key frames. One key frame at the _up frame and another at the _over frame. This allows you to adjust the color and other properties of the text field for the rollover effect. The text field is dynamic and has myLabel set as the var. Setting the myLabel property of the container movie clip allows the text field to display the value at all of it's key frames. Using the text property, the text field loses it's assigned text when go to the next key frame. Another thing I noticed is that a button with a text field inside doesn't show the finger or the rollover when you are over the text field. |
|
|
|
|
|
#5 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
maybe not a good solution, but it is your only one
![]()
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#6 |
|
Snarfarious
Join Date: Jan 2002
Posts: 203
|
What do you mean? Which solution is not good and what do think is a better solution?
|
|
|
|
|
|
#7 |
|
Site Contributor
|
soggybag,
Here's a solution for you (attached). Hope it helps. Inside the button, the lines: ActionScript Code:
...will allow the movie clip to behave as a button, and the second line will cause the hand cursor to still show over the top of the dynamic text box. There's always a way to accomplish what you want, and the var box is gone from the properties inspector, anyway. It wasn't a really great idea to begin with. Why not? Because it allowed you to set a variable, but do it in a kind of hidden way, so someone else viewing your file (or you two months or so down the road) might have difficulty finding the darned thing. That makes it hard to figure out how something works. |
|
|
|
|
|
#8 |
|
Site Contributor
|
I was wondering what you meant by the text field not retaining the text on it's different keyframes. If you want it to always retain the text you assign it, don't give it different keyframes, just one. Then fill the rest of the space with frames (F5).
|
|
|
|
|
|
#9 |
|
Snarfarious
Join Date: Jan 2002
Posts: 203
|
Thanks for the reply.
I have already used the buttonMode property. The mouseChildren property I had seen. This fixes the problem with the text field taking focus. The problem with only adding frames is that the text can not change. If you've designed a button where the style of the text changes you'd need a key frame. Imagine you have a movie clip that you've set up as a button using the _up and _over frames. At the _up frame your text field shows the button label in black. At the _over frame you'd like the color to be red. Using the text property you'd need to add some cumbersome actionscript to set the text property when ever your button changed frames. Using Actionscript to dynamically generate or modify the text field is in-flexible. You'd have to rewrite the code if the design changed. You also have to write extra code. Using the var property of the text field allows you to make a button that can display any text in any style at any key frame within the button movie clip. Modifying the look of the button is as easy as editing the text field. Making a button like this allows you to make a button that can be used anywhere in your movie with any label you might need. This way you make a single clip to cover all of your button needs. There must be a solution in AS 3. |
|
|
|
|
|
#10 |
|
Site Contributor
|
Ok, I see more clearly now what you mean. Interesting. I'll be working on it.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HTML.txt ----> dynamic text box | jerryCLEMENT | ActionScript 2.0 | 3 | 09-23-2009 06:56 PM |
| Loading in external text vars from dynamic buttons | designues | ActionScript 2.0 | 4 | 11-29-2006 11:21 PM |
| sending multiple 'loadvariables' to 'dynamic text' | Yorgo12345 | ActionScript 1.0 (and below) | 6 | 03-22-2005 12:26 PM |
| If anyone's bored, a custom class . . . | retrotron | ActionScript 1.0 (and below) | 22 | 05-24-2003 11:01 PM |
| dynamic text, anchors, and images | spoonyg | ActionScript 1.0 (and below) | 7 | 11-26-2002 10:08 PM |