Цитата:
Сообщение от maximrouf
Спасибо за оперативный ответ.
- Тут лежит исходник, в нем буквально 30 строчек кода для генерации снежинок.
Снежинки убиваются после выхода за пределы.
|
ууу... для начала, - переходи на AS2.0 хотя бы - тоже мёртвый язык, но хотя бы используемый так или иначе.
во-вторых, посмотри и оттестируй потерю оперативы при таком коде:

Код AS1/AS2:
function randomNumb(min, max) {
var number:Number = Math.random()*(max-min)+min;
return number;
}
function mover() {
firstTime = 1;
this._y += this.speed;
this.xCounter += this.step;
this._rotation += this.vrash;
if (this.xCounter>20) {
this.step = -1;
this.xSpeed *= -1;
this.vrash = 1;
}
if (this.xCounter<-20) {
this.step = 1;
this.xSpeed *= -1;
this.vrash = -1;
}
if (this.xCounter<10 && this.xCounter>-10) {
this._x += this.xSpeed/2;
}
if ((this.xCounter<=-10 && this.xCounter>=-15) || (this.xCounter>=10 && this.xCounter<=15)) {
this._x += (this.xSpeed/4);
}
if (this.xCounter>15 || this.xCounter<-15) {
this._x += (this.xSpeed/6);
}
if (this._y>(Stage.height+this._height)) {
reStart(this);
}
}
function reStart(clip, rotat) {
clip._x = randomNumb(0, Stage.width);
clip._y = -clip._height;
clip.speed = randomNumb(1/5, 1/2);
clip.xSpeed = clip.speed*2*clip.step;
clip._xscale = clip._yscale=randomNumb(25, 50);
clip._alpha = randomNumb(50, 100);
if (rotat) {
clip._rotation = randomNumb(-59, 59);
}
if (firstTime == underfined) {
clip._y = randomNumb(0, Stage.height);
}
}
function step() {
var myStep = Math.random();
if (myStep>0.5) {
myStep = 1;
} else {
myStep = -1;
}
return myStep;
}
function myBg(n) {
var bg:MovieClip = this.createEmptyMovieClip("bg", 0);
var dep:Number = 0;
for (i=0; i<n; i++) {
var snowflake1:MovieClip = bg.attachMovie("snowflake1", "snowflake1"+i, dep++);
snowflake1.step = step();
reStart(snowflake1, true);
snowflake1.xCounter = randomNumb(-20, 20);
snowflake1.onEnterFrame = mover;
}
}
myBg(30);
только символ снежинки создай изначально правильно, что б экспортировался для AS и грузился в первый кадр + дополни прилипание =)