forked from: CUTE PANDA
forked from CUTE PANDA (diff: 1)
ActionScript3 source code
/**
* Copyright MMMMMonchi ( http://wonderfl.net/user/MMMMMonchi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wtHx
*/
// forked from MMMMMonchi's CUTE PANDA
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[SWF(frameRate="40")]
public class FlashTest extends Sprite {
private var ball:Sprite;
private var ball2:Sprite;
private var vx:int=4;
private var vy:int=2;
public function FlashTest() {
ball=new Sprite();
ball2=new Sprite();
ball.graphics.beginFill(0xff00ff,0.4);
ball.graphics.drawCircle(240,150,10);
ball.graphics.endFill();
addChild(ball);
ball.graphics.beginFill(0xff00ff,0.4);
ball.graphics.drawCircle(160,150,10);
ball.graphics.endFill();
addChild(ball);
ball.graphics.beginFill(0xff00ff,0.4);
ball.graphics.drawEllipse(150,150,100,50);
ball.graphics.endFill();
ball.graphics.beginFill(0x0000ff,0.4);
ball.graphics.drawEllipse(170,160,25,30);
ball.graphics.endFill();
ball.graphics.beginFill(0x0000ff,0.4);
ball.graphics.drawEllipse(200,160,25,30);
ball.graphics.endFill();
ball.graphics.beginFill(0xff00ff,0.4);
ball.graphics.drawRect(175,200,50,100);
ball.graphics.endFill();
ball.graphics.lineStyle(2,0xff00ff);
ball.graphics.moveTo(190,300);
ball.graphics.lineTo(190,400);
ball.graphics.moveTo(210,300);
ball.graphics.lineTo(210,400);
ball.graphics.moveTo(175,230);
ball.graphics.lineTo(120,260);
ball.graphics.moveTo(225,230);
ball.graphics.lineTo(280,260);
ball2.graphics.copyFrom(ball.graphics);
ball2.x=200;
addChild(ball);
addChild(ball2);
ball.addEventListener(Event.ENTER_FRAME, move);
ball2.addEventListener(Event.ENTER_FRAME, move);
stage.addEventListener(MouseEvent.CLICK,move2);
stage.addEventListener(MouseEvent.MOUSE_DOWN,move3);
}
private function move(e:Event):void{
ball.x+=vx;
ball.y+=vy;
ball2.x+=vx;
ball2.y+=vy;
}
private function move2(e:MouseEvent):void{
ball.graphics.clear();
vy=-vy;
}
private function move3(e:MouseEvent):void{
vx=-vx;
}
}
}
