Strona 1 z 1

load var

: czw paź 26, 2006 2:21 pm
autor: d2eno
panowie mistrzowie
dlaczego nie moge przeijac wiecej niz 5 jpg'ow?

wartosc INPUT nic nie zmienia



//initialize variables and properties
square._alpha = 0;
whichPic = 1;
//initiate change to new image when buttons are clicked
next.onPress = function() {
if (whichPic<5 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
input = whichPic;
}
};
back.onPress = function() {
if (whichPic>1 && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic--;
input = 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 -= 10;
}
if (square._alpha<10) {
loadMovie("../trans/trans"+whichPic+".jpg", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
// limit input field
if (input>6) {
input = 6;
}
// 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;
};

Re: load var

: pn lis 27, 2006 4:26 pm
autor: SzamanGN
Masz rację zmiana wielkości INPUT nic nie daje. Aby rozwiązać problem musisz dokonać zmiany w kodzie przycisku ”next”.
//initiate change to new image when buttons are clicked
next.onPress = function() {
if (whichPic<5 && !fadeIn && !fadeOut) {

Sugerowałbym zamiast liczby 5 wstawić INPUT oraz:

1. usunąć (jeżeli nie potrzebujesz limitów):
// limit input field
if (input>6) {
input = 6;
}

A na początku kodu, po:
//initialize variables and properties
square._alpha = 0;
whichPic = 1;

dopisać jeszcze:
INPUT=tyle ile masz zdjęć;

2. Lub (jeżeli potrzebujesz limit obrazków), zmień warunek w:
// limit input field
if (input>6) {


Powodzenia