Просмотр полной версии : создание условия
Всем привет ))
Есть объект clip_mc внутри него прописаны stop а в последнем кадре gotoAndPlay(2). Есть второй объект go_mc.
Помогите написать условие, что бы при наведении курсора на объект go_mc, объект clip_mc переходил внутри себя на второй кадр и к этому же объекту clip_mc приминилась функция:
clip_mc.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
Psycho Tiger
18.03.2009, 23:47
smth.onRollOver=function():Void{
clip_mc.gotoAndStop(2);
clip_mc.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
}
?
Psycho Tiger, основной принцип заработал, объект начал выполнять функцию,
но внутри объекта кадр не перешел на второй фрейм.
А таких объектов сделать несколько, как clip_mc, то в коде просто нужно будет дописать например:
smth.onRollOver=function():Void{
clip_mc.gotoAndStop(2);
clip_mc.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
clip_mc2.gotoAndStop(2);
clip_mc2.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
}
и так далее..?
nOobCrafter
19.03.2009, 12:57
А не проще ли написать цикл если их будет несколько7...
А не проще ли написать цикл если их будет несколько7...
объектов будет несколько, ко всем будет применяться функция перехода на второй фрейм внутри внутри этих clip_mc1,2,3,4..., но только к одному будет еще присваиваться функция
clip_mc.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
nOobCrafter
19.03.2009, 13:16
Ну дык..
smth.onRollOver=function():Void
{
for (var i:number = 1; i < n; i++)
{
_root["clip_mc" + i].gotoAndStop(2);
}
clip_mc.onEnterFrame = function()
{
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x- this._parent._xmouse))*180/Math.PI;
};
}
не, что - то не так, посмотрите, пожалуйста, я прикрепил архивчик, там лежит файл попробуйте этот код на нем, внктри клипа clip_mc делаем еще один клип, назавем его clip и уже там должен делаться переход на второй фрейм. Соответственно меняем код на
smth.onRollOver=function():Void{
clip_mc.clip.gotoAndStop(2);
clip_mc.onEnterFrame = function() {
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
clip_mc2.clip.gotoAndStop(2);
}
Добавлено через 1 минуту
но все равно не перескакивает на второй фрейм..
nOobCrafter
19.03.2009, 14:08
go_mc.onRollOver=function():Void
{ // у тебя ж есть еще вложенный клип m, и именно в нем надо перейти на кадр 2
clip_mc.m.gotoAndPlay(2); // Play
clip_mc.onEnterFrame = function()
{
this._x -= (clip_mc._x-_xmouse)/55;
this._y -= (clip_mc._y-_ymouse)/55;
this._rotation=Math.atan2((this._y-this._parent._ymouse),(this._x-this._parent._xmouse))*180/Math.PI;
};
}
Еще надо дать инснс вложенному клипу с анимацией, я дал имя m
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.