Color Flash Light For Flash MX
Ok.. To start off. Lets set up the Stage of the movie.
Set the Size of the stage to: width 400 by height 250.
Next thing, Lets create the layers. Create 4 Layers and Name them as the following:
- Actions (Top Layer) - ActionScript layer.
So, Now that we have these things set up. Let's go on to create the light source. What we're gonna do here is create a circle, this will turn in to our masked layer which allow us to see the layers below. (If that didn't confuse you, let's move on.)
Lock all layer execpt your 'Light Mask' layer. Now Select the layer and create a circle on the stage. The Color of the circle doesn't matter because when you make a layer a mask it will lose its color properties. When you create the Circle hold Down SHIFT while making the circle, Holding down SHIFT will allow the circle to keep a true circle form.
Next thing to do is to make the Circle a 'Grahpic Symbol'. To do this, Go To 'Insert > Convert to Symbol' you can also do this by pressing 'F8' while the circle is still selected. A Dialog box then will pop up (seen below). Name the new symbol 'light'. and set the behavior to 'Movie Clip'. then click 'OK'.
After you have created the New MC (Movie Clip) you will need to give it an instance name. To do this Locate the properties window, located below the stage area. Where it says '<instance name>' type in 'light'. We will see why we did this later on in the tutorial.
Now, Unlock the 'Text' and 'Images' Layer and lock the 'Light Mask' layer. Now you can add the Text and images you wish onto the stage. Make sure when importing your graphic and placeing your text that they are on the correct layers (example: Text goes in the 'text' layer and images/graphics go in the 'images' layer). I'm not going to go into much more detail when adding text and images, I asume you know how to import you images/photos.
Now that you have your Photos, graphics and text where you want them we can create the mask part. Don't worry if you want to change or add Photos, graphics and text in the future to this you can, by just deleting, moving or adding your text and images to the correct layer. The screen shot below is (simular to) what you should have.
Let's lock all the layer so that we don't create something we dont want
to in the layer.
Ok. So now we have created the mask layer. But, it still won't work. We need to add the Action Script. Lock all the Layers and Unlock the 'Actions' layer.
Select Frame 1 in the 'Actions' layer. To do this simply select the frame. Now we need to show the Action properties of this frame. Located at the bottom of the stage area, above the Properties is a bar Titled 'Actions'. click on the arrow to expand this window.
Now Under Actions. Click on the Actions tab thingy (seen above right). Then Click on Movie Clip Control then Double click on 'startDrag'. (Actions > Movie Clip Control > startdrag)
It will then place the following code in the Code Window: startDrag();
When you do this you should notice a small little dialog box (seen above) appear next to the code just place into it. This is a neat thing that macromedia added for Flash users (if you do other codeing i.e. C++, J++ (Java)) you understand what this is. This is called a "Code Hint". It helps the coder do the code correctly. so. Heres what its asking or hinting for you.
What you will see is: startDrag( target, lockcenter, l, t, r, b);
What these mean:
target - this is what will be moved, or affected. (In our case, this
will be our light. (this is were the instance name comes into play)
For our movie we will set it to the Size and height of the stage and lockcenter: true. So our code will look like:
startDrag(light, true, 0, 0, 400, 250);
The left and top are set at: 0.
So we now have the action script set. Are we done?
Ok, Two more things. One, We need to add a second frame for all the layers. Second we'll add a 'GoToandPlay()' action to the second frame.
First, to add the Second frame for the layers. Click and Hold on the 2nd frame in the 'Actions' layer, and drag downward to the 'images' layer. Now Right click on the selection you have made, and Select 'Insert Frame'.
Then on the 'Actions' layer frame 2, Right click and Select 'Insert KeyFrame'.
Now, with the 2 Frame of the 'Actions' layer selected Go to the Actions properties and Add a GoToandPlay() action.
Select 'Actions > Movie Controll > gotoAndPlay()
Again, you should see the 'Code Hint' box pop up. Where it says Frame,
simply put a 1.
Well, we're done now. So, save it. and Test it.