웹마스터 팁
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
-
덜렁이
2004.10.16 02:40
많은 도움이 되겠군요. 사용 할 때 주석과 고니님 링크는 빼지 않겠습니다. 감사! ^^* -
†천상의燦†
2004.10.09 20:54
링크가 안 열립니다 ㅠㅠ -
행복한고니
2004.10.10 20:25
†천상의燦† // 서버가 죽어있었습니다. ㅠ_ㅠ
다시 살렸으니 보시면 될 것 같습니다. -
†천상의燦†
2004.10.11 00:47
저 알집 최신버전인데요. 다운이 안된다는데요 ㅠㅠ
에러가 걸려요. -
예뜨락
2004.10.12 15:58
앙증맞은 크기에 아주 좋은데요 ^^
고니님 팁하구 강의는 항상 좋은 도움이 되네요 -
위대한위선자
2004.10.19 10:35
좋습니다. 추천 ~~~~~
제목 | 글쓴이 | 날짜 |
---|---|---|
플래시를 이용한 최근게시물 구현 [6] | 한그림 | 2010.10.13 |
플래시, 선택박스(??)가 로그인 박스 등을 튀어 나올 때 [4] | hhgyu | 2010.08.26 |
플래시 뒤로 로그인창 숨는 문제 [5] | 김지훈295 | 2010.02.25 |
[수정] 쉽게 간단하게(?) 플래시 그래프를 게시판에 넣어 보세요 ^^ [3] | 상오기 | 2009.08.27 |
플래시 랜덤하게 불러오기 [9] | 선비숨결 | 2009.04.21 |
D-DAY 플래시 | 세츠카 | 2009.02.09 |
메뉴활성화에 따라 원하는 위치에 레이어 넣고 바꾸기.. 왼쪽 플래시 메뉴 메뉴따라서 바꾸기 [4] | 만쓰별(정만) | 2009.01.24 |
자신의 홈페이지에 플래시 오락실을 등록 해보자. [2] | 조성우371 | 2008.12.20 |
플래시 BGM 음악 제로보드에 넣는 방법 | 푸른커튼 | 2008.10.29 |
[해결됨]첨부파일 등록이 안될때 (플래시 플레이어 버전문제) [29] [1] | 똑디 | 2008.10.27 |
메인화면에 플래시 쉽게 삽입하는 방법.. [12] | 청개구리00 | 2008.08.30 |
제로보드와 플래시 게시판 연동해서 사용하기 [5] | Park Ki-tae | 2008.05.30 |
FF에서 플래시 로딩 못하는 현상 해결방법 [3] | hangoon | 2008.04.13 |
플래시 컨트럴 활성화하라는 메시지 없애기 [4] | 달구벌 | 2008.04.08 |
플래시로 페이지에 랜덤 이미지 돌리기 [3] | ☜ TeRy ☞ | 2008.04.04 |
플래시 Embed패치(이올라스) 충돌에 의한 파일첨부버튼 해결법 [2] | Guns | 2008.03.18 |
제로보드 XE에 연동 가능 채팅, 100% 플래시, 1:1 채팅 지원, 필요하면 음성/화상 채팅 지원 [2] | digirave | 2008.03.09 |
제로보드용 플래시시계 위젯 설치방법 | 푸른커튼 | 2008.02.12 |
아날로그 플래시 시계 10종류 (홈페이지, 블로그용) | 푸른커튼 | 2008.02.09 |
메뉴에 플래시 적용하기 [7] | 지허 | 2007.10.23 |