About the FieldSweeper component

The FieldSweeper component lets you easily add effects and animations to a 'field of particles' in your Flash movies. The component can be used to create effects like wind through a field of grass, knocking down dominoes, or a game that lets the user hunt through a pile of objects.

The 'field' is made up of your movie clips from the library, which you can manually place on the stage and select, or have the component or UI generate the field for you. You can also use our Particulator component to continually generate a new field. Once the field is created, use 'sweeper' movie clips to cause a desired action on each particle when it passes over, or, have the particles react to mouse movements. A custom UI is provided to let you change parameters in the component and review changes in realtime on the stage before you publish. You can control how the field is created via sizing, alpha, and randomness of the field itself as well as the particles that get created.

For a full description of methods, events and properties see the FieldSweeper class description page.

Related topics

FieldSweeper class & parameters

Inheritance AS3 DisplayObjectContainer > Sprite > UIComponent > FieldSweeper

(see flash help for documentation on parent classes).

ActionScript Class Name AS3 flextnet.components.as3.FieldSweeper

Each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code:

trace(flextnet.components.Particulator.version);

Note: The code trace(myCmp.version); returns undefined.

You can use the Component inspector or the custom interface (select Window > Other Panels > FieldSweeper) to set the following properties for each FieldSweeper component instance on the stage while authoring. These properties can also be set via ActionScript at runtime.

Properties:

alphaInitial percentage value for alpha value of created particles in the field.

alphaRandom percentage value used to randomize initial alpha value.

attractRepulse pixel value indicating how far to push away particles from the current mouse or sweeper position.

crossReaction how each particle should react to be being crossed by a sweeper or the mouse.

emitterType shape of emitter to generate the field.

emitterStage DisplayObjectContainer where field particles are created. Defaults to the component itself.

eventType type of event to be used to trigger a reaction on the particles.

featherInfluence percentage of fadeable reach for each particle while the mouse or sweeper crosses over a field.

fieldGeneration type of field generation so that a field can be generated automatically or from a selection of movie clips on stage.

gridSize pixel value indicating space between each particle in a generated field.

gridSizeRandom a percentage value used to randomize the gridSize property.

gridStaggered specifies whether, and how, to stagger particles in a generated field.

mouseProximity specifies how far the mouse can be away from particles to trigger them.

particleInstanceNames an array instance names of movie clips on the stage to be used as particles in the field.

particleMcPool an array of linkage id's/class names of movie clips in the library to used as particles in the field.

particles an array of particle movie clips in the field.

particleSize percentage scale of each particle placed in the field.

particleSizeRandom percentage value used to randomize particleSize.

particulatorInstance the instance name of Particulator component on stage used to generate the field.

shapeFlag boolean value that determines whether the exact shape of a sweeper is used to detect collisions or its bounding box.

snapBack boolean value that indicates whether to snap a particle back to its original position on mouse over.

sweepers array of 'sweeper' DisplayObjects.

sweeperInstanceNames array of instance names of movie clips on the stage to be used as 'sweepers'.

Methods:

generateNewField() remove the field, and use current settings to generate a new field of particles.

removeAllParticles() clear the field by removing all particle movie clips.

Events:

particleCrossed() a custom function called on each particle as the sweeper or mouse crosses it.

You can write ActionScript to control these and other characteristics of how the FieldSweeper component displays and functions using its properties, methods, and events. Not all of these properties can be modified from the authoring interface.

 

Creating an application with the FieldSweeper component

To add a FieldSweeper component to your flash document while authoring, simply drag the component from the Components panel onto the stage. The component is located under the flashextension.net AS3 node in the Components panel. Before the component can generate a field, make sure you have movie clips in your library and some are selected in the particle objects list box in the 'particle appearance' pane of the UI, or the particleMcPool property is set. Test and run your movie to see the particles emitted.

The FieldSweeper component uses a custom interface found in Window > Other Panels > FieldSweeper to let you change properties and settings in a user-friendly manner. You can also use the Component inspector by selecting your component instance on the stage, going to the Properties panel, and then clicking on the component icon in the Component area of the panel.

The FieldSweeper panel

The FieldSweeper panel can be brought up by going to Window > Other Panels > FieldSweeper. To use the panel, select a FieldSweeper component instance that you have already placed on the stage using the 'component instance' drop-down box at the top of the panel. At that point, click on the tabs to open up various panels for each section of properties you can edit. If you don't yet have a FieldSweeper component on the stage, drag one to the stage and press the refresh button (at the top-right corner) to let you begin changing properties.

The following screen shots shows each of the 4 panels of the interface for the component- field, particle appearance, sweeper and event trigger/react.


field

 

The 'field' panel lets you set characteristics of how particles are emitted to form the field. Set grid size, emitter shape, stagger, and others. You can even specify an instance of the Particulator component to use as your field generator.



particle appearance

 

The 'particle appearance' panel lets you set properties that determine the look of each emitted particle. Use the 'particle objects' list box to select one or more movie clips from the library to be used as particles. The UI automatically sets the movie clips you choose to be 'exported for ActionScript' in the first frame if not in that state already.

sweeper

 

The 'sweeper'

panel allows you to choose movie clips on the stage to be used as sweeper objects. Simply select the movie clips you want to use and press 'UPDATE'.

event trigger/react

 

The 'event trigger/react' panel allows you to set properties that determine what causes particles to react. Here you determine whether the mouse or sweeper objects will cause the trigger. Also set properties that determine particle reactions.