U primere, našao sam slajd šou, malo modificirao (da ide automatski, a ne onclick na button). On radi. Zove se auto.swf.
Imam MainMovie (main.swf). Tu je konstrukcija. Imam prazan klip u Library. Ubacim na Stage, dam instance name = AutoShow, u frejmu pišem akciju:
AutoShow.loadMovie("auto.swf");
i sve radi kao što treba.
Ali..... taj autošou (valjda ga znate), menja slike bez pauzu. Znači, fadein pic1, fadeout pic1, fadein pic2...... Meni treba fadein pic1, pauza od X sekunde, fadeout pic1...... Za to koristim još jedan primer (Timer - štoperica) koj dolazi u Fleš paketu.
Ideja je da taj tajmer meri vreme i na odreѓeno vreme da kaže AutoShow.stop(), i AutoShow(play).
Evo koda:
Code:
function restartTimer() {
seconds = 0;
buttonPressTime = getTimer()/1000-pauseLength;
//pause();
}
function pauseTimer() {
pauseTime = getTimer()/1000;
timing = false;
}
function unpause() {
unpauseTime = getTimer()/1000;
pauseLength = (unpauseTime-pauseTime)+pauseLength;
timing = true;
}
_root.onEnterFrame = function() {
totalTime = getTimer()/1000-pauseLength;
goTime = totalTime-buttonPressTime;
//
if (timing) {
seconds = Math.floor(goTime);
trace(seconds);
}
if (seconds==4) {
restartTimer();
pauseTimer();
}
};
function restartTimer() {
seconds = 0;
buttonPressTime = getTimer()/1000-pauseLength;
//pause();
}
function pauseTimer() {
pauseTime = getTimer()/1000;
timing = false;
}
function unpause() {
unpauseTime = getTimer()/1000;
pauseLength = (unpauseTime-pauseTime)+pauseLength;
timing = true;
}
_root.onEnterFrame = function() {
totalTime = getTimer()/1000-pauseLength;
goTime = totalTime-buttonPressTime;
//
if (timing) {
seconds = Math.floor(goTime);
trace(seconds);
}
if (seconds==4) {
restartTimer();
pauseTimer();
}
};
Kad u MainMovie ubacim ovaj tajmer, NE RADI AUTOŠOU. Izbrišem, radi!
Normalno u MainMovie imam sad:
AutoShow i Timer (MovieClips).
U tajmeru, ne vidim nikakav razlog zašto ne bih radio AutoŠou. Pokušao sam da ubacim u dva Layer-a, pokušao sam da napravim novi fajl timer.swf, takoѓe i timer u library.
Evo i koda iz Auto.swf
Code:
//initialize variables and properties
square._alpha = 0;
whichPic = 0;
//initiate change to new image when buttons are clicked
_root.onEnterFrame = function() {
if (whichPic<80 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
if (whichPic<10) {
whichPic="0"+whichPic;
}
}
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<10) {
loadMovie("../images/"+whichPic+".jpg", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
};
s
//initialize variables and properties
square._alpha = 0;
whichPic = 0;
//initiate change to new image when buttons are clicked
_root.onEnterFrame = function() {
if (whichPic<80 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
if (whichPic<10) {
whichPic="0"+whichPic;
}
}
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<10) {
loadMovie("../images/"+whichPic+".jpg", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
};
s
routing protocols enable routers to route routed protocols!