Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript (http://www.flasher.ru/forum/forumdisplay.php?f=5)
-   -   ТО ТАКОЕ - Movieclip.prototype ??? (http://www.flasher.ru/forum/showthread.php?t=43736)

llllllllll 16.07.2003 14:40

Я не понимаю что ты хочешь сделать :), не нада хард кодинга :), зачем тебе ASSetPropFlags?, можно объяснить простыми словами?, причем русскими :)

Да и чего там на счет занятости того или иного хандлера? ты вешаешь что-то на MovieClip.ПРОТОТИП? =)

mc1.onEnterFrame = function(){
trace("ooo!!!");
}
MovieClip.prototype.onEnterFrame = function() {
trace(this + " --> x: "+ this._x + " y: " + this._y);
if(this == _level0) MovieClip.prototype.onEnterFrame = null;
}

Естественно это не без недостатков да и не есть решение, а лишь пример, но enterFrame у "mc1" никуда не денется :) и тем более по барабану тому, что написано на onClipEvent(enterFrame) :)

fiot 16.07.2003 15:30

Вложений: 1
llllllllll
зачем я это делаю ...
смотри attach
ASSetPropFlags - закоментарь, увидишь...

Пушистик 16.07.2003 16:10

:)
 
а я подумал что надо все время отслеживать, поэтому OnEnterFrame!
я исходник посмрел....хммм....и зачем там те координаты!

fiot 16.07.2003 16:13

forceX = (forceX+(this.x-this._x)/2)/1.66;
forceY = (forceY+(this.y-this._y)/2)/1.66;
this.x & this.y - это начальные координаты обэекта... вот их и нужно получить ... и сделат readOnly

llllllllll 16.07.2003 16:34

Значится так :)

MovieClip.prototype.addProperty("x",function () {
this.$x = this._x;
ASSetPropFlags(this, ["$x"], 6,1);
return this.$x
},null ); - это чтоб для каждого :)


Это чтоб без того что здесь не нужно ...

MovieClip.prototype.addProperty("y", function () {
if(this.$y == undefined) this.$y = this._y;
return this.$y
}, null);

, а можно и так ...

MovieClip.prototype.getY = function(){
if(this.$y == undefined) this.$y = this._y;
return this.$y;
}

... да и для OnRollOver - HitTest - особо не нужен :)

fiot 17.07.2003 01:07

llllllllll
вот ёлки... а прото this забыл...
про тест хит - это я прогнал...
ЗЫ. спасибо :) :) :)

fiot 17.07.2003 02:49

Код:

MovieClip.prototype.onEnterFrame = function() {
        this.distanceX = _root._xmouse - this._x;
        this.distanceY = _root._ymouse - this._y;
        this.distance  = Math.sqrt(this.distanceX*this.distanceX+this.distanceY*this.distanceY);
        this.powerX    = this._x-this.distanceX/this.distance*magnet/this.distance;
        this.powerY    = this._y-this.distanceY/this.distance*magnet/this.distance;
        this.forceX    = (this.forceX+(this.x-this._x)/2)/1.66;
        this.forceY    = (this.forceY+(this.y-this._y)/2)/1.66;
        ASSetPropFlags(this, ["distanceX","distanceY","distance","powerX","powerY","forceX","forceY"], 1, 1);
        this._x = this.powerX + this.forceX;
        this._y = this.powerY + this.forceY;
};

можно ли как-то эту штуку оптимизировать ???
если можно то как ???

Пушистик 17.07.2003 09:05

а что этот код должен делать????

Пушистик 17.07.2003 09:16

вот так может быть:

Код:

MovieClip.prototype.onEnterFrame = function() {
    this.distanceX = _root._xmouse-this._x;
    this.distanceY = _root._ymouse-this._y;
    this.distance = Math.sqrt(Math.pow(this.distanceX, 2)+Math.pow(this.distanceY, 2));
    this.powerX = this._x-this.distanceX/this.distance;
    this.powerY = this._y-this.distanceY/this.distance;
    this.forceX = (this.forceX+(this.x-this._x)/2)/1.66;
    this.forceY = (this.forceY+(this.y-this._y)/2)/1.66;
    this._x = this.powerX+this.forceX;
    this._y = this.powerY+this.forceY;
};



Часовой пояс GMT +4, время: 22:42.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.