참고글: fIRC (Flash IRC Client) 배포합니다.
http://blog.arzz.com/289개조한지는 조금 됐는데 이제서야 포스팅을 해서 좀 죄송스럽다;
개선사항:
- 닉을 param 태그로 지정 가능하도록 변경
- 채팅시 ':'문자 처리에 있어서 더 심플-_-하게 수정(이 부분은 본인이 수정한 다음에 발생한 문제를 나름대로 해결하는 과정에서 바뀌어버렸음)
- highlighting(호출) 지원. 소리도 나고 붉은 글자로 찍힌다
- Flash 크기를 지정해주면 알아서 레이아웃을 늘리거나 줄이도록 변경
일부는 원 제작자이신
알쯔님이 새로 제작중이신 fIRC2에서 이미 적용된 부분이지만 일부는 아직 적용이 안된듯해서 걍 수정해봤다.
GPL을 따른다고 하셨으니 수정해서 배포해도 괜찮겠지 ㅌㅌ
수정된 부분
1 프레임의 ActionScript
18c18,19
< var nick = "g"+Math.ceil(Math.random()*1000000);
---
> //var nick = "g"+Math.ceil(Math.random()*1000000); // commented by gwangyi: nick is set outside of flash
> var nick = (loaderInfo.parameters["nick"] ? loaderInfo.parameters["nick"] : ("g"+Math.ceil(Math.random()*1000000)))
77a79,83
> // ETC Setting added by gwangyi
> var Encoding:String;
> var Nudge:flash.media.Sound;
> var StretchSkin:Boolean;
>
134c140
< socket.writeMultiByte(str+"\n","euc-kr");
---
> socket.writeMultiByte(str+"\n",Encoding);
277c283
< var str = socket.readMultiByte(socket.bytesAvailable, "euc-kr");
---
> var str = socket.readMultiByte(socket.bytesAvailable, Encoding); // modified by gwangyi: support multiple encoding
364,366c370,376
< for (k=2, loopTotal=t1.length;k<loopTotal;k++) {
< t2+= t1[k];
< if (loopTotal-1!=k) t2+= ":";
---
> t1[2] = t1.slice(2).join(":");// modified by gwangyi
> t2 += DeleteHtml(t1[2]); // modified by gwangyi
> if(t1[2].match(new RegExp("\\b" + nick + "\\b", "i")))
> {
> if(Nudge)
> Nudge.play();
> t2 = "<b><font color=\"#ff0000\">" + t2 + "</font></b>"
368,369c378
< t2 = DeleteHtml(t2);
< IRCInsertText(t2);
---
> IRCInsertText(t2);
495a505,511
> Encoding = Setup.CONNECT.ENCODING; // modified by gwangyi: support of multiple encoding
> if(!Encoding) Encoding = "utf-8"; // modified by gwangyi: support of multiple encoding
>
> var nudge = Setup.ETC.NUDGE // modified by gwangyi: adding highlight effect
> if(nudge) Nudge = new flash.media.Sound(new flash.net.URLRequest(nudge)) // modified by gwangyi: adding highlight effect
>
> StretchSkin = (Setup.LAYOUT.SKIN.@stretch == "true") // modified by gwangyi: 스킨 늘리기
498c514
< Security.loadPolicyFile(server+"/security.xml");
---
> Security.loadPolicyFile("http://"+server+"/security.xml");
2 프레임의 ActionScript
function resizeHandler(event:Event)
{
ChatBox.move(-stage.stageWidth/2 + 325 + 5, -stage.stageHeight/2 + 250 + 35)
ChatBox.setSize(stage.stageWidth - 160, stage.stageHeight - 65)
ChatTitle.move(-stage.stageWidth/2 + 325 + 5, -stage.stageHeight/2 + 250 + 10)
ChatTitle.setSize(stage.stageWidth - 10, ChatTitle.height)
UserList.move(stage.stageWidth/2 + 325 - 150, -stage.stageHeight/2 + 250 + 35)
UserList.setSize(UserList.width, stage.stageHeight - 100)
TalkBox.move(-stage.stageWidth/2 + 325 + 5, stage.stageHeight/2 + 250 - 25)
TalkBox.setSize(stage.stageWidth - 230, TalkBox.height)
TalkSubmit.move(stage.stageWidth/2 + 325 - 220, stage.stageHeight/2 + 250 - 25)
skinLoader.content.x = -stage.stageWidth/2 + 325;
skinLoader.content.y = -stage.stageHeight/2 + 250;
if(StretchSkin)
{
skinLoader.content.width = stage.stageWidth;
skinLoader.content.height = stage.stageHeight;
}
}
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE
stage.addEventListener(Event.RESIZE, resizeHandler)
resizeHandler(null)
설정 파일 예제는
http://www.esperanza.kr/~gwangyi/setup.xml 을 참조