flash buttons q
- Started
- Last post
- 11 Responses
- kinetic
if you have a dynamic text field inside a button, how can you assign that field a value.
i have a button instance called test_button , inside that is a dynamic text field called test
so.. test_button.test.text = "hello"
should put hello in the text box..but it doesn't
any ideas?
- unfittoprint0
better:
#1 create a MovieClip button:
#2 inside it create a dynamic textfield, name it textBox.
#3 on the symbol's action layer write:
textBox.text = varText;#in the lybrary panel, right click the symbol, and enter xcomponent definition. use:
Label as the variable name
myVar as the variablethen everyytng you'll have to do is put your symbol in the stage, in the proeprties box click parameters and insert whatever text you want your button to be labeled.
- kinetic0
was thinking of using mcs....and having 3 clips, over down and pressed state.
thanks unfit :)
- unfittoprint0
you still can.
add 3 labels in your MC button ("out","over","down") with a stop action in each.
and include this actions inside it:
this.onPress = function(){
doaction(); //your action
gotoAndStop("down");
}this.onRollOut = function(){
gotoAndStop("out");
}this.onRollOver = function(){
gotoAndStop("over");
}
- kinetic0
badass! thanks unfit :)
- kinetic0
one thing..
i want it so if you push the button...that text goes bold..so the user knows that's what they're on.
if i say gotoAndStop("press"); .. when you rollOut , it will rollOut back to its original state.
any ideas?
- kinetic0
bah! nevermind...a simple var set and an if..
sorry
- unfittoprint0
you could set your textBox too ceive html properties and when you press:
this.onPress = function(){
this.gotoAndStop("down");
this.textBox.text = "[B]"+myvar+"[/B]",
}
- unformatted0
if you have mx 2004, you don't need to assign the onRollOver/onRollOut events.
just create the "_up", "_over", "_down" labels and assign the onPress { do stuff }
and it automatically treats it as a button.
you do need stop();'s though
- unfittoprint0
sorry it should read:
this.textBox.htmlText = "[B]"+myvar+"[/B]",
- kinetic0
wicked, thanks again mate :)
- ganon0
FYI "_up" "_over" "_down" labels works in MX too...