Composite class
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import biz.Flashscript.filters.DropShadow;
public class Composite extends Sprite implements IMenu
{
protected var menuText:String;
protected var myURL:String;
private static var myShadow:DropShadow;
public function Composite (_description:String, url:String)
{
menuText = _description;
myURL = url;
}
public function getMyURL ():String
{
return myURL;
}
public function getMenuText ():String
{
return menuText;
}
public function getItems ():Array
{
return null;
}
/*
* The butMode function contains all the mouse event functions.
*/
internal function butMode ():void
{
buttonMode = true;
addEventListener (MouseEvent.MOUSE_OVER,overHandler);
addEventListener (MouseEvent.MOUSE_OUT,outHandler);
addEventListener (MouseEvent.CLICK,clickHandler);
}
private function overHandler (event:MouseEvent):void
{
/*
* In order to prevent any mouse behaviour to be bubbled to the higher
* order object, we stop its propagation. If we don't do that the children
* would be deleted.
*/
event.stopImmediatePropagation ();
myShadow = new DropShadow(this);
}
private function outHandler (event:MouseEvent):void
{
myShadow = new DropShadow(this,0,0,0xFFFFCC);
}
private function clickHandler (event:MouseEvent):void
{
event.stopImmediatePropagation ();
/*
* Here we can have anything we want to do when the button is clicked.
*/
trace (myURL);
}
}
}