Pre-Loaders

Ok, few things I need help with…

I want to make a loading-screen (pre-loader) I have absolutely no idea how to do this so I need some help there. But I have another problem. In my loading-screen I want to take a color image and make it black and white. Then I want to use it as a progress bar and for each 2% or so a portion of the image fills up with color. I know that this won’t be easy but any help would be greatly appreciated.

UPDATE: Well I don’t need help make the actual pre-loader… I found a nice tutorial but now I just need help with make the image progress bar I described.

Actually is’t not as difficult as you might think:

To change form colour to black and white

Define a color object

Adjust the color offsets RR =0 GG=0 BB=0 Alpha=40 and you’ll have a pretty good imitation of a b/w object. (You can mess about with the advanced sliders in the effects palate to see the results)

Once you achieved a satisfactory color transformation you can control the rate of the offsets by

mySwf.getBytesLoaded()/mySwf.getBytesTotal()

Pardon my retardedness but can you explain that in simplar terms.

Flash uses RGB colour space to describe colours

Any coloured object in Flash has four attributes red, blue, green and alpha (transparency). Red Green and Blue may have valuse from -255 to 255 and Alpha ranges from 0 to 100 (0=fully transparent and 100=fully opaque)

Flash allows you to manipulate these properties either manually when authoring an fla or dynamically (by ActionScript) at runtime in the swf.

To manipulate colour offsets manually:

Define the object that you want to colour as a Movie Clip (select the object, click F8 and give an instance name). Then select the Effects palatte and choose Advanced from the drop down menu.
Drag the slider bars and look at how the colour of the image changes. If you set the values so that R=0%, G=0%, B=0% and Alpha=40% you will see that you have a pretty good approximation of black and white.

To manipulate the offsets dynamically:
First of all you have to define a colour object - i.e. you have to specify an instance of a movie clip whose colour you want to change. Here we’re using the instance mcInstance:

chameleon= new Color (mcInstance)

Next we need to specify a colour transformation we wish to perform - a colour transformation object. To achive the black and white look our colour transformation (named colourChange) object is:

colourChange = { ra: ‘0’, rb: ‘0’, ga: ‘0’, gb: ‘0’, ba: ‘0’, bb: ‘0’, aa: ‘40’, ab: ‘0’}

Then we invoke the colour transformation method:

chameleon.setTransform(colourChange);

and we have dynamically changed the colour.