Foros del Web » Creando para Internet » Flash y Actionscript »

Quitar autoplay de resproductor swf

Estas en el tema de Quitar autoplay de resproductor swf en el foro de Flash y Actionscript en Foros del Web. Hola comunidad , esta es la primera vez q escribo en el foro. tengo un reproductor swf el cual tiene autoplay, cuando se carga el ...
  #1 (permalink)  
Antiguo 02/07/2011, 16:29
 
Fecha de Ingreso: julio-2011
Mensajes: 2
Antigüedad: 13 años, 4 meses
Puntos: 0
Pregunta Quitar autoplay de resproductor swf

Hola comunidad , esta es la primera vez q escribo en el foro.
tengo un reproductor swf el cual tiene autoplay, cuando se carga el sitio empiesa a reproducir. me gustaria saber como puedo realizar un autoplay= false..

este es el codigo as2

import mx.transitions.Tween;
import mx.transitions.easing.*;

System.security.allowDomain("youtube.com","http://youtube.com","www.youtube.com","8.7.217.31");

controlButtons.playPause.gotoAndStop("Play");

Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.showMenu = false;

// create a listener object for the MovieClipLoader to use
var ytPlayerLoaderListener:Object = {
onLoadInit: function() {
loadInterval = setInterval(checkPlayerLoaded, 250);
}
};

var loadInterval:Number;
var theVideos:Array = new Array();
var whoIsOn:Number = 2;
var nodes;
var theTitles:Array = new Array();
var theDetails:Array = new Array();
var shuffle:Boolean = false;
var repeat:Boolean = false;
var playInterval:Number;
var firstTimePlayed:Boolean = true;

function startPlay(){
clearInterval(playInterval);
textChange();
ytplayer.loadVideoById(theVideos[whoIsOn], 0);
}

function beforeStartPlay(){
clearInterval(playInterval);
playInterval = setInterval(startPlay, 1000);
theCurrentItem();
ytplayer.pauseVideo();
}

function checkPlayerLoaded():Void {
if (ytplayer.isPlayerLoaded()) {
ytplayer.setSize(650, 340);
ytplayer._x = 10;
ytplayer._y = 10;
ytplayer.addEventListener("onStateChange", onPlayerStateChange);
ytplayer.addEventListener("onError", onPlayerError);
ytplayer.stop();
clearInterval(loadInterval);
}
}

function checkPlayerLoaded2():Void {
firstTimePlayed = false;
if (ytplayer.isPlayerLoaded()) {
startPlay();
theCurrentItem();
whoIsOn = 0;
clearInterval(loadInterval2);
}
}

/*onStateChange - This event is fired whenever the player's state changes.
Possible values are unstarted (-1), ended (0), playing (1),
paused (2), buffering (3), video cued (5).
When the SWF is first loaded it will broadcast an unstarted (-1) event.
When the video is cued and ready to play it will broadcast a video cued event (5).*/
function onPlayerStateChange(newState:Number) {
trace("New player state: "+ newState);
if(newState == 2 && controlButtons.playPause._currentframe == 30){
controlButtons.playPause.gotoAndStop("playOver");
}else if(controlButtons.playPause._currentframe == 20){
controlButtons.playPause.gotoAndStop("pause");
}

if(newState == 0){
if(shuffle == false){
if(repeat == false){
whoIsOn++;
if(whoIsOn >= nodes.length){
whoIsOn = 0;
listBox.dragger._y = 0;
}
}
}else{
if(repeat == false){
whoIsOn = Math.floor(Math.random()*(nodes.length-1));
}
}
beforeStartPlay();
}
if(newState == 1){
if(_root.get_highest_quality == "true"){
theQuality();
}
progressBar.onEnterFrame = videoUpdate;
butArray[whoIsOn].theTime.text = getTimecode(ytplayer.getDuration());
}

if(newState == 5){
controlButtons.playPause.gotoAndStop("play");
}
}



function onPlayerError(errorCode:Number) {
//trace("An error occurred: "+ errorCode);
errorItem();
//if(errorCode == 100){
whoIsOn++;
if(whoIsOn >= nodes.length){
whoIsOn = 0;
}
beforeStartPlay();
//}
}

// 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/apiplayer", ytplayer);


//xml stuff
var myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(){
theVideos = [];
whoIsOn = 0;
nodes = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++){
theTitles.push(nodes[i].childNodes[0].firstChild.nodeValue);
theVideos.push(nodes[i].childNodes[1].firstChild.nodeValue);
theDetails.push(nodes[i].childNodes[2].firstChild.nodeValue);
}
loadMenu();
if(_root.autoplay != "false"){
loadInterval2 = setInterval(checkPlayerLoaded2, 250);
}
}

if(_root.playlist){
myXML.load(_root.playlist + ".xml");
}else{
myXML.load("mylist2.xml");
}

var listener:Object = new Object();
listener.tmc = target;
listener.onLoadInit = function(mc:MovieClip) {
new Tween(mc,"_alpha", Strong.easeOut,0,100,1,true);
mc._width = 65;
mc._height = 50;
};
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);

overlayBtn.useHandCursor = false;
overlayBtn._visible = false;

