Main Page | Package | Index | Help

com.mosesSupposes.fuse

class FuseFMP

Object
  |
  +--com.mosesSupposes.fuse.FuseFMP


class FuseFMP
extends Object

Provides easy Flash8 BitmapFilter handling. Can be used as a standalone utility or in conjunction with ZigoEngine & Fuse to animate filters.

FuseFMP uses a unique naming convention for addressing BitmapFilter properties:

short-filtername+"_"+filterprop
DropShadow_distance
Bevel_angle
etc.

Such pseudonyms are used in various management methods like setFilterProp.


Special Blur handling:

For a complete list of FuseFMP properties call FuseFMP.getAllShortcuts or FuseFMP.traceAllFilters.


FuseFMP also supports its own optional Shortcuts functionality, which writes all of these pseudo-props into targets or prototypes. This enables the getting and setting of BitmapFilter properties directly on targets, such as my_mc.Blur_blurX = 10; and, if using ZigoEngine, tween shortcuts like my_mc.Blur_blurXTo(10);.

For a complete list of FuseFMP tweening methods see Shortcuts documentation.
If you're using FuseFMP without ZigoEngine and want to extend prototypes use simpleSetup, or if you want to add & remove shortcuts on specific targets use initialize & deinitialize.

FuseFMP pseudo-properties are also directly tweenable in ZigoEngine and Fuse once registered:
// tween the dropshadow angle 25 degrees ccw, relative to current setting:
ZigoEngine.doTween(my_mc, "DropShadow_angle", "-25");
 
// this fuse action tweens a horizontal blur back to the clip's normal state 
Fuse.push({ start_Blur_blurX:100 });



BitmapFilter tips:

Usage:
// 1. normal
FuseFMP.writeFilter(clip1, "DropShadow"); 
FuseFMP.setFilterProp(box, "DropShadow_color", 0x336699);
 
// 2. Shortcuts registered with ZigoEngine 
//    (or FuseFMP.simpleSetup called if using without ZigoEngine)
 
clip1.writeFilter("DropShadow");
clip1.DropShadow_color = "#336699"; // supports strings for color
clip1.DropShadow_blur = 10; // sets blurX & blurY at once
 


Author:
Moses Gunesch / MosesSupposes.com / Based on FMP 1.0 by Danilo Sandner & Bjorn Wibben

Version:
2.1


Field Summary

public static
BLUR_ZERO: Boolean = true
When true, generated BlurFilters are set to 0 blurX & blurY until manually set.

public static
VERSION: String = FuseKitCommon.VERSION
Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

Method Summary

public static
deinitialize ( ): Void
Removes shortcuts from specific targets, or from base prototypes if no targets are passed.

public static
getAllShortcuts ( ): Array
Retrieves an array of supported property shortcut strings. Similar to traceAllFilters.

public static
getFilter ( target: Object, filter: Object, createNew: Boolean ): BitmapFilter
Fast getter for a single filter with the option to generate a new filter if missing.

public static
getFilterIndex ( target: Object, filter: Object ): Number
Gets current filter index.

public static
getFilterName ( instance: BitmapFilter ): String
Generic method to get a string version of any filter instance's class name.

public static
getFilterProp ( target: Object, propname: String, createNew: Boolean ): Object
Fast getter for a single filter property with option to generate a new filter if missing.

public static
initialize ( target: Object ): Void
Adds shortcuts to all target objects passed.

public static
removeFilter ( target: Object, filter: Object ): Boolean
Clears filter.

public static
setFilterProp ( target: Object, propname: Object, value: Object ): Void
Fast setter for a specific filter property. Generates a new filter if needed.

public static
setFilterProps ( target: Object, filterOrPropsObj: Object, propsObj: Object ): Void
Power method that handles multiple targets, props, and filters in one call. Generates new filters as needed.

public static
simpleSetup ( ): Void
Extends MC, Button & TF prototypes with FuseFMP shortcuts.

public static
traceAllFilters ( ): Void
Lists all filters and shortcut properties (Bevel_blurX, etc.) to the Output panel for reference.

public static
writeFilter ( target: Object, filter: Object, propsObj: Object ): Number
Writes a new filter or overwrites an existing filter.



Field Documentation

BLUR_ZERO

public static var BLUR_ZERO: Boolean = true
When true, generated BlurFilters are set to 0 blurX & blurY until manually set.

FuseFMP always creates new BitmapFilters with default properties, but BlurFilter has been found to be a special case in that the default blur of 4 frequently requires extra code to undo back to 0.

For example: (Assuming no blur has been applied in advance) without BLUR_ZERO, the Fuse action {start_Blur_blurX:100} results in a Blur_blurY of 4 and a blurX tween from 100 to 4, leaving the target slightly fuzzy. With BLUR_ZERO turned on the same action would show only the blurX tween from 100 to 0 with the target ending up looking crisp.

VERSION

public static var VERSION: String = FuseKitCommon.VERSION
Enables kit version to be retrieved at runtime or when reviewing a decompiled swf.

Usage:
trace(FuseFMP.VERSION); // if the version is incorrect, clear your ASO cache.


Method Documentation

deinitialize

public static function deinitialize(): Void
Removes shortcuts from specific targets, or from base prototypes if no targets are passed.

See also:

getAllShortcuts

public static function getAllShortcuts(): Array
Retrieves an array of supported property shortcut strings. Similar to traceAllFilters.

Returns:
array of supported property shortcuts

See also:

getFilter

public static function getFilter(target: Object,
 filter: Object,
 createNew: Boolean): BitmapFilter
Fast getter for a single filter with the option to generate a new filter if missing.

