현탱™
접속 : 4364   Lv. 68

Category

Profile

Counter

  • 오늘 : 38 명
  • 전체 : 6811105 명
  • Mypi Ver. 0.3.1 β
[ 플래시 강좌] 연결 플짤 as3.0 우클릭시 메뉴 갤록, 정지, 재생 강좌 (fla) swf (0) 2011/03/17 AM 02:41

import fl.video.VideoEvent;
//비디오 이벤트를 불러오는거에요
var _Array:Array = [
"http://ckdudgns77.tistory.com/attachment/cfile23.uf@181E380C4AEEA11177BC7F.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile24.uf@1421400C4AEEA11A9EBFCC.FLV",



"http://ckdudgns77.tistory.com/attachment/cfile5.uf@16263C0C4AEEA12582F0B3.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile2.uf@2025EE0C4AEEA12D9E5AB3.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile2.uf@112D090C4AEEA137471742.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile9.uf@1428600C4AEEA14078F692.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile★1.uf@2019820C4AEEA1489D2DE9.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile4.uf@1329EB0C4AEEA14F808203.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile25.uf@2035770C4AEEA15950FDA3.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile21.uf@162A7E0C4AEEA16284A803.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile28.uf@1326790C4AEEA16B799724.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile9.uf@1729EF0C4AEEA17665ADF9.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile9.uf@192F7D0C4AEEA17F3AC509.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile6.uf@1121400C4AEEA1869FA128.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile4.uf@1626890C4AEEA18D5CF71D.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile23.uf@1425C90C4AEEA197B69FF6.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile3.uf@1825EE0C4AEEA19D9FA503.FLV",


"http://ckdudgns77.tistory.com/attachment/cfile6.uf@111B360C4AEEA1A18B5945.FLV"
];
//제가 영상 분할 해 놓은게 이거밖에 없어서 매번 쓰네요;
var i:int = 0;
var l:int = _Array.length;
//위에 영상 배열의 길이를 뽑아내는 거에요


var qqq:Boolean = false;
var www:Boolean = true;





mov1.addEventListener(fl.video.VideoEvent.COMPLETE, _complete1);
mov2.addEventListener(fl.video.VideoEvent.COMPLETE, _complete2);
//각각 할당된 영상이 끝나면 특정한 함수가 실행되도록 이벤트리스너를 달아줘야해요
mov1.load(_Array[i+1]);
mov2.play(_Array[i]);
mov1.visible = false;
mov2.visible = true;
//_Array[i+1]을 먼저 로드해서 플레이 시키면 틈을 약간 줄일수 있어요
//그리고 배열에서 [0]은 첫번째 원소, [1]은 두번째 원소라는거 주의해 주세요
function _complete1(e:fl.video.VideoEvent):void
{
i++;
trace(i);
mov1.load(_Array[i+1]);
//역시 먼저로드를 해요
mov1.visible = false;
//끝났는데 보이면 안되죠
mov2.play();
//그리고 다른걸 재생시켜요
mov2.visible = true;
//다른건 보여야 되죠
if (i == l)
//만약 영상이 끝났을경우를 위해 달아주는거에요
{
trace("끝");
i=0;
//처음으로 돌리는거에요
mov2.play(_Array[i]);
//i가 0이라 했으니 첫번째 주소를 플레이해요
mov1.load(_Array[i+1]);
//다른건 두번째 영상을 준비하고요
mov1.visible = false;
mov2.visible = true;
//그다음 보이는 걸 설정해줘요
}
else if (i == l-1)
//이건 영상이 끝나기전 부분을 위해 달아줘요
//왜냐하면 저 위대로만 놓으면 끝나고 나서 잠깐 중간영상이 보일수 있기 때문이에요
{
mov1.load(_Array[0]);
mov2.play(_Array[i]);
mov1.visible = false;
mov2.visible = true;
}
}
function _complete2(e:fl.video.VideoEvent):void
{
i++;
mov2.load(_Array[i+1]);
mov1.play();
mov2.visible = false;
mov1.visible = true;
trace(i);
if (i == l)
{
trace("끝");
i=0;
mov1.play(_Array[i]);
mov2.load(_Array[i+1]);
mov2.visible = false;
mov1.visible = true;
}
else if (i == l-1)
{
mov2.load(_Array[0]);
mov1.play(_Array[i]);
mov2.visible = false;
mov1.visible = true;
}
}
//이것은 마찬가지니까 설명을 안할께요




우클릭 메뉴







var myContextMenu:ContextMenu = new ContextMenu();
var myItem1:ContextMenuItem = new ContextMenuItem("현탱™");
myItem1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function 납치(e:ContextMenuEvent):void {navigateToURL(new URLRequest("http://ruliweb.daum.net/mypi/mypi.htm?id=ido3411"))});
var myItem2:ContextMenuItem = new ContextMenuItem("재생/정지");
myItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, playAndStopHandler);
myContextMenu.customItems.push(myItem1);
myContextMenu.customItems.push(myItem2);
myContextMenu.hideBuiltInItems();
this.contextMenu = myContextMenu;

//myItem1:ContextMenuItem = 자기 이름, or 닉네임

//URL = 자기 홈페이지
function playAndStopHandler(e:ContextMenuEvent):void





{if (www)
{
if (!qqq)
{
mov2.pause();
trace("mov2 pause");
}
else
{
mov1.pause();
trace("mov1 pause");
}
www = false;
trace("pause");
}
else
{
if (!qqq)
{
mov2.play();
trace("mov2 play");
}
else
{
mov1.play();
trace("mov1 play");
}
trace("play");
www = true;
}
}





완성본













인스턴트 네임은 mov1, mov2를 주었고 이대로 따라만 해준다면 됩니다.












신고

 
X