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

    Movimento Immagini Dinamiche

    Salve a tutti!
    Dovrei realizzare uno script che carichi un'immagine dall'esterno(e fin qui c sto) e poi crei un interpolazione di movimento(diciamo che deve prima scorrerla verso l'alto e poi centrarla..tipo questa: http://www.lorybalda.com/grafica/head.swf)
    qlke aiuto?

  2. #2
    fai il preload dell'img esterna quando sei sicuro che sia caricata la fai spostare prima in alto e poi la centri con le tween

    con una cosa del genere..
    metti la funzione fuori dal preload sempre sul frame
    import mx.transitions.Tween;
    import mx.transitions.easing.Regular;
    function sposta(mc, finex,finey) {

    var ___TWEEN___:Tween = new Tween(mc, "_x", Regular.easeOut,mc._x, finex, 30, false);
    var ___TWEEN___:Tween = new Tween(mc, "_y", Regular.easeOut,mc._y, finey, 30, false);

    }

    x richiamarla nel preload
    sposta(istanzaclipdaSpostare,coordinataxDiArrivo,c oordinatayDiArrivo)

    ovviamente la fai spostare prima il alto e poi la centri con le coordinate

    Stage._width/2
    Stage._heigth/2

    xrò magari ti servirebbe un listener che ti avverte quando avrà concluso il primo movimento

    spostato=false
    function sposta(mc, finex,finey) {
    var ___TWEEN___:Tween = new Tween(mc, "_x", Regular.easeOut,mc._x, finex, 30, false);
    var ___TWEEN___:Tween = new Tween(mc, "_y", Regular.easeOut,mc._y, finey, 30, false);

    var tweenListener:Object = new Object();
    //
    tweenListener.onMotionFinished = function():Void {
    trace("finito1"° movimento);
    //richiami qua di nuovo la stessa funzione che xrò centrerà l'img
    if(!spostato){
    sposta(istanzaclipdaSpostare,Stage._width/2,Stage._heigth/2)
    spostato=true
    }

    };
    ___TWEEN___.addListener(tweenListener);
    }

    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  3. #3
    asp io ho qst:

    var mcListener:Object = new Object();

    mcListener.onLoadStart = function(target_mc:MovieClip) {
    target_mc._alpha = 0;
    };

    mcListener.onLoadComplete = function(target_mc:MovieClip) {
    target_mc._alpha = 100;
    };

    var mcLoader:MovieClipLoader = new MovieClipLoader();

    mcLoader.loadClip("image.jpg", myClip);

    cm lo adatto al codice ke mi hai dato?
    (scusa l'ignoranza sn ancora alle prime armi:P)

  4. #4
    sn riuscito a farla spostare in alto, ma nn mi si centra???
    qlkuno può aiutarmi??

  5. #5
    mi sto strecciando piano piano..adesso l'unico prob che ho è che quando provo a centrarla mi viene fuori qst errore:

    Nessuna proprietà denominata '_width'.
    sposta(mc,Stage._width/2,Stage._height/2)
    e lo stesso con _height.

    questo è tutto il codice:

    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    import mx.transitions.Tween;
    import mx.transitions.easing.Regular;
    spostato=false

    function sposta(mc, finex,finey)
    {
    var ___TWEEN___:Tween = new Tween(mc, "_x", Regular.easeOut,mc._x, finex, 30, false);
    var ___TWEEN___:Tween = new Tween(mc, "_y", Regular.easeOut,mc._y, finey, 30, false);

    var tweenListener:Object = new Object();
    //
    tweenListener.onMotionFinished = function():Void
    {
    trace("finito1° movimento");

    if(!spostato)
    {
    sposta(mc,Stage._width/2,Stage._height/2)
    spostato=true
    }

    };
    ___TWEEN___.addListener(tweenListener);
    };



    var mcListener:Object = new Object();

    mcListener.onLoadStart = function(target_mc:MovieClip) {
    target_mc._alpha = 0;
    };

    mcListener.onLoadComplete = function(target_mc:MovieClip) {
    target_mc._alpha = 100;
    sposta(myClip,0,-150);
    };


    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(mcListener);
    mcLoader.loadClip("image.jpg", myClip);
    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    dv sbaglio?

  6. #6
    ops...scusami ci sono qualche errori di battitura....chiedo venia prova cosi
    Codice PHP:
    stop();
    import mx.transitions.Tween;
    import mx.transitions.easing.Regular;
    function 
    sposta(mcfinexfiney) {
      
        var 
    ___TWEEN___:Tween = new Tween(mc"_x"Regular.easeOut,mc._xfinex60false);
          var 
    ___TWEEN___:Tween = new Tween(mc"_y"Regular.easeOut,mc._yfiney60false);

    var 
    tweenListener:Object = new Object();
    //
    tweenListener.onMotionFinished = function():Void
    {
    trace("finito1° movimento");

    if(!
    spostato)
    {
    sposta(mc,Stage.width/2,Stage.height/2)
    spostato=true
    }

    };
    ___TWEEN___.addListener(tweenListener);
    };



    // prima serie di listener
    var my_mcl = new MovieClipLoader();
    myListener = new Object();
    myListener.onLoadStart = function (target_mc
    {
        
    target_mc._alpha 0;

    var 
    loadProgress my_mcl.getProgress(target_mc);
    //trace(loadProgress.bytesLoaded + " = byte caricati all'inizio");
    //trace(loadProgress.bytesTotal + " = byte totali all'inizio");
    }
    myListener.onLoadProgress = function (target_mcloadedBytestotalBytes
    {
    //trace ("*********Avanzamento prima istanza my_mc*********");
    //trace ("onLoadProgress() richiamato nel filmato " + target_mc);
    //trace(loadedBytes + " = byte caricati al callback della funzione di avanzamento " );
    //trace(totalBytes + " = byte totali al callback della funzione di avanzamento \n");

    }
    myListener.onLoadComplete = function (target_mc
    {
    //trace ("È stato effettuato il caricamento nel clip filmato = " + target_mc);
    var loadProgress my_mcl.getProgress(target_mc);
    //trace(loadProgress.bytesLoaded + " = byte caricati al termine" );
    //trace(loadProgress.bytesTotal + " = byte totali al termine=");
    }
    myListener.onLoadInit = function (target_mc
    {
    //trace ("Il clip filmato = " + target_mc + " è stato inizializzato");
    // Da questo punto è possibile effettuare qualsiasi impostazione desiderata, ad esempio:
    //target_mc._width = 30;
    //target_mc._height = 40;
    target_mc._alpha=100
    //sposta(target_mc, Stage.width/5, Stage.height/4)
    sposta(target_mc0, -150)


    myListener.onLoadError = function (target_mcerrorCode
    {
    //trace ("*********Prima istanza my_mc*********");
    //trace ("ERROR CODE = " + errorCode);
    //trace ("Il caricamento nel clip filmato non è riuscito = " + target_mc + "\n");
     

    my_mcl.addListener(myListener);

    my_mcl.loadClip('prova.jpg'cont); 
    xrò tieni conto che quando il contenitore si sposta le coordinate sono riferite all'angolo sx in alto....quindi nel centrare l'img dovresti tener conto delle dimensioni e sottrarle al punto centrale dello stage..
    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  7. #7
    quindi una cosa del genere...

    Codice PHP:
    stop();
    spostato=false;
    import mx.transitions.Tween;
    import mx.transitions.easing.Regular;
    function 
    sposta(mcfinexfiney) {
      
        var 
    ___TWEEN___:Tween = new Tween(mc"_x"Regular.easeOut,mc._xfinex60false);
          var 
    ___TWEEN___:Tween = new Tween(mc"_y"Regular.easeOut,mc._yfiney60false);

    var 
    tweenListener:Object = new Object();
    //
    tweenListener.onMotionFinished = function():Void
    {
    trace("finito1° movimento");

    if(!
    spostato)
    {
    sposta(mc,dovex,dovey)
    spostato=true
    }

    };
    ___TWEEN___.addListener(tweenListener);
    };



    // prima serie di listener
    var my_mcl = new MovieClipLoader();
    myListener = new Object();
    myListener.onLoadStart = function (target_mc
    {
        
    target_mc._alpha 0;

    var 
    loadProgress my_mcl.getProgress(target_mc);
    //trace(loadProgress.bytesLoaded + " = byte caricati all'inizio");
    //trace(loadProgress.bytesTotal + " = byte totali all'inizio");
    }
    myListener.onLoadProgress = function (target_mcloadedBytestotalBytes
    {
    //trace ("*********Avanzamento prima istanza my_mc*********");
    //trace ("onLoadProgress() richiamato nel filmato " + target_mc);
    //trace(loadedBytes + " = byte caricati al callback della funzione di avanzamento " );
    //trace(totalBytes + " = byte totali al callback della funzione di avanzamento \n");

    }
    myListener.onLoadComplete = function (target_mc
    {
    //trace ("È stato effettuato il caricamento nel clip filmato = " + target_mc);
    var loadProgress my_mcl.getProgress(target_mc);
    //trace(loadProgress.bytesLoaded + " = byte caricati al termine" );
    //trace(loadProgress.bytesTotal + " = byte totali al termine=");
    }
    myListener.onLoadInit = function (target_mc
    {
    //trace ("Il clip filmato = " + target_mc + " è stato inizializzato");
    // Da questo punto è possibile effettuare qualsiasi impostazione desiderata, ad esempio:
    //target_mc._width = 30;
    trace(Stage.width)
    trace(Stage.height)
    lar=target_mc._width
    alt
    =target_mc._height
    dovex
    =(Stage.width/2)-(lar/2)
    dovey=(Stage.height/2)-(alt/2)
    target_mc._alpha=100
    //sposta(target_mc, Stage.width/5, Stage.height/4)
    sposta(target_mc0, -150)


    myListener.onLoadError = function (target_mcerrorCode
    {
    //trace ("*********Prima istanza my_mc*********");
    //trace ("ERROR CODE = " + errorCode);
    //trace ("Il caricamento nel clip filmato non è riuscito = " + target_mc + "\n");
     

    my_mcl.addListener(myListener);

    my_mcl.loadClip('prova.jpg'cont); 
    nel preload rilevi la dimensione della foto caricata e ne sottrai la meta del punto centrale
    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

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.