var btnOver;
var butArray:Array = new Array();
function loadMenu(){
for (var i:Number=0;i<theTitles.length;i++){
var but:MovieClip = listBox.theList.attachMovie("listItem","listItem"+ i,i,{_y:(i*60)});
but.theName.htmlText = theTitles[i];
but.theDescription.htmlText = theDetails[i];
loader.loadClip("http://img.youtube.com/vi/" + theVideos[i] + "/2.jpg", but.theThumbnail);
but.i = i;
butArray.push(but)
if((i & 1) == 0){
var my_colorB1:Color = new Color(but.itemBg);
my_colorB1.setRGB(0xF7F7F7);
}else{
var my_colorB1:Color = new Color(but.itemBg);
my_colorB1.setRGB(0xF1F1F1);
}

but.onRollOver = function(){
if(_root.rollover_changing_thumbs == "true"){
btnOver = this;
thumbInterval = setInterval(thumbTimer, 1000);
}
}
but.onRollOut = but.onReleaseOutside = function(){
if(_root.rollover_changing_thumbs == "true"){
clearInterval(thumbInterval);
vTime = 0;
}
}
but.onRelease = function(){
whoIsOn = this.i;
beforeStartPlay();
}
}
}

var vTime:Number = 0;
function thumbTimer(){
vTime++;
switch (vTime) {
case 1 :
//btnOver.theThumbnail.loadMovie("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/1.jpg");
loader.loadClip("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/1.jpg", btnOver.theThumbnail);
break;

case 2:
//btnOver.theThumbnail.loadMovie("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/2.jpg");
loader.loadClip("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/2.jpg", btnOver.theThumbnail);
break;

case 3:
//btnOver.theThumbnail.loadMovie("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/3.jpg");
loader.loadClip("http://img.youtube.com/vi/" + theVideos[btnOver.i] + "/3.jpg", btnOver.theThumbnail);
vTime = 0;
break;
}
}




function errorItem(){
var my_colorB4:Color = new Color(butArray[whoIsOn].theName);
my_colorB4.setRGB(0xFF0000);
}

function theCurrentItem(){
if(listBox.theList._height > listBox.theMask._height && listBox.dragger._y <= (listBox.theMask._height - listBox.dragger._height)){
listBox.dragger._y = ((listBox.theMask._height-listBox.dragger._height)/100)*((whoIsOn*100)/(nodes.length-1));
}
var my_colorB2:Color = new Color(butArray[whoIsOn].itemBg);
my_colorB2.setRGB(0xCFE0E9);

butArray[whoIsOn].theName.htmlText = "<b>"+theTitles[whoIsOn]+"</b>";
for (var i:Number=0;i<theTitles.length;i++){
if(i != whoIsOn){
butArray[i].theName.htmlText = theTitles[i];
if((butArray[i].i & 1) == 0){
var my_colorB3:Color = new Color(butArray[i].itemBg);
my_colorB3.setRGB(0xF7F7F7);
}else{
var my_colorB3:Color = new Color(butArray[i].itemBg);
my_colorB3.setRGB(0xF1F1F1);
}
}
}
}

controlButtons.nextBtn.onRelease = function(){
if(shuffle == true){
whoIsOn = Math.floor(Math.random()*(nodes.length-1));
}else{
whoIsOn++;
if(whoIsOn >= nodes.length){
whoIsOn = 0;
}
}
beforeStartPlay();
}


controlButtons.prevBtn.onRelease = function(){
if(shuffle == true){
whoIsOn = Math.floor(Math.random()*(nodes.length-1));
}else{
whoIsOn--;
if(whoIsOn < 0){
whoIsOn = nodes.length-1;
}
}
beforeStartPlay();
}

//play - pause
controlButtons.playPause.onRollOver = function() {
if(this._currentframe == 1) {
controlButtons.playPause.gotoAndStop("pauseOver");
}
else {
controlButtons.playPause.gotoAndStop("playOver");
}
}

controlButtons.playPause.onRollOut = function() {
if(this._currentframe == 10) {
controlButtons.playPause.gotoAndStop("pause");
}
else {
controlButtons.playPause.gotoAndStop("play");
}
}


controlButtons.playPause.onRelease = function() {
if(firstTimePlayed == true){
loadInterval2 = setInterval(checkPlayerLoaded2, 250);
}

if(this._currentframe == 10) {
controlButtons.playPause.gotoAndStop("playOver");
ytplayer.pauseVideo();
}else{
controlButtons.playPause.gotoAndStop("pauseOver");
ytplayer.pauseVideo();
}
}






//progress
function videoUpdate(){
if (ytplayer.getDuration() > 0) {
progressBar._xscale = (ytplayer.getCurrentTime()/ytplayer.getDuration())*100;
scrub._x = Math.floor(progressBar._width+progressBar._x);
}
else {
scrub._x = progressBar._x;
}
theTime.text = getTimecode(ytplayer.getCurrentTime())+" / "+getTimecode(ytplayer.getDuration());
if(theTime.text == "NaN:NaN / NaN:NaN"){
theTime.text = "00:00 / 00:00";
}
}


loadBar.onPress = function() {
progressBar.onEnterFrame = videoScrub;
}

loadBar.onRelease = loadBar.onReleaseOutside = function() {
delete progressBar.onEnterFrame;
}

function videoScrub() {
var dist:Number = (_xmouse-loadBar._x)/loadBar._width;
if(dist < 0){
dist = 0;
}
if(dist > 1){
dist = 1;
}
ytplayer.seekTo(Math.floor(ytplayer.getDuration()* dist), true);
progressBar._xscale = (dist)*100;
scrub._x = Math.floor(progressBar._width+loadBar._x);
}
scrub._x = loadBar._x;
progressBar._xscale = 0;

}
}


gracias por cualquier ayuda que me puedan aportar.
  #2 (permalink)  
Antiguo 02/07/2011, 21:05
 
Fecha de Ingreso: julio-2011
Mensajes: 2
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: Quitar autoplay de resproductor swf

alguna idea ,,, agradesco cualquier tipo de ayuda xD

Etiquetas: as2, autoplay, flash
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:56.