Monday, March 29, 2010

changing text by clicking a button

I have a movie clip with 20 different color swatches that are
buttons. I want someone to click on any of the swatches and for the
color of the swatch to be displayed in a common text field. Can
anyone help me.changing text by clicking a button




relief8 wrote:

%26gt; I have a movie clip with 20 different color swatches
that are buttons. I want

%26gt; someone to click on any of the swatches and for the
color of the swatch to be

%26gt; displayed in a common text field. Can anyone help me.



Lots of ways to achieve that. Easiest would be to assign some
variable to each

button followed the dynamic text field instance name. On
press it will set whatever

is that you want it to say and change with every click.





--

Best Regards



Urami





--



Beauty is in the eye of the beer holder...





%26lt;urami%26gt;

If you want to mail me - DO NOT LAUGH AT MY ADDRESS

%26lt;/urami%26gt;

changing text by clicking a button
Can you give me an example of what the script would look like
in the dynamic text field and also in the button?
buttonInstanceName.onRelease = function(){

textvar = ''red''; //make this whatever you want

}



On the main timeline create a textbox, make the text dynamic
in the properties window, and set the variable to be textvar



Sample:


http://www.johnkalnin.com/flashhelp/DynamicText.html

File:


http://www.johnkalnin.com/flashhelp/DynamicText.fla
Thanks, but I am now getting this error mesage.



Symbol=swatchesPro, Layer=Swatches, Frame=10: Line 32:
Statement must appear within on handler

black.onRelease = function(){
You are attaching the code to the button, which is incorrect.
You have to attach that code to the frame itself, not the
button.

No comments:

Post a Comment