|
|
| |
onEnterFrameÀÇ Á¦°Å - this - parent |
|
|
|
13³â Àü |
onEterFrame À̺¥Æ®¸¦ ÀûÀýÇÑ ½ÃÁ¡¿¡¼ Á¦°Å.
->ºÎµå·¯¿î ¿òÁ÷ÀÓ.. (¸ñÀûÁö±îÁö µµÂøÈÄ¿£ ÇÊ¿ä°¡ ¾ø´Â ¾×¼Ç)
delete this.onEnterFrame;
----------------------------------------------------------------------------------------
¿¹Á¦1)
_root._mc.count = 0;
_root._mc.onEnterFrame = function(){
this._x = this._x + 0.2 *(500 - this._x);
//°ÅÀÇ ¸ñÀûÁö¿¡ µµÂøÇϸé, ¸Å ÇÁ·¹ÀÓ¸¶´Ù ÇÒ ÀÏ Á¦°Å
if ( ++this.count > 30 ){
this._x = 500;
delete this.onEnterFrame;
}
};
// ¼Óµµ°è¼ö°¡ 0.2À϶§´Â ´ë·« 30ÇÁ·¹ÀÓÁ¤µµ¸é ¸ñÀûÁö¿¡ µµ´ÞÇÑ´Ù
----------------------------------------------------------------------------------------
¿¹Á¦2)
/* ÀϹÝÀûÀÎ ÄÚµù
_root._mc.onEnterFrame = function(){
this._x = this._x + 0.2* (this.tx - this._x);
this._y = this._y + 0.2 * (this.ty - this._y);
};
_root._mc.onMouseDown = function(){
this.tx = _root._xmouse;
this.ty = _root._ymouse;
}; */
/* ¸¶¿ì½º¸¦ ´©¸£¸é
¸¶¿ì½º À§Ä¡¸¦ tx, ty·Î ÀúÀåÇϱâ
_mc´Â ¸Å ÇÁ·¹ÀÓ¸¶´Ù tx, ty·Î ºÎµå·´°Ô À̵¿ÇÑ´Ù.
¸ñÀûÁö¿¡ µµÂøÇϸé, ¸Å ÇÁ·¹ÀÓ¸¶´Ù ÇÒ ÀÏ Á¦°Å. */
_root._mc.onMouseDown = function(){
this.tx = _root._xmouse;
this.ty = _root._ymouse;
this.count = 0;
this.onEnterFrame = function(){
this._x = this._x + 0.2 * (this.tx - this._x);
this._y = this._y + 0.2 * (this.ty - this._y);
// 30ÇÁ·¹ÀÓ Áö³ ÈÄ ¸ñÀûÁö µµÂøÇϸé onEnterFrame Á¦°Å
if ( ++this.count > 30){
delete this.onEnterFrame;
}; //if
};//onEnterFrame
}; //onMouseDown
=======================================================================================
<this >
- ¿øÄ¢ : ÇÁ·¹ÀÓÀ» Æ÷ÇÔÇÏ´Â ¹«ºñŬ¸³
- ¿¹¿Ü : {ÄݹéÇÔ¼ö ¾È¿¡¼}{¸í½ÃÀûÀ¸·Î(this¸¦ ¾´°æ¿ì) ¾´ this} ´Â ÄݹéÇÔ¼ö¸¦ È£ÃâÇÑ °´Ã¼¸¦ °¡¸®Å²´Ù.
this ´Â »ý·«ÀÌ °¡´ÉÇÏ´Ù.
¸ðµç º¯¼ö´Â ÁÖÀÎÀ» °¡Áø´Ù ==> ÁÖÀÎÀº ¹«ºñŬ¸³ÀÌ µÈ´Ù.
_root.bird_mc.onEnterFrame = function(){
bbb = 20; ==>_root.bbb = 20;
this.bbb = 30; ==>¿¹¿ÜÀÇ this (_root.bird_mc.bbb = 30;)
};
=======================================================================================
* Àý´ë°æ·Î : _rootºÎÅÍ ½ÃÀÛÇؼ °¢ ¹«ºñÅ©¸³µéÀ» Á¢±ÙÇØ °¡´Â ¹æ¹ý
* »ó´ë°æ·Î : _root¸¦ »ç¿ëÇÏÁö ¾Ê°í this¿Í _parent(ÇöÀç °¡¸®Å°°í ÀÖ´Â ¹«ºñŬ¸³ÀÇ ÇÑ´Ü°è À§ÀÇ ¹«ºñŬ¸³)¸¦
ÀÌ¿ëÇؼ Á¢±Ù
_root.bird_mc.onMouseDown = function(){
this.aaa = 10; ==> _root.bird_mc.aaa = 10;
this._parent.aaa = 30; ==>_root.aaa = 30;
ccc = 50; ==>_root.ccc = 50;
};
|
|
̵̧ : 454 |
̵̧
¸ñ·Ï
|
|
| |
|