PDA

View Full Version : Action Script Filters Help



Capt. Zeroth
January 20th, 2007, 10:00 PM
I was wondering how to change the brightness and hue via action script. I am making a screen saver that is sensitive to the time of the day. If it is night, the brightness and hue of the sky are accordingly set. I was thinking of adding seasonal changes, but I'd like to get the basics down first. ;) Any help would be great.

Thanks in Advance,
Captain Zeroth

Mote
January 21st, 2007, 12:31 AM
Hi Capt Zeroth,

Check out the FLA I made at http://bitsong.com/boards/html

Basically, you have to use Flash's transform and colorTransform objects. I made an example that does what you describe, but to understand how it works, you would have to read up on the transform and colorTransform objects. I got most of my understanding from "Foundation Actionscript Animation," by Keith Peters. The writeup in Flash Help is also pretty good.


import flash.geom.ColorTransform;
import flash.geom.Transform;

var rb:Number = 50;
var gb:Number = 50;
var i:Number = 0;
function onEnterFrame():Void{

var ra = 1.0;
var ga = 1.0;
var ba = 1.0;
var aa = 1.0;
if(rb <= 200){
rb = i;
gb = i;
trace(rb);
i++
}
var bb = 255;
var ab = 255;

var skyColorTransform:ColorTransform = new ColorTransform(ra, ga, ba, aa, rb, gb, bb, ab);
var skyTransform:Transform = new Transform(sky);
skyTransform.colorTransform = skyColorTransform;

Mote
January 21st, 2007, 12:33 AM
Correction on URL
http://http://bitsong.com/boards.html

Mote
January 21st, 2007, 12:34 AM
One more try:
http://bitsong.com/boards.html

jjcorreia
January 21st, 2007, 01:04 AM
There is an edit button for corrections ;)