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

forked from: forked from: flash on 2009-3-3

Get Adobe Flash player
by III_Rex_III 19 May 2009
// forked from mapii's forked from: flash on 2009-3-3
// forked from wiggybob's flash on 2009-3-3
package {
    import flash.display.Sprite;
    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();


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;
}

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;
	};
}


this.addEventListener(Event.ENTER_FRAME, enterFrame);


function enterFrame(e:Event):void { 

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

}


init();

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

        }
    }
}