Flash AS3.0 Class Samples


●AutoZoom Class Demo
/* Initialize */
var rad:Number = 0;
var az= new AutoZoom(back,50,150,0.7);

/* start */
addEventListener(Event.ENTER_FRAME,EnterFrameFunc);
function EnterFrameFunc(event : Event) {

	back.mc22.x=180*Math.cos(rad*2.5);
	back.mc22.y=180*Math.sin(rad*2.1);
	
	back.mc11.x=180*Math.cos(rad);
	back.mc11.y=180*Math.sin(rad);
	rad+=0.05;
	
	az.zoom_update(back,
                       back.mc11.x,back.mc11.y,
		       back.mc22.x,back.mc22.y);
}
stop();


●Annealing Class Demo
/* Initialize */
var lmc=new AnnealingMC(0.15,0.07);
var wmc=new WireMC(root);

/* start */
addEventListener(Event.ENTER_FRAME,EnterFrameFunc);
function EnterFrameFunc(event : Event) {
	mc22.x=stage.mouseX;
	lmc.update_position(mc11,mc22,0,0);
	wmc.update_wire(mc11,mc22,2,0xFFFFFF,1.0);
}
stop();


●MCqueue Class Demo
/* Initialize MovieClip Queue Class */
var pq=new MCqueue();
var lmc=new AnnealingMC(0.15,0.07);
var count:int=0,emc = new Array();
for(var i=1;i<=7;i++){
	var sp = new MovieClip() ;
	sp.x = this["p"+i].x;	sp.y = this["p"+i].y;
	sp.mc = this["p"+i];	emc[i]=sp;
	pq.enqueue( this["p"+i] );
}
skeyinit();
pq.sort( "skey"  );

function skeyinit() {
	for(var i=1;i<=7;i++){	
		this["p"+i].skey = int(Math.random() * 100);
		this["p"+i].txt.text = "TEST "+this["p"+i].skey;
	}
}

/* start */
addEventListener(Event.ENTER_FRAME,EnterFrameFunc);
function EnterFrameFunc(event : Event) {
	var top = pq.head();

	for(var i=1;i<=7;i++){
		if(emc[i].x != top.x || emc[i].y != top.y){
			lmc.update_position( top,   emc[i] ,0,0);
		}		
		top = pq.next(top);
	}
	if( count++>100 ){
		skeyinit();
		pq.sort( "skey"  );
		count=0;
	}
}
stop();


●Physics Class Demo
/* Initialize */
for (var i=0; i < num ; i++) {
	var m:int = (i%3+1);
	if(i>8)m=1;
	mass[i] = ps.create_particle(m*m*m, m * 10, 0.8);
	this["u"+i].width  *=  m;
	this["u"+i].height *=  m;
	mass[i].x = this["u" + i].x;
	mass[i].y = this["u" + i].y;
	ps.set_accelerate(mass[i],
		 -(this["u"+i].x - cx)/100,
		 -(this["u"+i].y - cy)/100,
		 3, ps.ACCEL_OPT_ADJUST_ROTATION);
}

this.addEventListener( Event.ENTER_FRAME, main_thread );
function main_thread(event:Event):void {
	for (i=0; i < num; i++) {
		if (j++ % 500 < 150 ) {
			ps.direct_accelerate(mass[i]);
		}
		ps.run(mass[i]);
		this["u" + i].x = mass[i].x;
		this["u" + i].y = mass[i].y;
		this["u" + i].rotation = mass[i].rotation;
	}
}


●MXmenu Class Demo

/* Initialize */
System.useCodePage = true;

var mxm:Object = new MXmenu(stage,this,tbox);
mxm.set_root(20,100,500);
mxm.set_obj(64,64,8);
mxm.xml_load(new URLRequest("sample.xml"),"errorexit");

addEventListener(Event.ENTER_FRAME,EnterFrameFunc);
function EnterFrameFunc(event : Event) {
 	mxm.show(stage.mouseX,stage.mouseY);
}

stop();