웹마스터 팁

링크 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진수 색상코드가 전달됩니다.

첫번째 링크를 클릭하시면 예제 및 파일을 다운로드 받으실 수 있으며 보다 상세한 설명을 볼 수 있고, 두번째 링크를 클릭하시면 바로 관련 파일만 다운로드 받을 수 있습니다.
제목 글쓴이 날짜
Javascript + 플래시 칼라피커 [6] 행복한고니 2004.10.08
체크박스를 이미지로 사용하기 [7] 행복한고니 2004.10.10
배열 스크립트 종합선물세트 행복한고니 2004.10.12
멀티 파일다운로드 꼼수 (새창버전) [1] 행복한고니 2004.10.14
XP2인지 체크하여 XP2일때는 팝업허용하라는 메시지 뛰워주기 [3] 아돌 2004.10.19
모든 이미지, 텍스트 링크에 점선 없애기 [5] 이강민 2004.10.25
JavaScript 구문강조 효과내기 파우링 2004.10.28
행복한고니님의 체크박스를 이미지로 사용하기를 보고... 체크박스옆에 텍스트 부치기 [2] beMax 2004.10.29
ActiveX 멀티파일업로더 입니다. [9] by風 2004.11.01
홈페이지 나갈때 새창띄우기 [2] piasol 2004.11.07
(수정)배경음악,연월일,시간, 코멘트 셋트.(AM,PM==>오전,오후 순,한국식으로 ...) [4] 민피디 2004.11.10
ActiveX 플래시 이미지캡쳐 컨트롤 iFlower [1] 덴디 2004.11.15
iFlower 윈도우리스 플래시 ActiveX 컨트롤 덴디 2004.11.16
자바스크립트 암호화 [5] 손상모 2004.11.18
로딩중인 페이지에 효과넣기 [4] LUFFY 2004.11.20
이미지 를 브라우져에서 내맘데로 옮겨두기 [8] piasol 2004.12.03
이제 미디어플레이어는 가라? 곰플레이어로 실시간으로 감상하자. [13] ⓣing★™ 2004.12.05
홈페이지를 풀스크린으로 띄우자 - 올플래시로 보이는군요. [21] Multi_Taeji 2004.12.10
마우스를 대면 이미지가 바뀐다. 롤오버 이미지 [3] 하진 2004.12.19
개판 오분전 빙고 [2] 미친개 2004.12.30