HaXe FX Builder

From dis-Emi-A

Jump to: navigation, search


The FXBuilder is a convenient wrapper for the HaXe Actors to do quick animations for Widgets and Sprites. It is meant to make using standard FX quick and painless.

To use the FXBuilder you should import ui.FXBuilder.

A full example is available under HaXe Library Tutorials, the [FXDemo] item.

A Simple Example

In the following example the "graphic" is some on-screen element to which an effect should be applied. In this case we are applying the Burst effect.

var fx = FXBuilder.createActorFX( 
  ui.anim.lib.BoneShatter,
  ui.anim.lib.BoneShatter.seq.Burst
  );
FXBuilder.endWidget( graphic, fx );

The first part creates the effect we wish to use. The first parameter indicates which class is the effect, and the second parameter the sequence in that class. There are several different classes and sequences available: refer to the lib/ui/anim/lib directory. (TBD, online reference)

The second part executes the effect. In this case endWidget is being used, which indicates that the widget will be removed from the display at the end of the effect. Alternately could startWidget be used to introduce an element, or onWidget to temporarily apply to the widget.

Using a DisplayObject

If you are not using the widget library and have only a flash.display.DisplayObject then you need to wrap that in a ui.NativeWrapper in the call to FXBuilder.

For example, if "graphic" were a flash.display.Bitmap, you would do:

FXBuilder.startWidget( new ui.NativeWrapper( graphic ), fx );
Personal tools