MOUSE_OVER, function(event)
{
mc.alpha = 0.5;
});
mc.addEventListener(MouseEvent.MOUSE_OUT, function(event)
{
mc.alpha = 1;
});
}
private static function createMovieClip(?parent : MovieClip) : MovieClip
{
if(parent == null)
parent = Lib.current;
Chapter 12: Building Interactive Content with Flash
331
var mc = new MovieClip();
parent.addChild(mc);
return mc;
}
// the function has been changed a little to fill the box with color
private static function drawRect(mc:MovieClip,x:Float,y:Float,w:Float,h:Float)
{
var g = mc.graphics;
g.beginFill(0x00ff00);
mc.graphics.drawRect(x, y, w, h);
g.endFill();
}
}
The event handler function must accept a single argument of type flash.events.Event or a derived
type and return nothing. The argument object contains additional information about the triggered event.
Events over Time
The Adobe Flash IDE has a visual editor that permits to design graphic elements defined as symbols and
collected in a library that is embedded within the deployed movie. Each symbol has its own timeline
and the designer can define frames in the timeline to alter the state of the drawing or to insert pieces of
code to execute.
Pages:
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646