![]() |
|
||||||||||
|
|||||
|
Регистрация: Dec 2007
Сообщений: 27
|
Мувик показывает случайным образом картинки с эффектом плавного перехода. Ест где-то память. Когда я подгружаю 6ть таких мувиков то это сразу заметно, когда один приходится подождать, но все равно ест. Где не пойму. Вроде все чищу.
var ind:Number = 0;
var ind0:Object = NULL;
var ind1:Object = NULL;
var pri:Number = 0;
// длинна кнопки
var BTNW:Number = 166;
// высота кнопки
var BTNH:Number = 100;
// интервал
my_interval = setInterval(automat1, (Math.floor(Math.random()*5+1)*1000));
// оздает загрузчик клипа
var loader:MovieClipLoader = new MovieClipLoader;
// добавляет в загрузчик обработчик событий
loader.addListener(this);
// гружу первую картинку сразу
rand_file = Math.random();
rand_file = rand_file * 11;
rand_file = Math.floor(rand_file);
var pict_mc:MovieClip = createEmptyMovieClip("pict_mc",-1);
loader.loadClip(rand_file+".jpg","pict_mc");
function automat1() {
rand_file = Math.random();
rand_file = rand_file * 11;
rand_file = Math.floor(rand_file);
var pict_mc:MovieClip = createEmptyMovieClip("pict_mc"+ind,ind);
loader.loadClip(rand_file+".jpg","pict_mc"+ind);
if (pri > 1) {
pri = 0;
}
if (pri == 0) {
//удаляю мувик
ind0.removeMovieClip();
ind0 = _root["pict_mc"+ind];
}
if (pri == 1) {
//удаляю мувик
ind1.removeMovieClip();
ind1 = _root["pict_mc"+ind];
}
pri++;
ind++;
_root["pict_mc"+ind]._x=0;
}
function onLoadInit(_pic:MovieClip) {
_pic._width = BTNW;
_pic._height = BTNH;
_pic._alpha=0;
_pic.onEnterFrame = function() {
if (_pic._alpha<100) {
_pic._alpha += 10;
} else {
delete _pic.onEnterFrame;
}
};
}
|
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
Проверьте области видимости.
|
|
|||||
|
Регистрация: Dec 2007
Сообщений: 27
|
переписал верхнюю чушь на это
var ind:Number = 0;
var ind0:Object = NULL;
var ind1:Object = NULL;
var pri:Number = 0;
// длинна кнопки
var BTNW:Number = 166;
// высота кнопки
var BTNH:Number = 100;
// интервал
// оздает загрузчик клипа
var loader:MovieClipLoader = new MovieClipLoader;
// добавляет в загрузчик обработчик событий
loader.addListener(this);
// гружу первую картинку сразу
rand_file = Math.random();
rand_file = rand_file * 11;
rand_file = Math.floor(rand_file);
var pict_mc = createEmptyMovieClip("pict_mc",-1);
loader.loadClip(rand_file+".jpg",this.pict_mc);
function automat1() {
rand_file = Math.random();
rand_file = rand_file * 11;
rand_file = Math.floor(rand_file);
pict_mc = createEmptyMovieClip("pict_mc"+ind,ind);
trace(pict_mc);
loader.loadClip(rand_file+".jpg","pict_mc"+ind);
ind0 = pict_mc;
trace("automat " + ind0);
ind++;
_root["pict_mc"+ind]._x=0;
}
function onLoadInit(_pic:MovieClip) {
_pic._width = BTNW;
_pic._height = BTNH;
_pic._alpha=0;
_pic.onEnterFrame = function() {
if (_pic._alpha<100) {
_pic._alpha += 10;
} else {
delete _pic.onEnterFrame;
}
};
trace("удаляю " + _root["pict_mc"+(ind-3)]._width);
_root["pict_mc"+(ind-3)].removeMovieClip();
}
my_interval = setInterval(automat1, (Math.floor(Math.random()*5+1)*1000));
|
![]() |
![]() |
Часовой пояс GMT +4, время: 12:58. |
|
|
« Предыдущая тема | Следующая тема » |
|
|