Parameters:
target
MovieClip, Button or TextField containing the filter
filter
BitmapFilter instance, String (like "BlurFilter" or "Blur"), or class constructor
createNew
Pass true to generate a filter during the call if there isn't one
Returns:
A BitmapFilter instance, or null if none found and createNew option not used.

See also:

getFilterIndex

public static function getFilterIndex(target: Object,
 filter: Object): Number
Gets current filter index.

Parameters:
target
A MovieClip, Button or TextField containing the filter
filter
BitmapFilter instance, String (like "BlurFilter" or "Blur"), or class constructor
Returns:
Index of filter in filters Array or -1 if filter doesn't exist.

See also:

getFilterName

public static function getFilterName(instance: BitmapFilter): String
Generic method to get a string version of any filter instance's class name.

// list filter in my_mc by name to output window
for (var i:String in my_mc.filters) {
	trace( FuseFMP.getFilterName(my_mc.filters[i]) );
}

Parameters:
instance
BitmapFilter instance
Returns:
BitmapFilter instance name

See also:

getFilterProp

public static function getFilterProp(target: Object,
 propname: String,
 createNew: Boolean): Object
Fast getter for a single filter property with option to generate a new filter if missing.

Parameters:
target
MovieClip, Button or TextField containing the filter
propname
A single property in FuseFMP notation like 'DropShadow_distance'
createNew
Pass true to generate a filter during the call if there isn't one
Returns:
the value of the property, usually a number

See also:

initialize

public static function initialize(target: Object): Void
Adds shortcuts to all target objects passed.

This enables the getting and setting of BitmapFilter properties directly on targets, using the FuseFMP naming convention [short-filtername+"_"+filterprop]. Like, 'DropShadow_angle'.

For a complete list of shortcut properties call FuseFMP.getAllShortcuts or FuseFMP.traceAllFilters.

Parameters:
target
Accepts one or more MovieClips, TextFields, or Buttons to initialize with shortcuts.
See also:

removeFilter

public static function removeFilter(target: Object,
 filter: Object): Boolean
Clears filter.

Parameters:
target
MovieClip, Button or TextField containing the filter
filter
BitmapFilter instance, String (like "BlurFilter" or "Blur"), or class constructor
Returns:
true or false for success.

See also:

setFilterProp

public static function setFilterProp(target: Object,
 propname: Object,
 value: Object): Void
Fast setter for a specific filter property. Generates a new filter if needed.

Efficiency: Note that when speed is a priority, setFilterProps is faster for setting batches of 3 or more properties.

Usage:
FuseFMP.setFilterProp(my_mc, 'Blur_blurX', 50);
 
FuseFMP.setFilterProp(my_mc, 'GradientBevel_colors', [0xFFFFFF, 0x000000, 0x333333]);
a single value but far faster for batches of 3 or more properties.

Parameters:
target
MovieClip, Button or TextField containing the filter to update
propname
A single property in FuseFMP notation like 'DropShadow_distance'
value
The value to set the filter property to
See also:

setFilterProps

public static function setFilterProps(target: Object,
 filterOrPropsObj: Object,
 propsObj: Object): Void
Power method that handles multiple targets, props, and filters in one call. Generates new filters as needed.

This all-purpose method can be used in place of writeFilter and setFilterProp.

Usage:
There are two distinct syntaxes.
  1. Pass a generic object in the second parameter containing any number of full FuseFMP-notation properties, thus allowing you to update any number of Filters at once:
    FuseFMP.setFilterProps(my_mc, { Blur_blurX:50, Bevel_blurX:1 });.
  2. Specify a filter in the second parameter, then pass a generic object in the third parameter containing normal filter property names:
    FuseFMP.setFilterProps(my_mc, 'Blur', { blurX:50, blurY:0, quality:3 });
For either option you may also pass multiple targets in an array such as:
FuseFMP.setFilterProps([my_mc, my_txt], 'Blur', { blur:20 });

If the filters specified don't exist they are generated automatically.

Efficiency: Note that when speed is a priority, setFilterProp is faster for 1-2 property updates while this method is much faster for batches of 3 or more properties.

Parameters:
target
One or an Array of MovieClips, Buttons or TextFields to update
filterOrPropsObj
Either a filter (BitmapFilter instance, String like "BlurFilter" or "Blur" or class constructor), or a generic object mapping any number of FuseFMP-formatted property names like Blur_blurX:10.
propsObj
If the previous parameter specifies a filter: Generic object mapping any number of property names such as distance:10.
See also:

simpleSetup

public static function simpleSetup(): Void
Extends MC, Button & TF prototypes with FuseFMP shortcuts.

This enables the getting and setting of BitmapFilter properties directly on targets, using the convention short-filtername+"_"+filterprop.

For a complete list of shortcut properties call FuseFMP.getAllShortcuts or FuseFMP.traceAllFilters.

Also sets _global references to FuseFMP and all filter classes so timeline coders can avoid using import statements.

Note that you do not need to call this method if you're using ZigoEngine.simpleSetup, it will be called automatically.

See also:

traceAllFilters

public static function traceAllFilters(): Void
Lists all filters and shortcut properties (Bevel_blurX, etc.) to the Output panel for reference.

See also:

writeFilter

public static function writeFilter(target: Object,
 filter: Object,
 propsObj: Object): Number
Writes a new filter or overwrites an existing filter.

Use setFilterProps to update existing filters - this method overwrites an existing instance.

Parameters:
target
MovieClip, Button or TextField containing the filter
filter
BitmapFilter instance, String (like "BlurFilter" or "Blur"), or class constructor
propsObj
optional, a generic object customizing the new filter, like {blurX:50,quality:1}
Returns:
index in target's filters array (or -1 if fails)

See also:


The documentation was generated from the following file:


Generated on 1/14/2007 11:31:53 PM