Creating a TextField
Creating our first TextField and at the same time creating our first visual display element. we will see how we can give our TextField a name and how we can talk to it through our main class.
Video Transcript
00:00Let's create our first child. So if I just go back into my mainFLA and let's see a really really simple example of a child
00:07I'm just going to grab a text field and a reminder again when we're in our FLA
00:11We're actually inside of our main.as because our class is linked onto our mainFLA
00:17Thus if we throw things onto our mainFLA, they'll be available to our main class
00:23Okay, so for example, if I'm just going to grab a text field, which is a very simple
00:28Element and I'm just going to type here. Hello, and maybe we'll change the color to saying that's a little bit more visible such as
00:36black
00:37Alright, so we already have a text field now
00:40Flash, you know, it might be hard for us to recognize actually how to approach it and to be able to approach it
00:46We want to give our
00:48Visual element that's on the stage right now
00:51We want to give it a name and it's quite easy to give it a name now that we have it already selected
00:56You can see that the blue outline is selecting our text field
00:59I could switch to my error if I want if it want if I wasn't selected so I could click on it and select it
01:05Or you could type in the V always to go back right because that's a really important shortcut because you're going to use it quite often
01:11So no matter where you are
01:13You could always type V on your keyboard and it would take you to the selection tool enabling you to select
01:18And you want to first select your text field
01:21Fantastic. So we have our text field selected the next step. We want to go to our properties panel
01:28Here's my properties pal. And again, just as a reminder if you lost your properties panel, you could always go to your window
01:33Search for your properties panel click on it and it will show up
01:37it might not look a hundred percent exactly the same as mine it really depends on the version of flash that you're running and
01:42The different layout settings which we talked about in previous courses
01:46Alright, so first of all, we see our text field and there's a lot of different properties which we're not really getting into right now
01:52But I do encourage you to play around with them
01:54All right
01:55Now the only thing I want to talk about right now is these two elements now if you're running on CS5
02:00You first want to make sure that we're working with classic text. All right, and we're working with classic text
02:05I just want to give my classic text a name. So I'm going to give it that
02:10Hungarian notation old Bulgarian notation, whatever it is
02:13which means we're going to give it a shortcut name of TXT that stands for text because it's a text field and
02:20Then we're going to give it a name
02:22We're going to call it text. Hello, because we know that there always be there some sort of hello message
02:26Alright, so we just created a name to our
02:30instance that's on the stage
02:32now another name that we could call an instance name is actually our
02:37Property name and we're going to see what that means in a second
02:40so our instance name and there's a lot of different terminologies and as you go if you read of other materials online or as you
02:46The biggest thing you have to change that's not that challenging but getting used to is
02:50There's a lot of things that have different names that mean almost the same thing
02:55That for your point of view is the exact same thing until you learn about it or it's important to you
03:00so sometimes you're going to hear the word variable and other times you can hear the word property or
03:05instance name and
03:06They all kind of have a relationship between them
03:09So if I would call this a variable or I would call it a property or I would call it an instance name
03:14I'm basically meaning the same thing
03:17Now I want to make sure that my property is set to dynamic text now if by any chance you were previously in static text
03:25You wouldn't even have that option so sorry for that in advance if you were in static text
03:30Just make sure you're in dynamics text dynamic text and then give your text field a name of text
03:36Hello, and hit enter because sometimes depending on the version of flash if you don't then the name actually doesn't get saved
03:41I think CS5 they sorted that issue out
03:45Now obviously you could play around with the properties
03:47We're not going to get into that right now what I want to show right now is now that my text field actually has a name
03:52Which is text hello
03:54We could go and I'm just going to save that we could go and I'm going to save it into CS5. That's fine
04:01And we're going to go back into our main fla and in our main fla
04:04I just want to add one more trace, and I'm going to trace out the name of the new property
04:11We just created text hello. I'm going to save that and I'm going to run it
04:19Now it's giving me some sort of warning telling me that I didn't embed the fonts and that's fine because we're not worried about embedding fonts
04:24Right now, but if we look at the last last trace that we're going to see that it traced out our text field
04:30And that's exactly what we hoped it would do
