Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Modifica script per preloader

    Ciao, ho trovato questo script per precaricare i filmati, importato nel primo fotogramma e poi richiamato,
    mi precarica il filmato stesso.

    Ora invece vorrei adattarlo per fargli caricare i file che voglio io nel mc che voglio io...
    come posso fare?
    codice:
    //******************** Start ******************** 
    //class definition 
    class FlashscriptLoader {
    	private static var xDistance:Number;
    	private static var yDistance:Number;
    	private static var barHeight:Number;
    	private static var barColor:Color;
    	private static var frameName:String;
    	private static var movieLoader:String;
    	private static var outLine:String;
    	private static var perLoaded:Number;
    	private static var loadedBytes:Number;
    	private static var totalBytes:Number;
    	private static var bytes:Number;
    	private static var frame:Number;
    	private static var bytesField:String;
    	private static var frameField:String;
    	private static var totalField:String;
    
    //constructor 
    	function FlashscriptLoader(xDistance,yDistance,barHeight,barColor,frameName){
    		loadTheMovie(xDistance,yDistance,barHeight,barColor,frameName);
    	}
    	
    	private function loadTheMovie(xDist,yDist,bHeight,bColor,fName):Void{
    
    //passing the parameter variables 
    		xDistance = xDist;
    		yDistance = yDist;
    		barHeight = bHeight;
    		barColor = bColor;
    		frameName = fName;
    
    //creating empty movieclips for loaderbar 
    		_root.createEmptyMovieClip("outLine",1);
    		_root.createEmptyMovieClip("movieLoader",2);	
    
    //creating the outline for loaderbar 
    		_root.outLine.lineStyle(1, 0x000000, xDist);
    		_root.outLine.moveTo(xDist-1,yDist-1);
    		_root.outLine.lineTo(xDist+102,yDist-1);
    		_root.outLine.lineTo(xDist+102,yDist+bHeight+2);
    		_root.outLine.lineTo(xDist-1,yDist+bHeight+2);
    		_root.outLine.lineTo(xDist-1,yDist-1);
    
    //creating textfields 
    		_root.createTextField("bytesField",3,xDist-70,yDist+bHeight+20,100,15);	
    		_root.bytesField.textColor = "0xffffff";
    		_root.createTextField("frameField",4,xDist+90,yDist+bHeight+20,100,15);
    		_root.createTextField("totalField",5,xDist+20,yDist+bHeight+50,100,15);	
    
    //loading function 
    		_root.onEnterFrame = function() {
    
    //getting total bytes 
    			totalBytes = _root.getBytesTotal();
    
    //loded bytes defining 
    			loadedBytes = _root.getBytesLoaded();
    
    //bytes loaded 
            	bytes = Math.ceil((loadedBytes/1024)*1000);
    
    //% loaded 
    			perLoaded = Math.ceil((loadedBytes/totalBytes) * 100);
    
    //defining the loading status for loaderbar 
    			frame = Math.ceil(loadedBytes/(totalBytes/100)+xDist); 
    
    //creating the fill for loaderbar 
            	_root.movieLoader.lineStyle(1, bColor, xDist);
    			_root.movieLoader.beginFill(bColor,xDist);
    			_root.movieLoader.moveTo(xDist,yDist);
    			_root.movieLoader.lineTo(frame,yDist);
    			_root.movieLoader.lineTo(frame,yDist+bHeight);
    			_root.movieLoader.lineTo(xDist,yDist+bHeight);
    			_root.movieLoader.lineTo(xDist,yDist);
    
    //showing the bytes and % loaded in textfield 
    			_root.totalField.text = "total bytes: "+totalBytes;	
    			_root.bytesField.text = "bytes loaded: "+bytes;
    			_root.frameField.text = "% loaded: "+perLoaded;
    
    //after loading remove all objects and go to indicated frame 
    			if (loadedBytes >= totalBytes) {
    				removeMovieClip(_root.movieLoader);
    				removeMovieClip(_root.outLine);
    				removeMovieClip(_root.bytesField);
    				removeMovieClip(_root.frameField);
    				removeMovieClip(_root.totalField);
         			_root.gotoAndPlay(fName);
         			delete _root.onEnterFrame;
    			}
    		}
    	}
    }
    
    //******************** End of Script ******************** 
    /*
    Parameters: 
    xDistance: x position of loaderbar 
    yDistance: y position of loaderbar 
    barHeight: height of the loaderbar 
    barColor: hexadecimal color value for the loaderbar fill 
    frameName: name of the frame to go when movie is loaded 
    Example (put this script in the first frame of your movie): 
    
    stop();
    var myLoader:FlashscriptLoader = new FlashscriptLoader(x,y,height,color,"framename");
    */
    Incredibile, quanto a volte ci si impegola in qualcosa che sembra impossibile..
    e poi si scopre che quel che si dava per scontato, perchè banale, ne fosse la soluzione..

  2. #2
    Nessuno che sappia consigliarmi?
    Incredibile, quanto a volte ci si impegola in qualcosa che sembra impossibile..
    e poi si scopre che quel che si dava per scontato, perchè banale, ne fosse la soluzione..

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.