Basic Tutorial

Controlling the BJC Poll Meter with the BJC Slider

In this tutorial we will be using the Macromedia Flash MX 2004 with the flashControllers to create a simple movie. In the movie, a BJC Slider component is used to set values to the BJC Poll Meter component. You will see how simple it is to create fully functional and good looking applications by using the flashControllers.


Adding the components and setting the parameters

First create a new Flash movie. Set the size to 250x190 px. Now drag one BJC Poll Meter to the stage and position its top left corner to 15,15. Assign the component an instance name, We named ours to 'pm'. Now set the following parameters: Mode=Manual, Separators=10, Max Alert=100, Max Value=100, Min Alert=80, Min Value=0. You can also set other parameters if you wan't.

Drag one BJC Slider component to the stage. Assign it an instance name, We named ours to 'am'. Position the component so that the top left corner is in the point 15,101. Now set the following parameters: Callback=amMoved, Mode=Analog, Track Length=180, Separators=10, Maximum=100, Minimum=0, Starting value=0, Title On/Off=Off, Value field On/Off=Off. You can also set other parameters. The 'Callback' parameter defines the function that will be called when user moves the slider. In our case, the 'amMoved' function will be called.


Adding the ActionScript

Now select the first frame and open the ActionScript panel. Insert the following code:

function amMoved( value )
{
  pm.addValue( value );
}


This function will be called when the user moves the slider. Parameter 'index' is passed automatically to this function. It is the current value of our BJC Slider component. Inside of the function, we add new poll to our BJC Poll Meter.


Testing the movie

Now we can test the movie. Adjust the slider component and you will see polls appearing to the BJC Poll Meter. The task was very easy to handle with the BJC CCS1. Without the component set, we would be still planning how to create such a functionality. Here's what we created: