Hello I’m trying to make a simple as3 menu using the drawing api, but i’m having a few problems.
First of all I want the red box on roll over to start out from where the gray box is, but right now its starting out from the left of the stage.
Second when I bring the mouse cursor off the stage the red box would just appear.
import flash.display.*;
import flash.text.TextField;
import fl.transitions.*;
import fl.transitions.easing.*;
var box:Sprite = new Sprite();
box.graphics.beginFill(0xCCCCCC);
box.graphics.drawRect(50,50,150,20);
box.graphics.endFill();
addChild(box);
var boxOver:Sprite = new Sprite();
boxOver.graphics.beginFill(0x990000);
boxOver.graphics.drawRect(50,50,150,20);
boxOver.graphics.endFill();
boxOver.scaleX = 0;
addChild(boxOver);
var menu:TextField = new TextField();
menu.text = "Menu Item Here";
menu.x=52;
menu.y=50;
addChild(menu);
menu.addEventListener(MouseEvent.ROLL_OVER, overHandler);
menu.addEventListener(MouseEvent.ROLL_OUT, outHandler);
function overHandler(e:MouseEvent):void
{
var overTween:Tween = new Tween(boxOver, "scaleX", Strong.easeOut,boxOver.scaleX, 1,1, true);
}
function outHandler(e:MouseEvent):void
{
var outTween:Tween = new Tween(boxOver, "scaleX", Strong.easeOut,boxOver.scaleX, 0,.5, true);
}