배열을 이용한 콜백함수의 선언
배열을 이용하여 복수의 무비클립에 콜백함수를 설정하는 방법.
eval(reference:String) 함수는 전달받은 문자열에 해당하는 객체의 참조를 반환한다. 배열을 이용해 이러한 참조를 기억하고 필요한 속성을 저장하여 콜백함수의 실행에 사용한다.
function initMiscMenu() {
misc = new Array();
miscURL = new Array();
miscURL = new Array("../", "http://google.co.kr", "http://apple.com", "http://ibm.com");
for (var i = 0; i<5; i++) {
misc[i] = eval("misc"+i);
misc[i].href = miscURL[i];
misc[i].onRollOver = function() {
this._alpha = 100;
};
misc[i].onRollOut = function() {
this._alpha = 50;
};
misc[i].onRelease = function() {
trace(this._name+" has clicked!");
trace(this.href);
getURL(this.href);
};
}
}
initMiscMenu();
//배열을 이용하여 무비클립에 개별적인 콜백함수를 생성.
About this entry
You’re currently reading “배열을 이용한 콜백함수의 선언,” an entry on multiplicité
- Published:
- Thursday, June 9th, 2005 at 11:25 am
- This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Korea.
- Author:
- vizualizer
- Category:
- techne
No comments
Jump to comment form | comments rss