Created
September 13, 2011 02:23
-
-
Save itoz/1213008 to your computer and use it in GitHub Desktop.
透明画像
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*============================================================ | |
* copyright(c) 2011 www.itoz.jp | |
* @author itoz | |
*============================================================ | |
*/ | |
package jp.itoz.display | |
{ | |
import flash.display.Sprite; | |
import flash.display.Shape; | |
/** | |
* 背景透過を表す格子状Viewクラス | |
*/ | |
public class TranceparentGrid extends Sprite | |
{ | |
private var _bgColor : int = 0xffffff; | |
private var _squareColor : int = 0xefefef; | |
public function TranceparentGrid() | |
{ | |
} | |
public function draw(sizeW : int, sizeH : int, span : int=10) : void | |
{ | |
this.graphics.clear(); | |
this.graphics.beginFill(_bgColor); | |
this.graphics.drawRect(0, 0, sizeW, sizeH); | |
this.graphics.endFill(); | |
this.graphics.beginFill(_squareColor); | |
var pretd : Number = (sizeW) / span; | |
var pretr : Number = (sizeH) / span; | |
var td : int = ( pretd == int(pretd) ) ? pretd : int(pretd + 1); | |
var tr : int = ( pretr == int(pretr) ) ? pretr : int(pretr + 1); | |
for (var i : int = 0; i < tr; i++) { | |
for (var j : int = 0; j < td; j++) { | |
if (i % 2 == 0) { | |
if (j % 2 == 0) { | |
this.graphics.drawRect(j * span, i * span, span, span); | |
} | |
} | |
else { | |
if (j % 2 == 1) { | |
this.graphics.drawRect(j * span, i * span, span, span); | |
} | |
} | |
} | |
} | |
this.graphics.endFill(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment