Learn about using the load and reveal command in this Flash Professional 8 advanced training video series.


More DIY videos at 5min.com

Video Transcription

Now, let us setup a little bit more of that button behavior. I want to go after the role over and the roll outs on this now. With our action script in most of the cases before this, we have set our action script up in the key frame and that is generally my preferred location for most of the action script. My personal choice when I am using screens is to actually place the action script on the screen itself. Now, it is up to you. You can actually put it up in the timeline if you want to un-frame one or you can do it in the screens. The past structure might be a little bit different so you just got to choose where you want to put it. Let us go ahead and try to put some on the screens and I will go over what it takes to use action script from that location. With that in mind, I am going to select the main menu as the position for the script that contains my button functions because that is where the buttons are located right there on the main screen. So, I will select it, will bring up our actions window and we will get things started. Now, the very first thing you will have to deal with is I cannot just put action script floating in this window. I cannot just start typing action script. I need some kind of an event to cue it off. As a matter of fact, the only place that you can put action script in your program without using an event is on a key frame on the timeline. So, that is what we have been using before. Here, I am going to need some kind of on handler and I will need some event to cue it up to. Now, screens are interesting because they actually have quite a few events available to them and these are events that are not available to movie clips or some other types of items in the program, which is also why I tend to use screens a little bit more than movie clips whenever I can. The two events that are probably most interesting to us are load and reveal. Now, load is a one time event and that is what I am going to use in case. It happens at the beginning of the movie when all of the contents to that screen load up into memory. The reveal event actually occurs every time the screen appears on the screen. So, if you want to have something recurring or starting back over anytime the screen first shows up, you can use the reveal event. If you want to have it one time, you can do the load event and you can do that with any screen that you are working on. Setting up a load event like this, I will need some grouping braces so we will start it off with our braces and now, inside here, we can put any kind of script we would like just like we did on the key frames before. I am going to setup a couple of quick event handlers for our buttons and I will just start with the home button first. Now, we are right inside the screen with our action script and so as our button. Our button is located right in the main timeline of the screen. So, a relative path to that button should be just the name. So, we will type in home and we can add in an event handler. Let us do an on roll over, and there we go. We will set that equal to a function, of course we will the rest of the syntax for that and our open braces and close braces for the function. And in our function, what I would like to do is just a very simple roll over. Now, obviously, you can do something more sophisticated but I am going to target the dynamic text field that is located inside of our home button. Now, the path to that would be this, because we are starting at the home button itself and I will go down a level to txtlabel, that is the name of our dynamic text field. We will take a property of this and just change it. And I am going to take the text color property. Now, we originally set this to white using our text format but using the text color property, I can go and directly modify the color of the dynamic text field itself. Now, this started out as white and I would like to just darken them up a bit so that we have a little bit of a difference between the normal resting state of the button at white and the roll over. So, let me just specify a color with zero X and I thi