Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2004
    Messaggi
    177

    Esempio in Flash MX [6.0]

    Parlo di load_image.fla

    l'azione per caricare le varie immagini è:
    codice:
    //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("../images/image"+whichPic+".jpg", "square");
    		fadeOut = false;
    		fadeIn = true;
    	}
    	if (square._alpha<100 && fadeIn && !fadeOut) {
    		square._alpha += 10;
    	} else {
    		fadeIn = false;
    	}
    	// limit input field
    	if (input>5) {
    		input = 5;
    	}
    	// 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;
    };
    ho lasciato invariati i commenti..
    funziona alla perfezione, ma volevo sapere questo:

    visto che le immagini devono essere numerate: image1 image2 etc..
    se aggiungo image6.jpg
    come devo modificare TUTTO il codice?!
    ho provato con:
    codice:
    if (whichPic<6 && !fadeIn && !fadeOut) {
    codice:
    if (input>6) {
    		input = 6;
    ma non funge!

    Grazie
    "E d'un tratto capii che il pensare è per gli stupidi, mentre i cervelluti si affidano all'ispirazione!"

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2004
    Messaggi
    177
    Nessuno che può aiutarmi!?
    "E d'un tratto capii che il pensare è per gli stupidi, mentre i cervelluti si affidano all'ispirazione!"

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.