flash on 2011-6-23
/**
* Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8PYQ
*/
package {
import flash.display.Sprite;
import flash.events.*;
[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
public class ConveyorBelt extends Sprite{
private var dial:picDial=new picDial();
private var myMC:Sprite=new Sprite();
private var myList:Array=new Array();
public function ConveyorBelt(){
if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );
}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
var bg:back_ground=new back_ground();
addChildAt(bg,0);
addChild(dial);
dial.x=465/2;
dial.y=340;
addChild(myMC);
func1();
}
private function func1():void{
for(var j:int=0; j < 26; j++){
var sp:_SP=new _SP(j);
sp.name="lng_"+String.fromCharCode(j+65);
sp.x=j*50;
sp.y=200;
myMC.addChild(sp);
myList.push(sp);
var xm:Number = 200-(myMC.x+sp.x);
var ym:Number = 160-(myMC.y+sp.y);
var span:Number = Math.sqrt(xm*xm+ym*ym);
if (span > 100) {
sp.scaleX=sp.scaleY = 1;
sp.y=200;
} else {
sp.scaleX=sp.scaleY = 1-(span-100)/100;
var xUP:Number=Math.floor((1-(span-100)/10)*10);
sp.y=160-xUP;
}
}
dial.thumb.addEventListener(MouseEvent.MOUSE_DOWN, f_md);
dial.thumb.addEventListener(MouseEvent.MOUSE_UP, f_mu);
dial.thumb.addEventListener(Event.MOUSE_LEAVE,f_mu);
stage.addEventListener(MouseEvent.MOUSE_UP,f_mu);
}
private function f_md(ev):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, rend);
}
private function f_mu(ev):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, rend);
}
private function rend(ev):void{
dial.thumb.rotation = Math.atan2(dial.base.mouseY, dial.base.mouseX)/Math.PI*180+90;
var value_ = Math.floor((dial.thumb.rotation + 360)%360);
myMC.x = -(value_*10)/4;
for (var i:uint = 0; i<myMC.numChildren; i++) {
var _mc = myMC.getChildAt(i);
var xm:Number = 200-(myMC.x+_mc.x);
var ym:Number = 160-(myMC.y+_mc.y);
var span:Number = Math.sqrt(xm*xm+ym*ym);
if (span > 100) {
_mc.scaleX=_mc.scaleY = 1;
_mc.y=200;
} else {
_mc.scaleX=_mc.scaleY = 1-(span-100)/100;
var xUP:Number=Math.floor((1-(span-100)/10)*10);
_mc.y=160-xUP;
}
}
}
}//
}
import flash.display.Sprite;
import flash.events.*;
import flash.text.*;
import flash.display.Bitmap;
import flash.display.BitmapData;
class back_ground extends Sprite{
public function back_ground( ){
var arr:Array=[0x632645,0xBE064E,0xEF324E,0xF6712E,0xFFB403,0xC8A00B];
for(var j:int=0; j < 31; j++){
var cl=j % arr.length;
this.graphics.beginFill(arr[cl]);
this.graphics.drawRect(j*15,0,15,465);
this.graphics.endFill();
}
this.graphics.lineStyle(15,0xFFFFFF);
this.graphics.moveTo(0,280);
this.graphics.lineTo(130,280);
this.graphics.curveTo(170,230,232,225);
this.graphics.curveTo(292,230,334,280);
this.graphics.lineTo(465,280);
this.graphics.endFill();
}
}
class picDial extends Sprite{
public var thumb:Sprite=new Sprite();
public var base:Sprite=new Sprite();
public function picDial(){
base.graphics.beginFill(0x632645);
base.graphics.drawCircle(0,0,100);
base.graphics.endFill();
base.graphics.beginFill(0xBE064E);
base.graphics.drawCircle(0,0,80);
base.graphics.endFill();
base.graphics.beginFill(0xEF324E);
base.graphics.drawCircle(0,0,60);
base.graphics.endFill();
base.graphics.beginFill(0xF6712E);
base.graphics.drawCircle(0,0,40);
base.graphics.endFill();
base.graphics.beginFill(0xFFB403);
base.graphics.drawCircle(0,0,20);
base.graphics.endFill();
base.graphics.beginFill(0xC8A00B);
base.graphics.drawCircle(0,0,10);
base.graphics.endFill();
addChild(base);
thumb.graphics.beginFill(0xC8A00B);
thumb.graphics.drawCircle(0,-80,35);
thumb.graphics.endFill();
thumb.graphics.drawCircle(0,-70,30);
thumb.graphics.endFill();
thumb.graphics.beginFill(0xBE064E);
thumb.graphics.drawCircle(0,-60,25);
thumb.graphics.endFill();
thumb.graphics.beginFill(0xEF324E);
thumb.graphics.drawCircle(0,-50,20);
thumb.graphics.endFill();
thumb.graphics.beginFill(0xF6712E);
thumb.graphics.drawCircle(0,-40,15);
thumb.graphics.endFill();
thumb.graphics.beginFill(0xFFB403);
thumb.graphics.drawCircle(0,-30,10);
thumb.graphics.endFill();
addChild(thumb);
}
}
class _SP extends Sprite{
public function _SP(arg:uint){
var _tf:TextField = new TextField();
_tf.defaultTextFormat = new TextFormat("Impact",60,0xFFFFFF);
_tf.text=String.fromCharCode(arg+65);
_tf.width=50;
_tf.height=100;
var bmd:BitmapData=new BitmapData(_tf.width,_tf.height,true, 0x00ff6666);
bmd.draw(_tf);
addChild(new Bitmap(bmd));
}
}