cancel
 

 

Job type :

Zip Code :

community forums

Featuring over 100 topics of interest to DoItYourselfers.

Flash Professional 8 - How to Use the TextField.text Property

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Video Transcript

Now, it seem that these two other objects have some similar properties to the movies clips we have been working on but we are going to be finding out a lot in the lessons to come by the each one of these elements has additional properties that are unique to it. For instance, let us take a look at a special property of the text field. We close these two backup here.

Now, let us go back to our trace statement. I am going to do a trace statements so we can test out the text property of a text field. Now, I would access that property the similar way that we use to access X and Y. only this property does not have an underscore infront of it.

I will just place in here "TXT Score", that is the name of our field. I use dot and we were looking for the text property. Now so far in this lesson, I am just been pulling this properties up. The ones you would probably familiar with but we are going to be finding out in the next lesson, how to find out what properties these elements have.

For right now, I would like to take a look at the help system and point out that we can get information about those properties if you would like to by selecting almost any kind of text you are typing to the script window and using the same help key that we did when we are using the reference books over here on the side.

You can see this pulls up, the text field dot text property and it has a few paragraphs telling you what that property is. Most of these help systems will also give you samples scripts and tell you what those scripts are going to do.

So, you can figure out how to use these properties. This is really helpful if you inherited a flash movie file with a lot of script in it. You are trying to figure out what the other person is coded into there. You can go directly out of the script itself and access the help system to find out what you are working on.

Now, let us see how is that going to work. I need a semicolon to end this line off and we just do a "Ctrl+Enter" or click enter on the Mac and test that out. And you can see that our last trace in output windows says, "placeholder". So, what we have done is we have access what is being typed into the text field.

Now obviously, this is a property that is not going not to work on movie clips because you cannot typed anything into a movie clip or a button. By seeing how these properties are working, we can set the text inside the field, just as easily as we can set an extra Y value.

Let us try that out. I am going to add another line to the script. I will put in text score, Txt score. I will use a dot and this time, I will put text property. Now, I am going to assign this to some specific string, very much like we did tracing messages earlier.

When I want to put something specific into the field, I need to use quotes surround it. So, that it will put exactly what I type in here. I will place some here text that says, "The score is" and a little colon after it. make sure you close up your quotes and this is the end of a line. So, I am going to put a semicolon here at the end of the line.

Now, the colon is inside the text. So, that is going to be placed inside that text property and the semicolon is part of the syntax's align. So, do not get those two mess up. What we should be able to test our movie, "Ctrl+Enter". And now, you can see that it no longer says ‘Placeholder"; it says "The score is:", that is exactly what we told to put in there.
Now, it seem that these two other objects have some similar properties to the movies clips we have been working on but we are going to be finding out a lot in the lessons to come by the each one of these elements has additional properties that are unique to... click to read more


Your Winter Home Checklist

sponsored articles of the day

diy centers

Research and explore a wealth of wisdom on these topics