2008/07/22 15:05
Color.setRGB를 확장하여, 기본컬러값 대신 R,G,B 코드, 8진수, html색상코드 입력으로 셋팅할수있게 합니다.
Color.prototype.setRGB2 = function()
{
if(arguments[1] != undefined && arguments[2] != undefined)
{
return this.setRGB(arguments[0]<<16|arguments[1]<<8|arguments[2]);
} else {
var l = arguments[0].length
var a = arguments[0].substring(l,l - 6)
return this.setRGB(parseInt(a,16))
}
}
// -------------
// usage
// -------------
// example 1
c = new Color(_root);
c.setRGB2(255,0,0) // <-- RED
// example 2
c = new Color(_root);
c.setRGB2("0xFFCC00") // <-- ORANGE
// example 3
c = new Color(_root);
c.setRGB2("#FF3300") // <-- RED AGAIN
Color.prototype.setRGB2 = function()
{
if(arguments[1] != undefined && arguments[2] != undefined)
{
return this.setRGB(arguments[0]<<16|arguments[1]<<8|arguments[2]);
} else {
var l = arguments[0].length
var a = arguments[0].substring(l,l - 6)
return this.setRGB(parseInt(a,16))
}
}
// -------------
// usage
// -------------
// example 1
c = new Color(_root);
c.setRGB2(255,0,0) // <-- RED
// example 2
c = new Color(_root);
c.setRGB2("0xFFCC00") // <-- ORANGE
// example 3
c = new Color(_root);
c.setRGB2("#FF3300") // <-- RED AGAIN
'My Job > Flash/Flex' 카테고리의 다른 글
| [AS] MovieClip.prototype.shakeIt (0) | 2008/07/22 |
|---|---|
| [AS] MovieClip.prototype.setTooltip (0) | 2008/07/22 |
| [AS] Color.prototype.setRGB2 (0) | 2008/07/22 |
| [AS] Array.prototype.randomOrder (0) | 2008/07/22 |
| [AS] prototype 함수 - 랜덤컬러, 부드러운 이동 정의 (0) | 2008/07/07 |
| [AS] 이미지 Blur 시키기 - 플래시8 (0) | 2008/07/07 |
TAG ActionScript,
COLOR