http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=1
stop();
import flash.events.*;
import flash.display.*
var i:uint;
var myXML:XML = new XML();
var XML_URL:String = "banner.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void {
myXML = XML(myLoader.data);
//xml have banner tag
var banner1:String = myXML.banner.link[0];
var banner2:String = myXML.banner.link[1];
var banner3:String = myXML.banner.link[2];
var banner4:String = myXML.banner.link[3];
var banner5:String = myXML.banner.link[4];
var banner6:String = myXML.banner.link[5];
var loader1:Loader = new Loader();
movie1.addChild(loader1);
var banner_url1:URLRequest = new URLRequest(banner1);
loader1.load(banner_url1);
banner_btn1.addEventListener(MouseEvent.CLICK, Btn_1);
banner_btn2.addEventListener(MouseEvent.CLICK, Btn_2);
banner_btn3.addEventListener(MouseEvent.CLICK, Btn_3);
banner_btn4.addEventListener(MouseEvent.CLICK, Btn_4);
banner_btn5.addEventListener(MouseEvent.CLICK, Btn_5);
banner_btn6.addEventListener(MouseEvent.CLICK, Btn_6);
function Btn_1(e:MouseEvent):void {
var banner_url1:URLRequest = new URLRequest(banner1);
loader1.load(banner_url1);
}
function Btn_2(e:MouseEvent):void {
var banner_url2:URLRequest = new URLRequest(banner2);
loader1.load(banner_url2);
}
function Btn_3(e:MouseEvent):void {
var banner_url3:URLRequest = new URLRequest(banner3);
loader1.load(banner_url3);
}
function Btn_4(e:MouseEvent):void {
var banner_url4:URLRequest = new URLRequest(banner4);
loader1.load(banner_url4);
}
function Btn_5(e:MouseEvent):void {
var banner_url5:URLRequest = new URLRequest(banner5);
loader1.load(banner_url5);
}
function Btn_6(e:MouseEvent):void {
var banner_url6:URLRequest = new URLRequest(banner6);
loader1.load(banner_url6);
}
}
/*
===================================================
http://onerutter.com/flash/flash-actionscript-30-xml-text-array-loader.html
http://www.kirupa.com/forum/showthread.php?t=308712
http://www.flepstudio.org/forum/actionscript-3-0-newbies/5073-loading-multiple-swf-s-arrays-as3.html
http://board.flashkit.com/board/showthread.php?t=776675
===================================================
xml version="1.0" encoding="utf-8"
// rakbank>
//
// banner name="banner1" url="index.html"//
name>Banner Generic
link>1.swf
// target>_self
banner
// rakbank>
0 comments:
Post a Comment