Código :
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;
public class VideoPlaylist extends MovieClip {
private var xmlLoader:URLLoader;
public function VideoPlaylist():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(100, 240);
tileList.columnWidth = 180;
tileList.rowHeight = 60;
tileList.direction = ScrollBarDirection.VERTICAL;
tileList.setStyle("cellRenderer", Thumb);
}
public function initMediaPlayer(event:Event):void {
var myXML:XML = new XML(xmlLoader.data);
var item:XML;
for each(item in myXML.vid) { // populate playlist.
// Get thumbnail value and assign to cellrenderer.
var thumb:String;
if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
// Send data to tileList.
tileList.addItem({label:item.attribute("desc").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumb});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = tileList.selectedItem.data;
// Pause video until selected or played.
myVid.pause();
}
// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}
}
}
Luego sin embargo al intentar poner un boton de vuelta para volver a la otra parte de la web no me funciona guiandome del tutorial Actionscript 3.0 Parte 2: Botones, eventos, getURL y enlaces de esta grandiosa web. Es decir, el tutorial lo hago sin ningún problema, pero cuando incluyo mi codigo dentro del codigo de AS, no funciona y me dan varios errores.
El codigo al que me refiero es
Código :
function abrir (e:Event) : void{
navigateToURL(new URLRequest("http://www.google.es/ig"));
}
botoncito.addEventListener(MouseEvent.CLICK,abrir);
Si alguien pudiese ayudarme le daría el mundo y miles de gracias.
Muchas gracias
[/quote]
