Create Spot Light Effect Using Flash

1.Open a new document in flash.

2.Import a picture (Ctrl+R) in layer one.

water-falling-image
image-895

3.Change it to movieclip. Go to Properties Panel (Ctrl + F3) and adjust the color as given below.

water-falling-movieclip
image-896

4.Paste the same picture in layer two then convert it to movieclip and give the instance name as top_picture.

water-falling-and-torch-light-effect-convert
image-897

5.Using Photoshop cut the water fall portion and save it in the png format. Import that water fall portion in layer three, change it to movieclip and name it as waterfall.

water-falling-and-torch-light-effect-water-fall-portion
image-898

6.In layer four draw a circle gradient as shown below and convert to movieclip then name it as GradientCircle.

water-falling-circle-gradient
image-899

7.Create a layer five to write the following actionscript:

/**  code for water fall effect   **/
var pt1:Point = new Point(0,0);
var pt2:Point = new Point(0,0);
var perlinOffset:Array = [pt1, pt2];
var bm2:BitmapData=new BitmapData(waterfall.width, waterfall.height);
var disp2:DisplacementMapFilter = new DisplacementMapFilter(bm2,new Point(0,0),1,2,10,0);
var pt3:Point = new Point(0,0);
var pt4:Point = new Point(0,0);
var perlinOffsetFall:Array = [pt3, pt3];
addEventListener(Event.ENTER_FRAME,onFrame);
function onFrame(evt:Event):void {
perlinOffsetFall[0].y -=1;
perlinOffsetFall[1].x -=0.1;
bm2.perlinNoise(20,20,1,99,true,false, 7,false,perlinOffsetFall);
waterfall.filters=[disp2]
}
/**  code for spot light effect   **/
top_picture.cacheAsBitmap = true;
GradientCircle.cacheAsBitmap = true;
top_picture.mask=GradientCircle;
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE, mds);
function mds(evt:MouseEvent)
{
GradientCircle.x = mouseX;
GradientCircle.y = mouseY;
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, mss);
function mss(evt:MouseEvent){
top_picture.cacheAsBitmap = false;
}
stage.addEventListener(MouseEvent.MOUSE_UP, mas);
function mas(evt:MouseEvent){
top_picture.cacheAsBitmap = true;
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *