Video Transcript
Now, let us leave it up as it is. We can access the values for a lot of these properties but we can also use action script to set the values of these properties as well. Let us give that a little bit of a try. I am going to close my output window and my swift file because I want to take a little bit of look of the screen here.
Now, if I have got that green square selected, we can see its X and Y values, we can see it is width and height. So, you might guess that we might have access to those properties as well. In fact we have access to a lot of movie clip properties.
Now, I am just going to pull some out right now for this lesson but we are going to be exploring what the properties are and where to find them in the later lesson. For right now, I would like to just move around some of these elements on the screen. Let us take the other graphic pieces that we have got here on the stage and make sure we have access to them in action script.
Now once again, if we click on something like for instance this photo of the mountains here in the background. You can see it shows up as a bitmap graphic and there is no name. If I already take this and make it into a movie clip, we have access to it as well. So let us do that, I will press F8. We will call it something simple like photo. I will leave it as a movie clip.
Now, this one I am going to set the registration in the upper left hand corner, that is going to be the top corner of the photograph there. And now, that I have made it into a Movie Clip. I am just going to give it a name as well. I will call it "mcPhoto" and we have got one other shape over here. I have got a cloud with a little bitmap fill inside of it but you can see it each showing up as a straight vector shape. Let us press F8 with selected as well. We will just call it cloud. I will leave the registration and the movie clip settings where they are and I will call this one "mcCloud", sort of a movie clip cloud.
Now, let us try our first element where we can move something around on the screen. What I would like to do, is I would like to take action script and make this photo a little bit bigger and kind of center in the upper portion of the screen here. I will bring my action's panel back up, I will be at the bottom of my script there and I just set and enter and create a new line.
Now, instead of tracing these elements, I will call off the name, the property, and I will use what we did before in setting the furry ball. Just set it equal to some other value. In this case, I want the photo. So, I am going to take "mcPhoto". I use a dot to separate the name and the value and in this case, I am going to take underscore X which is its X location on the screen. That is going to be out horizontal coordinate system and let me just set that equal to 60.
Now, if we take a look at this before we test our application, I will point out that the current location to this one is actually almost 60. So, we do not see much movement. Let us change the Y value as well. I will move it up a little bit here in the top corner. So, I will just add one more statement to this.
To access each one of the properties, I am going to do them independently of one of the others. So, I will just put another statement down here below "mcPhoto". We will do the underscore Y this time and we will set that equal to something very close to the top of the screen, 15.
Now, I will "Ctrl+Enter" then that "Command+Enter" on the Mac and let us try out. Now, I can see all the traces in my output window as before but you will notice that the photo has been pushed up to the left hand side of the screen and what we have find is that registration point, right there at the top is set to exactly 60 pixels from the left, that is my X coordinate and 15 pixels from the top, that is my Y coordinate.
Now, that was pretty neat. Let us try a few more elements so we can start gathering up some of these pieces on the stage. I am going to close both of those windows and let us add just a few more settings here. First of all for the photo, I would like to make it a lot bigger.
Now, let us leave it up as it is. We can access the values for a lot of these properties but we can also use action script to set the values of these properties as well. Let us give that a little bit of a try. I am going to...
click to read more