Ciao a Tutti.
Ho la necessità di inserire e visualizzare un video caricato su youtube in un sito fatto in flash.
Qualcuno sa dirmi come fare?
Dove e come devo mettere il codice dell'iframe?
Grazie infinite
Mauro
Ciao a Tutti.
Ho la necessità di inserire e visualizzare un video caricato su youtube in un sito fatto in flash.
Qualcuno sa dirmi come fare?
Dove e come devo mettere il codice dell'iframe?
Grazie infinite
Mauro
c
devi mettere questo codice nel primo fotogramma del filmato.
PS dimenticavo sempre che il sito sia in as2.codice:// create a MovieClip to load the player into var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1); // create a listener object for the MovieClipLoader to use var ytPlayerLoaderListener:Object = { onLoadInit: function() { // When the player clip first loads, we start an interval to // check for when the player is ready loadInterval = setInterval(checkPlayerLoaded, 250); } }; var loadInterval:Number; function checkPlayerLoaded():Void { // once the player is ready, we can subscribe to events, or in the case of // the chromeless player, we could load videos if (ytplayer.isPlayerLoaded()) { ytplayer.addEventListener("onStateChange", onPlayerStateChange); ytplayer.addEventListener("onError", onPlayerError); clearInterval(loadInterval); } } function onPlayerStateChange(newState:Number) { trace("New player state: "+ newState); } function onPlayerError(errorCode:Number) { trace("An error occurred: "+ errorCode); } // create a MovieClipLoader to handle the loading of the player var ytPlayerLoader:MovieClipLoader = new MovieClipLoader(); ytPlayerLoader.addListener(ytPlayerLoaderListener); // load the player ytPlayerLoader.loadClip("http://www.youtube.com/", ytplayer);
ciao Randi e grazie per la risposta
Il sito è fatto con flash 8, è la stessa cosa o devo modificare il codice?
grazie mille ancora
c
No va benissimo così.
Scusa ancora io, e come avrai capito non particolarmente sgamato...
ho messo il codice nel primo fotogramma, come da tua indicazione, ma non vedo nulla
chiaramente al posto di youtube.com ho messo l'indirizzo del video
dove dovrebbe essere visualizzato il video?
grazie in anticipo
c
Se hai detto che devi caricare un video da youtube non devi togliere la prima parte dell'indirizzo che si riferisce proprio a youtube, ad esempio metti il seguente codice nel primo frame e fai prova filmato dovrebbe comparire dopo pochi secondi un clip musicale.
codice:// create a MovieClip to load the player into var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1); // create a listener object for the MovieClipLoader to use var ytPlayerLoaderListener:Object = { onLoadInit: function() { // When the player clip first loads, we start an interval to // check for when the player is ready loadInterval = setInterval(checkPlayerLoaded, 250); } }; var loadInterval:Number; function checkPlayerLoaded():Void { // once the player is ready, we can subscribe to events, or in the case of // the chromeless player, we could load videos if (ytplayer.isPlayerLoaded()) { ytplayer.addEventListener("onStateChange", onPlayerStateChange); ytplayer.addEventListener("onError", onPlayerError); clearInterval(loadInterval); } } function onPlayerStateChange(newState:Number) { trace("New player state: "+ newState); } function onPlayerError(errorCode:Number) { trace("An error occurred: "+ errorCode); } // create a MovieClipLoader to handle the loading of the player var ytPlayerLoader:MovieClipLoader = new MovieClipLoader(); ytPlayerLoader.addListener(ytPlayerLoaderListener); // load the player ytPlayerLoader.loadClip("http://www.youtube.com/v/3LgBfE-u9XY&feature=relmfu", ytplayer);