Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 22

Discussione: undefined

  1. #1

    undefined

    codice:
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success){
        if(success){
            this.path.nome = this.array_testuale;
    		_global.array_testo = this.array_testuale;
     		trace(array_testo);
     // this.images = array_testo
    //che restituisce:["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg","07.jpg"];
    		} else {
    		trace("errore caricamento");
           // istruzioni per l'errore di caricamento
        } 
    }; 
    dati.load("file.txt");
    Nel trace mi restituisce quello che mi serve
    poi subito dopo creo una funzione e richiamo il valore di array_testo in this.images
    ma è come se il valore fosse nullo o meglio undefined come risolvo?
    codice:
    gallery.init = function() {
    this.images = _global.array_testo;
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Il gallery init lo devi chiamare da dentro l'onLoad dell'istanza di LoadVars.

  3. #3
    ciao nega intanto grazie ho provato qualcosa cambia ma ancora non va

    vedi parte in rosso
    codice:
    #include "com.qlod.LoaderClass.as"
    #include "lmc_tween_as1.as"
    loader = new com.qlod.LoaderClass();
    loader.setMinSteps(8);
    $tweenManager.broadcastEvents = true;
    //$tweenManager.updateInterval = 15;
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success){
        if(success){
            this.path.nome = this.array_testuale;
    		_global.array_testo = this.array_testuale;
    		trace(array_testo);
    		gallery.init();
    //che restituisce:["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg","07.jpg"];
    		} else {
    		trace("errore caricamento");
           // istruzioni per l'errore di caricamento
        } 
    } 
    dati.load("file.txt");
    gallery = {};
    gallery.init = function() {
    //this.images =["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg","07.jpg"];
    	this.images= array_testo
    	this.data = [];
    	this.resize_controller = {};
    	this.resize_controller.clips = []; 	//
    	this.isAnimating = false;
    	this.imageborder = 4;
    	this.timeline = _root;
    	this.resizeClip = this.timeline.image_bg_mc;
    	this.contentClip = this.timeline.createEmptyMovieClip("image_mc", 500);
    	//
    	this.centerx = Stage.width/2;
    	this.centery = Stage.height/2;
    	//this.currentImageId = 0;
    	// if user press the next button on last picture it goes from 0
    	this.rotateMode = true;
    	this.buildNav();
    	this.preloadImages();
    	//attach credits
    	this.attachClip(credits, {right:0, bottom:0});
    };
    
    // call this functions from navigation functions
    gallery.buildNav = function() {
    	var btnsize = 11;
    	var navHolder = this.timeline.createEmptyMovieClip("navHolder", 10);
    	//var gallery = this;
    	for (var i = 0; i<this.images.length; i++) {
    		var btn = navHolder.attachMovie("imgbtn", "img"+i, i);
    		btn._x = btnsize/2+btnsize*i;
    		btn.id = i;
    		btn.loaded = false;
    		btn.onPress = function() {
    			gallery.showImage(this.id);
    		};
    		btn.onRollOver = function() {
    			this.over_mc.gotoAndPlay("overanim");
    		};
    		btn.onRollOut = function() {
    			this.over_mc.gotoAndPlay("outanim");
    		};
    		btn.onLoadStart = function(loaderObj) {
    			this.gotoAndPlay("loading");
    		};
    		btn.onLoadProgress = function() {
    			gallery.data[this.id].mc._alpha = 0;
    		};
    		btn.onLoadComplete = function(success, loaderObj) {
    			this.loaded = true;
    			gallery.data[this.id].mc._visible = false;
    			if (this.id == 0) {
    				gallery.showImage(this.id);
    			}
    		};
    		btn.stop();
    		var mc = this.contentClip.createEmptyMovieClip("img"+i, i+10);
    		this.data[i] = {btn:btn, mc:mc};
    	}
    	// attach nav top left
    	this.attachClip(navHolder, {center:-navHolder._width/2, top:-6});
    };
    gallery.preloadImages = function() {
    	var gallery = this;
    	for (var i = 0; i<this.images.length; i++) {
    		loader.load(this.data[i].mc, this.images[i], this.data[i].btn);
    	}
    };
    gallery.showNext = function() {
    	this.loadImage(this.currentImageId+1);
    };
    gallery.showPrev = function() {
    	this.loadImage(this.currentImageId-1);
    };
    gallery.showImage = function(id) {
    	if (id>=this.images.length) {
    		if (this.rotateMode) {
    			id = 0;
    		} else {
    			return;
    		}
    	} else if (id<0) {
    		if (this.rotateMode) {
    			id = this.images.length-1;
    		} else {
    			return;
    		}
    	}
    	//
    	if (this.currentImageId == undefined) {
    		this.currentImageId = id;
    		this.showNewImage();
    	} else {
    		if (this.isAnimating) {
    			this.nextToShow = id;
    		} else {
    			this.nextToShow = undefined;
    			this.prevImageId = this.currentImageId;
    			this.currentImageId = id;
    			this.hideOldImage();
    		}
    	}
    };
    gallery.hideOldImage = function() {
    	trace("hideold"+this.prevImageId);
    	//this.data[this.prevImageId].mc.stopTween()
    	this.isAnimating = true;
    	this.data[this.prevImageId].mc.alphaTo(0, 1, undefined, 0, {func:this.showNewImage, scope:this});
    };
    gallery.showNewImage = function() {
    	trace("shownew"+this.currentImageId);
    	var mc = this.data[this.currentImageId].mc;
    	// is loaded
    	if (this.data[this.currentImageId].btn.loaded) {
    		with (this) {
    			contentClip._x = centerx-mc._width/2;
    			contentClip._y = centery-mc._height/2;
    			//
    			this.data[this.prevImageId].mc._visible = false;
    			mc._visible = true;
    			mc.alphaTo(100, 1, undefined, 1, function () {
    				gallery.isAnimating = false;
    				trace(gallery.isAnimating)
    				if (gallery.nextToShow != undefined) {
    					gallery.showImage(gallery.nextToShow);
    				}
    			});
    			//
    			var dx = centerx-mc._width/2-imageborder;
    			var dy = centery-mc._height/2-imageborder;
    			var dw = mc._width+2*imageborder;
    			var dh = mc._height+2*imageborder;
    			resizeClip.tween(["_x", "_y", "_width", "_height"], [dx, dy, dw, dh], 1, "easeoutexpo");
    		}
    	} else {
    		// break preloading and load mc
    		loader.clear();
    		// load first the clicked image
    		var i = this.currentImageId;
    		this.data[i].btn.onLoadComplete = function(success, loaderObj) {
    			this.loaded = true;
    			gallery.showImage(this.id);
    		};
    		loader.load(this.data[i].mc, this.images[i], this.data[i].btn);
    		// continue the rest
    		for (var j = 0; j<this.images.length; j++) {
    			if (i != j && !this.data[j].btn.loaded) {
    				loader.load(this.data[j].mc, this.images[j], this.data[j].btn);
    			}
    		}
    	}
    };
    //function to attach clips to move with image bg
    //alignObj parameters 
    // mc - movieclip reference
    // attaching points + relative positions
    // left, right, center - numbers
    // top, bottom, middle - numbers
    gallery.attachClip = function(mc, alignObj) {
    	if (this.resize_controller.clips.length == 0) {
    		this.resize_controller.baseClip = this.resizeClip;
    		this.resize_controller.onTweenUpdate = function() {
    			for (var i in this.clips) {
    				var mc = this.clips[i].mc;
    				var align = this.clips[i].align;
    				if (align.left != undefined) {
    					mc._x = align.left+this.baseClip._x;
    				} else if (align.center != undefined) {
    					mc._x = align.center+this.baseClip._x+(this.baseClip._width/2);
    				} else if (align.right != undefined) {
    					mc._x = align.right+this.baseClip._x+this.baseClip._width;
    				}
    				if (align.top != undefined) {
    					mc._y = align.top+this.baseClip._y;
    				} else if (align.middle != undefined) {
    					mc._y = align.middle+this.baseClip._y+(this.baseClip._height/2);
    				} else if (align.bottom != undefined) {
    					mc._y = align.bottom+this.baseClip._y+this.baseClip._height;
    				}
    			}
    		};
    		this.resizeClip.addListener(this.resize_controller);
    	}
    	this.resize_controller.clips.push({mc:mc, align:alignObj});
    	this.resize_controller.onTweenUpdate();
    };
    gallery.deatachClip = function(mc) {
    	for (var i in this.resize_controller.clips) {
    		//
    	}
    };
    //
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  4. #4
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  5. #5
    uppettino
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  6. #6
    nega help me please
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  7. #7


    ci riprovo

    nega aiutami tu
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  8. #8
    ultimissimo up

    poi

    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

  9. #9
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Ehm, dovresti un po' isolare il codice interessato, lì c'è troppa roba...

  10. #10
    la parte interessa ta è segnata in rosso

    this.images.length restituisce la lunghezza di tutta la stringa e non il numero delle immagini
    avrei bisogno degli array.....

    credo che ci sia anche un problema di parametrizzazione di qualche metodo di una delle classi


    volendo potrei inviare il file per darci uno sguardo

    cmq il problema è in questo punto

    codice:
    dati = new LoadVars();
    dati.path = this;
    dati.onLoad = function(success){
        if(success){
            this.path.nome = this.array_testuale;
    		_global.array_testo = this.array_testuale;
    		trace(array_testo);
    		
    //che restituisce:["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg","07.jpg"];
    		} else {
    		trace("errore caricamento");
           // istruzioni per l'errore di caricamento
        } 
    } 
    dati.load("file.txt");
    gallery = {};
    gallery.init = function() {
    
    //qui array_testo è undefined e non riesco 
    //this.images =["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg","07.jpg"];
    	this.images= array_testo 	this.data = [];
    	this.resize_controller = {};
    	this.resize_controller.clips = [];
    Consulenza aziendale a 360° http://www.gruppodg.it http://www.gruppodg.it/3d
    Realizzazione siti internet, Siti Flash, Ricerca Location per bar negozi , esercizi commerciali, sviluppo pratiche e allestimento

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.