웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
Javascript + 플래시 칼라피커
2004.10.08 18:28
링크 1 : http://mygony.com/tt/index.php?pl=78&nc=1
링크 2 : http://mygony.com/tt/down.php?attachname=637911.zip
플래시와 연동한 칼라피커 입니다.
우선 소스....
-----------------------------------
/**
* by 행복한고니 (20041008)
*
* Homepage : http://www.mygony.com
*/
var ColorPicker = function() {};
ColorPicker.appendSWF = false;
ColorPicker.show = function(obj, handler) {
if (ColorPicker.path == undefined) ColorPicker.path = "ColorPicker.swf";
if (ColorPicker.align == undefined) ColorPicker.align = "left";
if (ColorPicker.handler == undefined) {
if (handler == undefined) ColorPicker.handler = function(str){};
else ColorPicker.handler = handler;
}
if (ColorPicker.appendSWF == false) ColorPicker.DoAppendSWF();
var X, Y;
var pos = ColorPicker.getOffsetPos(obj);
var W = obj.offsetWidth, H = obj.offsetHeight;
with (ColorPicker) {
align = align.toLowerCase();
layer.style.display = "block";
X = pos.x, Y = pos.y;
if (align == "left") {
Y += H;
} else if (align == "right") {
X = pos.x - (layer.offsetWidth - W);
Y += H;
} else if (align == "top") {
X += W;
} else if (align == "middle") {
X += W;
Y -= Math.round((layer.offsetHeight-H)/2);
} else if (align == "bottom") {
X += W;
Y -= layer.offsetHeight - H;
}
layer.style.top = Y + 'px';
layer.style.left = X + 'px';
}
}
ColorPicker.hide = function() {
if (ColorPicker.appendSWF == false) ColorPicker.DoAppendSWF();
ColorPicker.layer.style.display = "none";
}
ColorPicker.getOffsetPos = function(obj) {
if (obj.offsetParent == null) {
return {"x":obj.offsetLeft, "y":obj.offsetTop};
} else {
var pos = ColorPicker.getOffsetPos(obj.offsetParent);
return {"x":obj.offsetLeft + pos.x, "y":obj.offsetTop + pos.y};
}
}
ColorPicker.DoAppendSWF = function() {
var DIV = document.createElement("DIV");
var BODY = document.getElementsByTagName("BODY")[0];
DIV.innerHTML = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="150" height="130"><param name="movie" value=""+ColorPicker.path+""><param name="quality" value="high"><embed src=""+ColorPicker.path+"" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="130"></embed></object>";
DIV.style.position = "absolute";
DIV.style.display = "none";
ColorPicker.layer = BODY.appendChild(DIV);
ColorPicker.appendSWF = true;
}
-----------------------------------
위 소스를 포함한 후에, 환경설정을 해줄 수 있는데...
-----------------------------------
// settings
ColorPicker.path = 'ColorPicker.swf';
ColorPicker.align = 'right'; // ( left, right, middle, top, bottom)
ColorPicker.handler = userFunc; // default handler
-----------------------------------
위와 같이 설정합니다. 여기서 userFunc 은 사용자가 미리 정의한 함수입니다. 사용자 함수를 정의하실때에는 반드시 한개이상의 전달자가 있어야 합니다. 첫번째 값으로는 '#'를 포함한 16진수 색상코드가 전달됩니다.
첫번째 링크를 클릭하시면 예제 및 파일을 다운로드 받으실 수 있으며 보다 상세한 설명을 볼 수 있고, 두번째 링크를 클릭하시면 바로 관련 파일만 다운로드 받을 수 있습니다.
링크 2 : http://mygony.com/tt/down.php?attachname=637911.zip
플래시와 연동한 칼라피커 입니다.
우선 소스....
-----------------------------------
/**
* by 행복한고니 (20041008)
*
* Homepage : http://www.mygony.com
*/
var ColorPicker = function() {};
ColorPicker.appendSWF = false;
ColorPicker.show = function(obj, handler) {
if (ColorPicker.path == undefined) ColorPicker.path = "ColorPicker.swf";
if (ColorPicker.align == undefined) ColorPicker.align = "left";
if (ColorPicker.handler == undefined) {
if (handler == undefined) ColorPicker.handler = function(str){};
else ColorPicker.handler = handler;
}
if (ColorPicker.appendSWF == false) ColorPicker.DoAppendSWF();
var X, Y;
var pos = ColorPicker.getOffsetPos(obj);
var W = obj.offsetWidth, H = obj.offsetHeight;
with (ColorPicker) {
align = align.toLowerCase();
layer.style.display = "block";
X = pos.x, Y = pos.y;
if (align == "left") {
Y += H;
} else if (align == "right") {
X = pos.x - (layer.offsetWidth - W);
Y += H;
} else if (align == "top") {
X += W;
} else if (align == "middle") {
X += W;
Y -= Math.round((layer.offsetHeight-H)/2);
} else if (align == "bottom") {
X += W;
Y -= layer.offsetHeight - H;
}
layer.style.top = Y + 'px';
layer.style.left = X + 'px';
}
}
ColorPicker.hide = function() {
if (ColorPicker.appendSWF == false) ColorPicker.DoAppendSWF();
ColorPicker.layer.style.display = "none";
}
ColorPicker.getOffsetPos = function(obj) {
if (obj.offsetParent == null) {
return {"x":obj.offsetLeft, "y":obj.offsetTop};
} else {
var pos = ColorPicker.getOffsetPos(obj.offsetParent);
return {"x":obj.offsetLeft + pos.x, "y":obj.offsetTop + pos.y};
}
}
ColorPicker.DoAppendSWF = function() {
var DIV = document.createElement("DIV");
var BODY = document.getElementsByTagName("BODY")[0];
DIV.innerHTML = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="150" height="130"><param name="movie" value=""+ColorPicker.path+""><param name="quality" value="high"><embed src=""+ColorPicker.path+"" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="130"></embed></object>";
DIV.style.position = "absolute";
DIV.style.display = "none";
ColorPicker.layer = BODY.appendChild(DIV);
ColorPicker.appendSWF = true;
}
-----------------------------------
위 소스를 포함한 후에, 환경설정을 해줄 수 있는데...
-----------------------------------
// settings
ColorPicker.path = 'ColorPicker.swf';
ColorPicker.align = 'right'; // ( left, right, middle, top, bottom)
ColorPicker.handler = userFunc; // default handler
-----------------------------------
위와 같이 설정합니다. 여기서 userFunc 은 사용자가 미리 정의한 함수입니다. 사용자 함수를 정의하실때에는 반드시 한개이상의 전달자가 있어야 합니다. 첫번째 값으로는 '#'를 포함한 16진수 색상코드가 전달됩니다.
첫번째 링크를 클릭하시면 예제 및 파일을 다운로드 받으실 수 있으며 보다 상세한 설명을 볼 수 있고, 두번째 링크를 클릭하시면 바로 관련 파일만 다운로드 받을 수 있습니다.
댓글 6
제목 | 글쓴이 | 날짜 |
---|---|---|
스킨 시스템 구축.(1탄 읽어오기) [11] | 씨파개 | 2003.05.13 |
Wake On Lan 기능 사용하기... [3] | sMokaHallo | 2003.05.17 |
썸네일 자동생성하고 이미지 사이즈 자동 줄이기... [6] | sMokaHallo | 2003.05.21 |
홈페이지의 내용을 DB에 담기 [15] | 세죠위그이 | 2003.05.30 |
체크박스등으로 배열로 변수를 넘길때.. [1] | myself2 | 2003.06.06 |
php 로 기존 문서 포함시키기 [10] | 이성헌 | 2003.06.08 |
PHP 익히기 1 [24] | 구리구리 | 2003.06.09 |
PHP 익히기 2 [9] | 구리구리 | 2003.06.10 |
PHP 익히기 3 [11] | 구리구리 | 2003.06.17 |
이미 인클루드된 파일은 다시 인클루드하지 않기 [14] | 김병희 | 2003.06.20 |
htmlspecialchars 사용하시는 분들 [5] | holies | 2003.07.11 |
Thumbnail 생성하기 - 수정^^; [9] | holies | 2003.07.11 |
'와 "의 속도 차이?! [6] | holies | 2003.07.12 |
초간단 php 랜덤 이미지 및 랜덤 배경이미지 소스 [6] | 거금도 | 2003.07.24 |
다른 사이트에 있는 파일 읽어오기 [50] | 김규백 | 2003.07.25 |
스킨 시스템 사용하기 [2] | 김규백 | 2003.07.25 |
제로보드 + MSN 메신저 (작성글에 리플이나 코멘트가 달리면 MSN으로 알려준다?)
[18]
![]() | HungryMania | 2003.08.01 |
체널을 응용해서 tmain.php?tdb=test&db=src 식으로 쓰기 [12] | 9000㎒ | 2003.08.01 |
$i++ !== $i += 1 [14] | 플로렐라 | 2003.08.04 |
개판 오분전 정규식(4) | 미친개 | 2003.08.07 |