flash on 2015-7-9
♥0 |
Line 46 |
Modified 2015-07-09 06:46:45 |
MIT License
archived:2017-03-30 11:45:30
ActionScript3 source code
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3PM5
*/
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
vecThing = new Vector.<xThing>(0,false);
var a:xThing; var i:int;
for (i=0;i<64;i++)
{
a = new xThing();
a.cx = 320+i*64; a.cy = Math.random()*430;
vecThing.push(a);
}
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var camx:Number = 0;
public var camy:Number = 0;
public var vecThing:Vector.<xThing>;
public function onEnter(e:Event):void
{
camx += 2;
graphics.clear();
graphics.lineStyle(2, 0);
var sx:Number = 0; var sy:Number = 0;
sx = Math.floor(camx); sy = Math.floor(camy);
graphics.drawRect(0-sx,0,2048, 430);
graphics.drawCircle(32, 230, 16);
var i:int;
for (i=0;i<16;i++)
{ graphics.drawRect((i*160)-sx,0,64, 430); }
var num:int; var a:xThing;
num = vecThing.length;
for(i=0;i<num;i++)
{
a = vecThing[i];
graphics.drawCircle(a.cx-sx,a.cy-sy,8);
if (a.cx > camx) { a.cx -= 2; }
}//nexti
}//onenter
}//classend
}
internal class xThing
{
public var cx:Number = 0;
public var cy:Number = 0;
}//xthing