utilizzo uno script per il caricamento di alcune jpg, il movieClipLoader, sembra che funzioni, ma se aspetto un po' mi succede che le immagini che carico improvvisamente spariscono e poi riappaiono senza che io gli do alcun input ,da che cosa dipende??![]()
ecco il codice che do ad un pulsante, ci sono altri pulsanti che ne hanno 1 simile e le caricano da xml:
// listener
var myLoadedMovie2:MovieClipLoader = new MovieClipLoader(); // creo il MovieClip loader
var MovieListner2:Object = new Object(); // creo l'oggetto listner per myLoadedMovie2
MovieListner2.onLoadStart = function (target_mc) {
// comincio a popolare la variabile con gli avvenimenti ...
globalStatus = "Inizio caricamento di " + target_mc + "\n";
// e ci metto dentro anche il "misterioso" getProgress()
var loadProgress:Object = new Object(myLoadedMovie2.getProgress(target_mc));
globalStatus += "Bytes caricati all' avvio: " + loadProgress.bytesLoaded + "\n";
globalStatus += "Bytes totali all' avvio: " + loadProgress.bytesTotal + "\n";
//accaduto(debug_txt, caricamento, myFormat);
//trace("Caricamento di " + target_mc + " avviato con successo.");
// target_mc e' un valore statico con un nome a piacere e presente in tutti i gestori
// non e' obbligatorio l' utilizzo
// ma puo' restituirci in ogni momento il nome
// del nostro caricante.
}
MovieListner2.onLoadProgress = function (target_mc, loadedBytes, totalBytes) {
var caricamento = "Totale bytes caricati: " + loadedBytes + "\n";
caricamento += "Totale bytes da caricare: " + totalBytes + "\n \n";
_root.start1.control2.onEnterFrame = function(){
var caricamento = "Totale bytes caricati: " + loadedBytes + "\n";
accaduto(debug_txt, caricamento, myFormat);
}
accaduto(debug_txt, caricamento, myFormat);
//trace("bytes caricati: " + loadedBytes);
//trace("bytes totali: " + totalBytes);
// loadedBytes e totalBytes prendono il posto di
// movieClip.getBytesLoaded(); e movieClip.getBytesTotal();
}
MovieListner2.onLoadComplete = function (target_mc) {
target_mc._alpha = 100;
//trace("Il -- DOWNLOAD -- del file e' appena terminato");
}
MovieListner2.onLoadInit = function (target_mc) {
target_mc._alpha = 0;
globalStatus = "";
accaduto(debug_txt, globalStatus, myFormat);
_root.start1.control2.onEnterFrame = function(){
target_mc._alpha = target_mc._alpha += 10
}
//trace(target_mc + " e' disponibile ed e' stato nizializzato!!!");
}
MovieListner2.onLoadError = function (target_mc, errorCode) {
globalStatus += "Impossibile caricare questo file: " + target_mc + "\n";
globalStatus += "[ " + errorCode + " ]\n";
//accaduto(debug_txt, globalStatus, myFormat);
//trace("Impossibile caricare questo file: " + target_mc);
//trace("[ " + errorCode + " ]");
}
myLoadedMovie2.addListener(MovieListner2)
myLoadedMovie2.loadClip("img/img5.jpg", "_root.start1.control2");