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(mc, finex, finey) {
var ___TWEEN___:Tween = new Tween(mc, "_x", Regular.easeOut,mc._x, finex, 60, false);
var ___TWEEN___:Tween = new Tween(mc, "_y", Regular.easeOut,mc._y, finey, 60, 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);
};
// 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_mc, loadedBytes, totalBytes)
{
//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_mc, 0, -150)
}
myListener.onLoadError = function (target_mc, errorCode)
{
//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..