alexa-tracking

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/52de2b0d5acb177c580001b8/ask-bagaimana-cara-unload-xml-di-flash-as3
[ASK] BAGAIMANA CARA UNLOAD XML di flash as3
selamat sore agan2 sekalian saya mo tanya bagaimana cara unload xml dan mengeload file swf lain tanpa harus xml muncul kembali di flash as3 saya lagi buntu nih
berikit kode yang saya kerjakan
Quote:
import fl.video.*;

var thumb_width:Number = 50; // The width of your thumbnail graphics
var thumb_height:Number = 30; // The height of your thumbnail graphics
var thumbs_x:Number = 300; // The space on the left side of the thumbnails
var thumbs_y:Number= 750; // The space from the top of the interface to the row of thumbnails
var video_x:Number = 300; // The space to the left side of the video player
var video_y:Number =180; // The space above video player
var myVideos:XMLList;
var myTotal:Number;
var myContainer:Sprite;
var myThumbs:Sprite;
var myTitles:Sprite;
var myPlayer:FLVPlayback;

var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("link/p.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
/*/\myXMLLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);*/

function onError(e:IOErrorEvent):void {
// Do nothing
}
/*myXMLLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onmyXMLLoadError);*/

/*myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOErrorHandler);*/
function processXML(myEvent:Event):void {
var myXML:XML = new XML(myEvent.target.data);
myVideos = myXML.video;
myTotal = myVideos.length();
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader=null;
makeContainers();
callThumbs();
makePlayer();
}
function makeContainers():void {
myContainer = new Sprite();
addChild(myContainer);
myThumbs = new Sprite();
myThumbs.addEventListener(MouseEvent.CLICK, playVideo);
myThumbs.x = thumbs_x;
myThumbs.y = thumbs_y;
myThumbs.buttonMode = true;
/*myThumbs.addEventListener(MouseEvent.MOUSE_OVER, onOver);
myThumbs.addEventListener(MouseEvent.MOUSE_OUT, onOut); */
myContainer.addChild(myThumbs);
myTitles = new Sprite();
myTitles.x = thumbs_x;
myTitles.y = thumbs_y;
myContainer.addChild(myTitles);
}
function callThumbs():void {
for (var i:Number = 0; i < myTotal; i++) {
var thumb_url = myVideos[i]. @thumb;
var myThumbLoader = new Loader();
myThumbLoader.name = i;
myThumbLoader.load(new URLRequest(thumb_url));
myThumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
myThumbLoader.x = (thumb_width+10)*i;

var thumb_title = myVideos[i]. @title;
var title_txt:TextField = new TextField();

var myFormat:TextFormat = new TextFormat();
myFormat.align = TextFormatAlign.CENTER;
myFormat.size = 12;
myFormat.bold = true;
myFormat.font = "_sans";
// additional formating can be added as needed

title_txt.text = thumb_title;
title_txt.x = myThumbLoader.x+10;
title_txt.y = thumb_height + 5;
title_txt.width = thumb_width - 20;
title_txt.height = thumb_height;
title_txt.wordWrap = true;

myTitles.addChild(title_txt);
title_txt.setTextFormat(myFormat);
}
}

function thumbLoaded(myEvent:Event):void {
var myThumb:Loader = Loader(myEvent.target.loader);
myThumbs.addChild(myThumb);
}

function makePlayer():void {
myPlayer = new FLVPlayback();
myPlayer.skin = "SkinUnderPlaySeekFullscreen.swf";
myPlayer.skinBackgroundColor = 0xAEBEFB;
myPlayer.skinBackgroundAlpha = 0.5;
myPlayer.skinAutoHide = true;
myPlayer.x = video_x;
myPlayer.y = video_y;
myPlayer.width = 852;
myPlayer.height = 480
myContainer.addChild(myPlayer);
myPlayer.source = myVideos[0]. @ url;
}

function playVideo(myEvent:MouseEvent):void {
var video_url = myVideos[myEvent.target.name].@url;
myPlayer.source = video_url;
}




load_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(MouseEvent):void {//nama fungsi ini harus sama denganyg di atas
//melakukan action ketika 'myButton di klik'
removeChild(makePlayer);
delete makePlayer;
//makePlayer.unload();

gotoAndStop(3);
}
remove isi myContainer aja gan
terus ambil ulang XML, gak perlu ke frame 3 kayaknya
Unload thu apa y, saya masih belum ngerti