In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-3-3

Get Adobe Flash player
by wiggybob 03 Mar 2009
    Embed
package {
    import flash.events.*;
    import flash.display.*
    import flash.text.*; 
 
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..

/*
----------------------------------
BEGIN MENU CODE
----------------------------------
*/


var container_mc:MovieClip = new MovieClip();
addChild(container_mc);

var btnCount:Number = 40;       //Number of btns to draw
var btnSize:Number = 45;        //Size of each btn
var itemArray:Array = new Array();

addEventListener(Event.ENTER_FRAME, enterFrame);

function init():void{
    for (var i:Number=0; i<btnCount; i++) {
	var spr:Sprite = new Sprite();
	spr.graphics.beginFill(0xdddddd);
	spr.graphics.drawRect(0,0,200,btnSize);
	spr.graphics.endFill();
	
	var txt:TextField = new TextField();
	txt.autoSize = TextFieldAutoSize.LEFT;
	txt.text = 'Nav item  '+i.toString();
	spr.addChild(txt);

        itemArray[i] = spr;
	container_mc.addChild(itemArray[i]);
    };
    arrange(itemArray);
    container_mc.y = (stage.stageHeight - container_mc.height)/2;
    //container_mc.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
}

function arrange(a:Array):void {
	a[0].x = 25;
	a[0].y = 10;

	for (var i:Number=1; i<a.length; i++) {
		a[i].x = 25;
		a[i].y = (a[i].height + a[i-1].y)+5;
	};
}


function enterFrame(e:Event):void { 

    container_mc.y = -(mouseY*((container_mc.height/btnSize)/10));
    

}


function mouseMove(e:MouseEvent):void {
    e.currentTarget.y = -(mouseY);

}

init();

/*
----------------------------------
END MENU CODE
----------------------------------
*/

        }
    }
}