Алекс Красс
Просветленный
(40077)
12 лет назад
Прототипы, это жестоко. Никогда не видел их в деле, только псевдоклассы использовал. Для остановки введи переменную счетчик.
var timer = 0;
this.caida_mc.оnEnterFrame=function () {
//....ваш код, в конце добавляем:
timer++;
if(timer > 80){ //80 - количество кадров
this.caida_mc.оnEnterFrame=function () { }; //переписали обработчик как нам нужно или оставляем пустым.
}
}
Вместо переписывания лучше их удалять вообще когда не нужны, но на память не вспомню как это делается.
screen_width=200
screen_height=300
frecuency=0
//
//
MovieClip.prototype.serConfeti=function () {
this._x=Math.ceil(Math.random()*screen_width)
this._xscale=Math.ceil(Math.random()*screen_height)
this._yscale=this._xscale
this.mover()
this.coloreame()
}
function getPorcentaje() {
var numero=Math.ceil(Math.random()*100)
return numero
}
function getOffset() {
var numero=Math.ceil(Math.random()*255)
var buleano=Math.round(Math.random()*1)
if (buleano==1) {
numero=numero*10
}
return numero
}
MovieClip.prototype.coloreame=function () {
var my_color=new Color(this)
var nuevo_color= new Object()
nuevo_color.ra=getPorcentaje()
nuevo_color.rb=getOffset()
nuevo_color.ga=getPorcentaje()
nuevo_color.gb=getOffset()
nuevo_color.ba=getPorcentaje()
nuevo_color.bb=getOffset()
my_color.setTransform(nuevo_color)
}
MovieClip.prototype.mover=function () {
this.onEnterFrame=function () {
if (this._y<400) {
this._y+=5
this._xscale=Math.random()*200
this._rotation=Math.random()*360
} else {
this.removeMovieClip()
}
}
}
MovieClip.prototype.caidaConfeti=function () {
this.createEmptyMovieClip("caida_mc",1)
var count=0
var confCount=1
this.caida_mc.onEnterFrame=function () {
if(count