HOw can I add text to a dynamic text field on release when a button is pressed?
*Originally posted by :mike: *
**on release when a button is pressed? **
lol, do you want it on release or on press? anywho, try this:
mybuttonsinstancename.onRelease = function() {
mytextfield.text += "text to be added"
}
// OR
mybuttonsinstancename.onPress = function() {
mytextfield.text += "text to be added"
}
THANKS AHMED
another problem.
Is it possible to get it to change the text in a dynamic text field in another movie clip other than the button? If not, its ok
also, I expirimented a bit and couldn’t figure out this… I want it so after I release the button that adds new text it puts the other text in an new line
like say I use this code:
button.onRelease = function() {
text_field.text += "textHere";
}
and when I prewss the button 3 times it does this:
textHeretextHeretextHere
but I want it to do this when I press it 3 times:
textHere
textHere
textHere
button.onRelease = function() {
_root.text_field.text += "textHere";
}
I tried your code Yeldarb and nothing happens at all now, ill work with it, i musta done something wrong
instead of typing root.text_field try using the crosshair thing in the actionscript pane and at the bottom set it to dot and global
*Originally posted by :mike: *
**another problem.
Is it possible to get it to change the text in a dynamic text field in another movie clip other than the button? If not, its ok
also, I expirimented a bit and couldn’t figure out this… I want it so after I release the button that adds new text it puts the other text in an new line
like say I use this code:
button.onRelease = function() {
text_field.text += "textHere";
}
and when I prewss the button 3 times it does this:
textHeretextHeretextHere
but I want it to do this when I press it 3 times:
textHere
textHere
textHere **
then do this
button.onRelease = function() {
text_field.text = "textHere";
}
didn’t work
oh, didn’t see your post ahmed, one second ill try
yeh, i tried that, but it doesn’t put it on a new line, but this will do, thanks guys for your help!
*Originally posted by :mike: *
**another problem.
Is it possible to get it to change the text in a dynamic text field in another movie clip other than the button?
**
?
mike, regarding displaying the text on a new line each time the button is pressed, do the following:
- HTML enable the textbox (you can use AS to do this or you can just select the textbox and set it from the properties panel).
- Use this piece of AS instead of the current piece that you have been trying to use:
button.onRelease = function() {
text_field.text = "textHere< br >";
}
note: You need to remove the spaces between the br and the < and > in order for it to work.
If the textbox reads it as HTML, then it will process the line break tag and place it on a new line each time due to the previous HTML (or it should do :)).
Hope this helps,
JK.
To html enable a textbox via AS, this should work:
instancenameoftextboxhere.html = true ;
[AS]text_field.text = "
textHere";
//
text_field.text = “\rtextHere”;[/AS]
oh yeh! that would work! THANKS GUYS!!!
No problem.
By the way, I forgot to post this link…
http://www.kirupaforum.com/forums/showthread.php?s=&postid=122824#post122824