何かのぱた~ん
♥0 |
Line 54 |
Modified 2009-07-18 17:24:11 |
MIT License
archived:2017-03-20 14:23:09
ActionScript3 source code
/**
* Copyright sw_lucchini ( http://wonderfl.net/user/sw_lucchini )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/sUYH
*/
package {
import flash.display.Sprite;
[SWF(width=465, height=465, backgroundColor=0xFFFFFF)]
public class Main extends Sprite {
private var col1:uint = 0xFF0000;
private var col2:uint = 0x00FF00;
private var col3:uint = 0x0000FF;
private var col4:uint = 0x000000;
private var cnt:uint = stage.stageWidth / 5 - 1;
private var box:Box;
public function Main() {
init();
}
private function init():void
{
for (var i:int = 1; i < cnt; i++) {
for (var j:int = 1; j < cnt; j++) {
var sum:uint = (i - 1) * cnt + j;
if (sum % 3 == 0 && sum % 5 == 0) {
box = new Box(col1);
box.x = (j - 1) * box.width;
box.y = (i - 1) * box.width;
addChild(box);
}else if (sum % 3 == 0) {
box = new Box(col2);
box.x = (j - 1) * box.width;
box.y = (i - 1) * box.width;
addChild(box);
}else if (sum % 5 == 0) {
box = new Box(col3);
box.x = (j - 1) * box.width;
box.y = (i - 1) * box.width;
addChild(box);
}else {
box = new Box(col4);
box.x = (j - 1) * box.width;
box.y = (i - 1) * box.width;
addChild(box);
}
}
}
}
}
}
import flash.display.Sprite;
class Box extends Sprite
{
public function Box(col:uint)
{
graphics.beginFill(col);
graphics.drawRect(0, 0, 5, 5);
graphics.endFill();
}
}