Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

SPONSORED BY

The Very Best Algebra Notes


The Very Best Algebra Notes for the Very Best Flash Games

 

FLASH ACTIONSCRIPT LESSON: APPLYING COLOR TINTS WITH THE SLIDER COMPONENT

In this lesson, students learn how to create a graphic object with Flash AS3 code and then apply a color tint to the object. The slider component is used to vary the color tint of the object. The AS3 API object, methods and properties used in the lesson include addEventListener, color, function, and transform.colorTransform

In the program, the slider is moved to vary the color tint of the rectangle. The arrow keys on the keyboard can also be used to vary the color tint.

 

To schedule an online Flash lesson, contact
mark.c.stansberry@gmail.com
, Text: (707)235-4095


http://www.3d-perspective-software-development.com/lesson-flash-as3-color-tint.html

COPY AND PASTE TO DOWNLOAD CODE

import flash.ui.ContextMenu;
import flash.events.Event;
import fl.events.SliderEvent;
import fl.motion.Color;
*///set slider event listener
slider.addEventListener(SliderEvent.CHANGE, changeTint);

function changeTint(s:SliderEvent):void {
//make a new Color object
var c:Color=new Color();
//set the color of the tint and set the multiplier
c.setTint(0xff0000, slider.value/100);
//apply the Color object to the colorTransform
//property of the desired MovieClip/DisplayObject
mc.transform.colorTransform=c;
}