Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/11/2013, 10:36
Pimager
 
Fecha de Ingreso: julio-2010
Mensajes: 298
Antigüedad: 14 años, 6 meses
Puntos: 8
Respuesta: Problema con As3

Hola andrek_cp22, prueba esto:
Código:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.video.*;
import fl.video.FLVPlayback;


var counter:uint=0;
var myxml:XML=new FLVPlayback();
var flvPlayer:FLVPlayback=new FLVPlayback();
flvPlayer.skin="SkinOverPlaySeekMute.swf";
flvPlayer.autoPlay=false;
flvPlayer.skinAutoHide=true;
addChild(flvPlayer);

var myLoader: URLLoader=new URLLoader();
myLoader.load(new URLRequest("videos.xml"));

myLoader.addEventListener(Event.COMPLETE,loaded);
function loaded(event:Event){
	myxml=XML(event.target.data);
	var videoIndex:Number= myxml.video.lenght()-1;
	trace(myxml, videoIndex);
	centerAlingnAndPlay();

	leftBtn.addEventListener(MouseEvent.CLICK,prevVide o);
	rightBtn.addEventListener(MouseEvent.CLICK, nextVideo);
}

function prevVideo(event:MouseEvent){
	if(counter>0){counter--;centerAlignAndPlay()}
	else{counter=3; centerAlignAndPlay()}
}

function nextVideo(event:MouseEvent){
	if(counter<videoIndex){counter++; centerAlignAndPlay()}
	else{counter=0;centerAlignAndPlay()}
}

flvPlayer.addEventListener(Event.COMPLETE,complete Play);
function completePlay (event:Event):void{
	if(counter<videoIndex){counter++;centerAlignAndPla y()}
	else{counter=0;centerAlignAndPlay()}
}


function centerAlignAndPlay(){
	flvPlayer.source=myxml.video[counter].@movie;

	flvPlayer.addEventListener(VideoProgressEvent.PROG RESS,onFlvPlayback_PROGRESS);
}
function onFLVPlayback_PROGRESS(event:VideoProgressEvent):void {
	var total:Number= event.target.bytesTotal;
	var part:Number= event.target.bytesLoaded;
	var percentage:Number= part / total;
	var percentageFormatted:String=Math.floor(percentage*1 00)+"%";
	status_txt.text=percentageFormatted+"loaded";
	if(part==total){flvPlayer.play();status_txt.text=" ";}
}

var mywidth = (stage.stageWidth-myxml.video[counter].@width)/2;
var myheight = (stage.stageHeight-myxml.video[counter].@height)/2;
flvPlayer.width=myxml.video[counter].@width;
flvPlayer.height=myxml.video[counter].@height;
flvPlayer.x=mywidth;
flvPlayer.y=myheight;
title.text=myxml.video[counter].@title;
Lo que te estaba diciendo es que te faltaba cerrar o te sobraba algun }