Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

8-Ball to Win: Great New Features Abound in Flash 8 : Page 3

Flash 8 may have just been announced but you don't have to rummage endlessly for the juicy details. This extensive review gives you a preview of all the great new features—for designers and coders alike—plus Studio pricing and more, all in one place.


advertisement
Runtime Filter Effects
Another feature that has gotten a lot of attention in Flash 8's pre-release period is the suite of realtime filter effects. When applied to MovieClips, effects such as drop shadow, blur, and bevel—traditionally reserved for bitmaps rendering—are rendered in real time by the Flash Player.


Figure 2. Choosing a Filter: Filter Effects can easily be applied using the new Filters tab of the Properties panel.
 
Figure 3. Detailed Settings: The Filters tab in the Properties Panel reveals the settings the for Drop Shadow effect.

Effects can easily be applied in the properties panel, using the new Filters tab, as seen in Figure 2. In Figure 3, you can see the settings for the Drop Shadow filter. Standard features such as the light angle, the offset distance, the opacity (strength) and spread (in this case, blur, variable in both the x and y directions) are included. You can even save presets of filters for later use.



Three variants of the traditional drop shadow are supported (see Figure 4). Knockout mode knocks out the shadow in the shape of the MovieClip being affected, without showing the clip itself. Inner Shadow creates a shadow on top of the clip being affected, as though it were cut out of the stage surface itself. Finally, the most intriguing variant, Hide Object, is the ability to show the shadow intact, without the clip being affected. That is, unlike the Knockout setting, the shadow is not affected. Only the main clip is hidden. Therefore, by duplicating the desired clip, once for the clip itself, and once for a shadow-only version skewed in perspective, you can render real-time shadows under animated objects.


Figure 4. New Shadow Effects: The Drop Shadow Filter Effect in normal, knockout, inner shadow, and hide object modes.
 
Figure 5. Animated Shadows: Filter Effects, such as Drop Shadow, can be animated in real time by the Flash Player.

Figure 5 shows the Hide Object variant in use. I've selected both MovieClips prior to the screen capture so you can see the normal clip without a filter applied, and the duplicate clip, with the Drop Shadow effect applied, using the Hide Object option. Since the shadow is just a copy of the animated clip, it changes along with the main visual making a realistic shadow that is surprisingly easy to achieve.

ActionScript Control over Filter Effects
The new flash object has a filters package that allows ActionScript control over filter effects. In simple terms, you can exert programmatical control over just about everything you can manipulate in the Filters Panel. Here is a very simple example for creating and applying a drop shadow filter.

var dropShadow:DropShadowFilter = new DropShadowFilter(4, 45, 0x000000, 100, 10, 10, 2, Quality.HIGH); myClip.filters = [dropShadow];

The first line creates a drop shadow filter object in the variable named "dropShadow." It defines the distance, angle, color, alpha, blur x, blur y, strength, and quality of the shadow, respectively. The second line applies the object you just created to the MovieClip "myClip." Because you can have more than one filter effect applied to a MovieClip at any time, the filters object is an array.

For example, you could add a blur filter this way:

var dropShadow:DropShadowFilter = new DropShadowFilter(4, 45, 0x000000, 100, 10, 10, 2, Quality.HIGH); var blur:BlurFilter = new BlurFilter(10, 10, Quality.HIGH); myClip.filters = [dropShadow, blur];

Figure 6. Darken Blend: The Darken blend mode allows you to take this overly enthusiastic coworker out to the park on a summer day—without having to edit the bitmap or create a PNG of the file before its use.

With ActionScript, you can also remove filters, enable and disable them individually or altogether, and change their rendering order (which usually changes the appearance of the clip).

Blend Modes
Blend modes are another familiar bitmap effect that can now be applied to MovieClips. If you've ever used Photoshop you've almost certainly used blending modes. They allow you to composite one layer into the rest of the document by only displaying those pixels that are darker or lighter (for example) than the underlying layers. (In Director, blend modes go by the name of Ink effects.)

A dozen or so blend modes including Lighten, Darken, Screen, Multiply, and Luminosity can be applied easily via the Properties panel or via ActionScript using the MovieClip.BlendModeType property. Figure 6 shows the Darken blend mode in use. On the left, the model is layered atop the sky background but with the default Normal blend mode in use. On the right, the Darken blend mode is applied to the model allowing the sky background to shine through. While I have not tested this myself, my assumption is that this approach would yield better performance than constantly re-compositing a PNG with alpha data. In any case, the blend modes can allow you to skip the step of creating the PNG externally, allowing for faster development and more flexibility.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap