Forum Flash, Actionscript, PHP e MySQL
unLoad function.... help

 
Nuovo Topic   Rispondi    Forum Flash, Actionscript, PHP e MySQL » ActionScript & Server Side
Precedente  Successivo 
Autore Messaggio
zioraffa
nuovo utente
nuovo utente



Registrato: 29/04/09 20:28
Messaggi: 10

MessaggioOggetto: unLoad function.... help
Inviato: 21.07.09 | 09:07
Rispondi citando

ciao a tutti,
ho trovato questo codice che permette di caricare swf contemporaneamente in as2 e in as3.
sfortunatamente ha solo la funzione di loadmovie, in questo caso loadsite, ma non quella di unLoad, e quindi li carica senza scaricarli.
in questo modo è quasi inservibile e speravo che qualcuno di voi che capisce decisamente più di me di actionscript 3 e non solo, potesse aiutarmi.
in realta i codici sono due ma il primo penso sia quello a cui fare riferimento.
spero davvero che qualcuno mi possa aiutare.

grazie in anticipo


stage.scaleMode=StageScaleMode.NO_SCALE; //Make sure that no matter what size the browser is, the stage will not resize

*****************************************/
var buttonsArray=new Array(); //Initialize an array to hold all the buttons

function buttonClickFunction(event)
{
var ct=event.currentTarget; //Get the current caller
mainSite.loadSite("pg"+ct.num+".swf"); //Call mainSite to load the corresponding swf file

//Let all the buttons know that they are not selected
var i;
for(i in buttonsArray)
{
buttonsArray[i].selected=false;
}

ct.selected=true; //Select the current caller
}
function initializeButtons()
{

//This code will automatically detect all added buttons, as long as there is no gap in the numbering.
var btnOn=1; //Start on button number 1
while(this["btn"+btnOn])
{
//While the button exists, let the button call the buttonClickFunction when clicked and add this to the buttonsArray
this["btn"+btnOn].addEventListener(MouseEvent.CLICK, buttonClickFunction);
this["btn"+btnOn].num=btnOn;
buttonsArray.push(this["btn"+btnOn]);
btnOn++;
}

mainSite.loadSite("pg1.swf"); //Load the first page which should be the Home page
btn1.selected=true; //Make button 1 selected
}

initializeButtons(); //Initialize the buttons
Torna in cima
Profilo Messaggio privato  
Sponsor
Coach
amministratore
amministratore


Età: -1981
Registrato: 31/01/03 13:50
Messaggi: 4549
Località: Verona

MessaggioOggetto:
Inviato: 22.07.09 | 17:51
Rispondi citando

Ciao zioraffa,
nella porzione di codice che hai postato non vi è nessun richiamo al metodo loadSite, quindi la gestione del tutto avviene altrove :)

Mi sembra di capire che ci sia solamente il loadSite, che comunque va a sovracrivere il contenuto del precedente.

P.S: quando posti delle porzioni di codice racchiudile tra tag CODE, per rendere il codice più leggibile.

____________________________________________________________


Il Forum è uno strumento di condivisione, oltre a fare DOMANDE, si possono anche dare RISPOSTE!
Torna in cima
Profilo Messaggio privato [ Nascosto ] HomePage Yahoo Messenger MSN Messenger Skype
zioraffa
nuovo utente
nuovo utente



Registrato: 29/04/09 20:28
Messaggi: 10

MessaggioOggetto:
Inviato: 22.07.09 | 18:29
Rispondi citando

è un pò lungo ma forse la soluzione è in questo codice.

//Create variables to be used later on
var loadingSite;
var startedLoad;
var swfLoader;
var siteToLoad;

swfHolder.mask=swfMask; //Make the swfMask the mask of the swfHolder

function easeInt(start,end,ease)
{
//An ease integer function that returns an eased value between start and end
return int(start + (end - start) / ease);
}

function swfLoaderProgressFunction(event)
{
//While the swfLoader is still in progress, update the loader bar
var gotoFrame=int(event.bytesLoaded/event.bytesTotal*500)+1;
swfLoad.gotoAndStop(easeInt(swfLoad.currentFrame,gotoFrame,5));
}
function swfLoaderCompleteFunction(event)
{
//The site is completely loaded, set the loadingSite variable to false
loadingSite=false;
}

function loadSite(swfFile)
{
//Load the site swfFile
//For smoothest transitions, the site will not be loaded right away but later in the enterFrameFunction when the mask finish animating and the old site no longer shows
if(swfFile!=siteToLoad)
{
//Set variables to load the site if the site to load is not the current site
loadingSite=true;
startedLoad=false;
siteToLoad=swfFile;
swfLoad.gotoAndStop(1);
}
}

function enterFrameFunction(event)
{
if (loadingSite)
{
//While it is loading the site and the mask is not on the first frame (no site displayed), make the site mask play
if (swfMask.currentFrame!=1)
{
swfMask.play();

} else if (!startedLoad)
{
//If this code has not been called yet, call it.
startedLoad=true;

//If a site has already been loaded, remove it
if (swfLoader && swfHolder.contains(swfLoader))
{
swfHolder.removeChild(swfLoader);
}

//Make a new loader to load the new site and add listeners to update the loader bar
swfLoader=new Loader();
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, swfLoaderProgressFunction);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaderCompleteFunction);

//Load the site and attach the site to the swfHolder
swfLoader.load(new URLRequest(siteToLoad));
swfHolder.addChild(swfLoader);
}
if(startedLoad)
{
//If it has started to load, display the loader bar
if (swfLoad.alpha<1)
{
swfLoad.visible=true;
swfLoad.alpha+=.1;
if (swfLoad.alpha>1)
{
swfLoad.alpha=1;
}
}
}
} else
{
//If the site is loaded and the mask is still displaying nothing (or is currently closing), make the mask play until it displays everything
if (swfMask.currentFrame!=45)
{
swfMask.play();

}

//If the loader bar is visible, make it disappear with ease
if (swfLoad.visible)
{
swfLoad.gotoAndStop(easeInt(swfLoad.currentFrame,500,5));
swfLoad.alpha*=.9;
if (swfLoad.alpha<.025)
{
swfLoad.alpha=0;
swfLoad.visible=false;
}
}
}
}
this.addEventListener(Event.ENTER_FRAME, enterFrameFunction);

io non ci capisco niente.
spero tu invece si.
grazie
Torna in cima
Profilo Messaggio privato  
Coach
amministratore
amministratore


Età: -1981
Registrato: 31/01/03 13:50
Messaggi: 4549
Località: Verona

MessaggioOggetto:
Inviato: 22.07.09 | 19:58
Rispondi citando

prima legig il PS e correggi ;)
____________________________________________________________


Il Forum è uno strumento di condivisione, oltre a fare DOMANDE, si possono anche dare RISPOSTE!
Torna in cima
Profilo Messaggio privato [ Nascosto ] HomePage Yahoo Messenger MSN Messenger Skype
zioraffa
nuovo utente
nuovo utente



Registrato: 29/04/09 20:28
Messaggi: 10

MessaggioOggetto:
Inviato: 22.07.09 | 22:38
Rispondi citando

scusa non avevo visto, ma comunque non capisco cosa intendi.
Torna in cima
Profilo Messaggio privato  
Coach
amministratore
amministratore


Età: -1981
Registrato: 31/01/03 13:50
Messaggi: 4549
Località: Verona

MessaggioOggetto:
Inviato: 24.07.09 | 10:13
Rispondi citando

intendo questo:
 
Codice:
//tua porzione di codice
function onCode () {
  // actions; 
}

____________________________________________________________


Il Forum è uno strumento di condivisione, oltre a fare DOMANDE, si possono anche dare RISPOSTE!
Torna in cima
Profilo Messaggio privato [ Nascosto ] HomePage Yahoo Messenger MSN Messenger Skype
Mostra prima i messaggi di:   
Nuovo Topic   Rispondi    Forum Flash, Actionscript, PHP e MySQL » ActionScript & Server Side Tutti i fusi orari sono GMT + 2 ore
Pagina 1 di 1

Discussioni Simili
Topic Autore Forum Risposte Ultimo Messaggio
Nessun nuovo messaggio [mxpro] load unload descry Flash Generale 2 16.05.05 | 14:17 Leggi gli ultimi messaggi
descry
Nessun nuovo messaggio Function e variabili cli ActionScript & Server Side 3 25.05.04 | 08:49 Leggi gli ultimi messaggi
Coach
Nessun nuovo messaggio Function non funziona! natura ActionScript & Server Side 2 04.08.08 | 21:17 Leggi gli ultimi messaggi
natura



 
Vai a:  
Non puoi inserire nuovi Topic in questo forum
Non puoi rispondere ai Topic in questo forum
Non puoi modificare i tuoi messaggi in questo forum
Non puoi cancellare i tuoi messaggi in questo forum
Non puoi votare nei sondaggi in questo forum
Non puoi allegare files in questo forum
Puoi downloadare gli allegati in questo forum



Powered by phpBB © 2001, 2002 phpBB Group - phpBB SEO Designed by coachdesign - © 2003-2005