Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

From after effects to flash poetry in motion graphics - part 4 docx
Nội dung xem thử
Mô tả chi tiết
4. Click OK to close the Advanced Settings area of the Flash Video Encoding Settings
dialog box. Click the Start Queue button to start the encoding process. When it finishes, quit the Video Encoder.
Adding and using alpha channel video in Flash
Adding alpha video to Flash is no different from adding any other video to the application;
it is what you can do with it that moves it from “regular” to “cool” on the Flash technique
scale.
1. Open a new Flash document, pull an FLVPlayback component from the
Components panel to the stage, and link the FLV created in the previous exercise to
the component.
2. Test the video, and you will see the black background you saw in the Video Encoder
preview is gone and the white background of the Flash stage is visible (see Figure 4-14).
Now that you understand how to create, encode, and deploy the video, you are probably
wondering, “What else can I do with it?” The answer is, “Quite a bit.”
When you encode the video, the alpha channel stays with the video and Flash reads it. This
means that Flash really isn’t seeing a video, it is seeing a series of colored pixels enclosed
within a shape. This is the key to playing with alpha video in Flash.
One of the most common shapes used for a Flash animator’s first Flash animation is usually a circle. Flash sees that circle as being no different from a video. It is a circular shape
filled with colored pixels. In Flash 8, developers and designers were handed a rather serious set of effects and blend modes that can be applied to objects in movie clips. Knowing
how Flash sees a video with an alpha channel and that effects and blends can be applied
to movie clips, it doesn’t take a degree in rocket science to come to the realization that
alpha video, placed in a movie clip, allows you to apply the Flash blends and effects to the
video. Here’s how:
Figure 4-14.
An alpha channels removes the
background in a video.
If you are going to be encoding an alpha channel video, you must use
the advanced encoding settings.
FROM AFTER EFFECTS TO FLASH: POETRY IN MOTION GRAPHICS
130
7486CH04.qxd 11/7/06 3:07 PM Page 130
1. With the Flash file open, right-click (PC) or Cmd-click (Mac) the component on the
stage and select Convert To Symbol from the Context menu. When the Convert To
Symbol dialog box opens, name the symbol Shadow, and select Movie Clip as its
Type. Click OK.
2. Click the component on the stage to select it and click the Filters tab in the
Property inspector.
3. Click the + sign once in the Filters tab to open the Filters pull-down menu. Select
Drop Shadow.
4. Change the Quality setting to High and test the movie. The talking head now has a
shadow (see Figure 4-15).
In this next exercise, you will apply a blend mode to the video. That major difference here
will be the use of a video object, not the component, in the movie clip. This way you can
see that the blends and effects can be applied to video playing through the video object,
not just the FLVPlayback component. The interesting area of intersection between both
techniques is the use of a movie clip to stream the video.
1. Open the Blend.fla file found in the Blends_Filters folder of your Chapter 4
Exercise folder.
2. Select the video object on the stage and, in the Blend pull-down on the Property
inspector select Screen (see Figure 4-16).
When you apply a filter or blend to the FLVPlayback component, don’t get alarmed
when you see the effect or blend applied to the entire component on the stage. The
component is seen as the object until the Flash Player takes over.
Figure 4-15.
You can apply effects, such as a drop shadow,
to a video containing an alpha channel.
CREATING ALPHA CHANNEL VIDEO FOR FLASH
131
4
7486CH04.qxd 11/7/06 3:07 PM Page 131
Figure 4-16. The blend mode can be applied directly to the movie clip containing the video.
3. Test the movie. The video looks somewhat ghostlike.
You don’t need to use the Filters or Blend pull-down to apply these effects. They can just
as easily be applied through the use of ActionScript. Let’s apply the screen mode using
code. Here’s how:
1. Open the Blend_AS.fla file in your Chapter 4 Exercise folder. The only difference
between it and the file you just used is the inclusion of an Actions layer, and the
symbol on the stage has been given the name of mcMyVid.
2. Select the first frame in the Actions layer and open the ActionScript window. Click
once in the Script pane and enter the following code:
mcMyVid.blendMode = "screen";
3. Save and test the movie.
As you can see, applying a blend mode is really quite simple. All you need to do is identify
the movie clip to which the blend mode will apply, apply the blendMode property to each
pixel of the movie clip, and then identify the mode. You can also use a number for the
mode instead of the name. In this instance the code would be
mcMyVid.blendMode = 4;
If you are wondering where the code that drives this video is located, doubleclick the video’s movie clip in the Library.
FROM AFTER EFFECTS TO FLASH: POETRY IN MOTION GRAPHICS
132
7486CH04.qxd 11/7/06 3:07 PM Page 132
Here is a list of the modes and their integer values:
"normal" or 1
"layer" or 2
"multiply" or 3
"screen" or 4
"lighten" or 5
"darken" or 6
"difference" or 7
"add" or 8
"subtract" or 9
"invert" or 10
"alpha" or 11
"erase" or 12
"overlay" or 1
"normal" or 13
"hardlight" or 14
Applying a filter using ActionScript is a bit more complicated than tossing a blend mode
onto a movie clip. Filters have their own class in ActionScript, and, to apply a filter, you
have to import the class and then apply the filter.
When you first apply the filter, you are going to be prompted to enter what seems like a
confusing number of values as the parameters for the filter. They really aren’t that confusing because they are exactly the same values you would enter in the Drop Shadow filter
menu (see Figure 4-17). The only difference is the boxes requiring you to add a check
mark will have a value of True or False in the code.
Figure 4-17. The parameters in ActionScript and the dialog box are an exact match.
Be aware the order of the modes and the integers doesn’t follow that in the Blend
pull-down. If they did, the integer value for hardlight would be 8, not 14.
CREATING ALPHA CHANNEL VIDEO FOR FLASH
133
4
7486CH04.qxd 11/7/06 3:07 PM Page 133
Here’s how to apply a Drop Shadow filter to the video using ActionScript:
1. Open the Shadow_AS.fla file in your Chapter 4 Exercise folder.
2. Select the first frame of the Actions layer and open the ActionScript Editor.
3. Enter the following code:
import flash.filters.*;
This line imports the entire filter package into the Flash Player. This leaves you the flexibility to apply multiple filters to a video without having to import each one, as you need it.
4. Press the Return/Enter key and add the following line of code:
var ds:DropShadowFilter= new DropShadowFilter(20,45,0x000000,.8,15,➥
15,1,3,false,false,false);
What you have done is to give the filter a name and created a new instance of the filter.
Let’s go through this to help you understand what you did.
The first thing you may have noticed is the tooltip (shown in Figure 4-18) that appeared
when you pressed the bracket key. This tooltip gives you the order of the values to be
entered and the type of value to be entered.
distance: The distance for the shadow, in pixels.
angle: The angle of the shadow; the values range from 0 to 360.
color: The hexadecimal color of the shadow.
alpha: The alpha transparency value of the shadow. Values are any number between
0 and 1. In this example, the .80 means the alpha value is 80% transparency.
blurX/blurY: The horizontal and vertical blue values.
strength: The strength of the shadow’s spread. The higher the value, the more
contrast there is. Valid values range between 0 and 255.
quality: The quality of the shadow. 1 is low quality. 2 is medium quality. 3 is best
quality.
inner: Determines whether the shadow is an inner shadow. Values are either True
or False.
knockout: Applies a knockout effect if the value is True.
hideObject: If set to True, the video is hidden, but the shadow isn’t.
If you are going to use a code-based approach to using a filter and are unsure
what the final result will be, use the dialog box to set the values, and, if they are
what you are looking for, write them down.
FROM AFTER EFFECTS TO FLASH: POETRY IN MOTION GRAPHICS
134
7486CH04.qxd 11/7/06 3:07 PM Page 134