웹디자인 강의
Flash 매트릭스 코드[MX]
2003.07.30 18:06

새 문서를 하나 만듭니다. 크기는 상관없습니다. FPS는 24정도로 맞춰주세요. 1초에 24번 진행됩니다.


위 설정처럼 적당히 몇 글자 입력해 주세요.

F8을 눌러 무비클립으로 등록합니다. 이름은 상관없습니다.


Ctrl + L을 눌러 라이브러리 창을 열고, 방금 등록한 무비클립에 커서를 놓고 마우스 오른쪽 버튼으로 클릭하면 나오는 메뉴에서 Linkage...를 선택합니다.

그림처럼 설정합니다.

이번엔 메뉴에서 Linkage... 상단에 있는 Edit를 선택합니다.

타임라인의 첫 프레임을 선택한 후, F6을 눌러 키프레임을 두개 생성합니다. 그리고 액션 스크립트를 기술합니다.
<1 프레임>
bounds=getBounds(_root)
speed=Math.random()*13+Math.random()*13+Math.random()*13+10
_x=Math.random()*_root.stagex
_y=-_root.stagey-Math.random()*_root.stagey*2
_alpha=Math.random()*33+Math.random()*33+Math.random()*33+1
<2 프레임>
_y+=speed
if(_y>_root.stagey+bounds.yMax){
speed=Math.random()*13+Math.random()*13+Math.random()*13+10
_x=Math.random()*_root.stagex
_y=-_root.stagey-Math.random()*_root.stagey*2
_alpha=Math.random()*33+Math.random()*33+Math.random()*33+1
this.removeMovieClip()
}
※ <2 프레임>에서 코드의 흐름이 계속되게 하려면 위의 4줄을, 한 번 진행 후 사라지게 하려면 아래 한 줄을 써주세요.
<3 프레임>
gotoAndPlay(_currentframe-1)

메인 스테이지로 돌아와서 메인 스테이지에 놓인 무비클립을 Delete키로 제거합니다.

타임라인의 첫 프레임을 선택한 후, 액션 스크립트를 기술합니다.
Stage.scaleMode="exactFit"
stagex=Stage.width
stagey=Stage.height
num=100
for(i=0;i<num;i++){
_root.attachMovie("code","code"+i,i)
}

완성작입니다. Ctrl + Enter를 눌러서 결과를 확인합니다.
소스 파일 다운받기