Pagina 1 di 4 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 34
  1. #1

    [AS 2.0] Buon Natale !

    Diciamo che questo e' un piccolo regalo da parte mia per le festivita' Natalizie.

    Si tratta di salvare la classe che sto per postare in un file di nome Snow.as e di utilizzare l'esempio per testare l' applicazione e personalizzarla a piacere.

    Snow.as
    codice:
    class Snow extends MovieClip{
    	// andr3a [ www.3site.it ] [ 18/12/2004 ]
    	
    	// VARIABLES
    	private var totalCrystals:Number, crystalAlpha:Number, windChange:Number, depth:Number = new Number();
    	private var path:Object = new Object();
    	private var crystalColor:String = new String();
    	
    	// CONSTRUCTOR
    	function Snow(path:Object) {
    		this.path = path;
    		this.depth = 1;
    		setTotalCrystals(100);
    		setAlphaCrystals(80);
    		setWindCrystals(20);
    		setColorCrystals("0xFFFFFF");
    	}
    	
    	// START APPLICATION
    	public function follow():Void {
    		createCrystals(crystalColor, crystalAlpha);
    	}
    	
    	// PUBLIC SETTINGS
    	public function setTotalCrystals( totalCrystals:Number ):Void {
    		this.totalCrystals = totalCrystals;
    	}
    	public function setAlphaCrystals( crystalAlpha:Number ):Void {
    		this.crystalAlpha = crystalAlpha;
    	}
    	public function setWindCrystals( windChange:Number ):Void {
    		this.windChange = windChange;
    	}
    	public function setColorCrystals( crystalColor:String ):Void {
    		this.crystalColor = crystalColor;
    	}
    	
    	// PRIVATE INITIALIZATION	
    	private function createCrystals(crystalColor:String, crystalAlpha:Number):Void {
    		path.createEmptyMovieClip( "crystal_" + depth++, depth );
    		var firstMovie:MovieClip = path["crystal_" + (depth-1)];
    		with ( firstMovie ) {
    			beginFill( crystalColor, crystalAlpha );
    			moveTo( 0, 0 );
    			curveTo( 4, 0, 4, -4 );
    			curveTo( 4, -8, 0, -8 );
    			curveTo( -4, -8, -4, -4 );
    			curveTo( -4, 0, 0, 0 );
    			endFill();
    		}
    		for(var a:Number = new Number(depth); a<=totalCrystals; a++) {
    			firstMovie.duplicateMovieClip("crystal_" + depth++, depth, this);
    			path["crystal_" + (depth-1)]._x = path["crystal_" + (depth-1)]._width + (((Math.random()*10)*Stage.width) / path["crystal_" + (depth-1)]._width);
    			path["crystal_" + (depth-1)]._y = path["crystal_" + (depth-1)]._height + (((Math.random()*10)*Stage.height) / path["crystal_" + (depth-1)]._height);
    			path["crystal_" + (depth-1)]._xscale = path["crystal_" + (depth-1)]._yscale = (Math.random()*100);
    			crystalMovement(path["crystal_" + (depth-1)]);
    		}
    		firstMovie._visible = false;
    	}
    	private function crystalMovement(who:MovieClip):Void {
    		who.rememberWhere = new Number(0);
    		who.remembered = new Number(windChange+1);
    		who.onEnterFrame = function() {
    			if( this.remembered > windChange ) {
    				var casuality:Number = new Number((Math.random() * 100) > 50 ? 1 : -1);
    				this.rememberWhere = ((Math.random()*2) * casuality);
    				this.remembered = 0;
    			}
    			this.remembered++;
    			this._x += this.rememberWhere;
    			this._y += this._xscale / 40;
    			if(this._y>Stage.height) {
    				this._y = 0;
    			}
    			if(this._x>Stage.width) {
    				this._x = 0;
    			}
    			else if(this._x < 0) {
    				this._x = Stage.width;
    			}
    		}
    	}
    }


    esempio.fla
    ricordate di settare il classpath o di mettere il fiel Snow.as nella stessa dir di questo file .FLA
    codice:
    // primo keyframe delle actions, mettete lo sfondo nero al documento e magari un framerate a 30 o 50 ...
    
    // EXAMPLE 1 [ all modifying parameters ]
    // DECLARATION
    var mySnow:Snow = new Snow(this);
    
    // MAKE MODIFY
    mySnow.setTotalCrystals(200); // default 100 - crystals's max number
    mySnow.setAlphaCrystals(60); // default 80 - crystals's alpha
    mySnow.setWindCrystals(30); // default 20 - wind's change
    mySnow.setColorCrystals("0xEFEFEF"); // default 0xFFFFFF - crystals's color
    
    // DRAW & FOLLOW
    mySnow.follow();
    
    // ctrl+invio :-)
    
    
    
    
    /* EXAMPLE 2 [ simple to try ]
    var mySnow:Snow = new Snow(this);
    mySnow.follow();
    */


    Spero sia stata cosa gradita, buone feste a tutti
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  2. #2
    chiedo scusa per il titolo, se potessi lo cambierei in

    Effetto neve, Snow class

    oppure spostatelo in Annunci, magari qui e' un po OT, c'ho pensato ... ehm .. adesso
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  3. #3
    visto la grande richiesta e i numerosi commenti ( )
    eccovi un link dimostrativo

    http://www.3site.it/varie/Snow.html

    usando questi settaggi:
    codice:
    stop();
    var mySnow:Snow = new Snow(this);
    mySnow.setTotalCrystals(60);
    mySnow.setAlphaCrystals(60);
    mySnow.setWindCrystals(60);
    mySnow.follow();
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  4. #4
    molto bello

    solo ke non avendo MX 2004 non posso smanettarci :gren:

    komunque komplimentoni


  5. #5
    Originariamente inviato da serialkiller
    molto bello

    solo ke non avendo MX 2004 non posso smanettarci :gren:

    komunque komplimentoni

    grazie


    ... cmq il tuo avatar
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  6. #6
    Originariamente inviato da andr3a
    grazie


    ... cmq il tuo avatar
    kos'ha il mio avatar ?


  7. #7
    Originariamente inviato da serialkiller
    kos'ha il mio avatar ?
    e' styloso
    Formaldehyde a new Ajax PHP Zero Config Error Debugger

    WebReflection @WebReflection

  8. #8
    Originariamente inviato da andr3a
    e' styloso
    grassie

    anke il tuo trikeko matrixiano non è male





    :adhone:

  9. #9

    ehm.....

    Ciao scusa la mia incompetenza, ma non capisco dove trovo il file snow.sa???
    devo crearlo con i parametri che hai messo?? e con che programma creo un file con estenzione "sa"???
    grazie,
    la neve e' molto carina!!! ma vorrei che scendesse anke nel mio sito =)!
    de gustibus nn est disputandum

  10. #10
    Ciao Andr3a,

    per gli ottusi come me potresti dare qualche spiegazione in piu per MX

    su come salvare una classe

    e cosa intendi settare il classpath

    Oppure è un prodotto riservato a Mx 2004 ??

    Grazie cmq del pensiero.

    rempox

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 © 2024 vBulletin Solutions, Inc. All rights reserved.