Здравствуйте товарищи, подскажите пожалуйста, как сделать, что бы анимация появления картинки начиналась после ее загрузки, а то картинки появляются резко, пропуская анимацию пока грузятся.
Буду очень благодарен за помощь.

Код AS1/AS2:
//initialize variables and properties
square._alpha = 0;
whichPic = 1;
a = new Array();
loadQuestions = new LoadVars();
loadQuestions.load("coment.txt");
loadQuestions.onLoad = initQuestions;
function initQuestions(questions) {
a[0] = loadQuestions.jpg0;
for (per=1; per<=a[0]; per++) {
a[per] = loadQuestions["jpg"+per];
comenttext = a[1];
}
}
my_interval = setInterval(automat, 3000);
function automat() {
if (whichPic<28 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
input = whichPic;
comenttext = a[whichPic];
}
}
//initiate change to new image when buttons are clicked
next.onPress = function() {
if (whichPic<28 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
input = whichPic;
comenttext = a[whichPic];
}
};
back.onPress = function() {
if (whichPic>1 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic--;
input = whichPic;
comenttext = a[whichPic];
}
};
_root.onEnterFrame = function() {
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 5;
}
if (square._alpha<10) {
loadMovie("images/image"+whichPic+".jpg", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 2;
} else {
fadeIn = false;
}
// limit input field
if (input>27) {
whichpic = 1;
}
// initiate change to new image when Enter key is pressed
if (Key.isDown(Key.ENTER)) {
fadeOut = true;
whichpic = input;
}
};
// if a number is entered in the input field but Enter is not pressed, change
// back to current Photo number when clicking anywhere else
inputField.onKillFocus = function() {
input = whichPic;
};