Código PHP:
import fl.controls.CheckBox
var xml:XML=
<contenido>
<url name="chec1">ico1.swf</url>
<url name="chec2">ico2.swf</url>
<url name="chec3">ico3.swf</url>
<url name="chec4">ico4.swf</url>
</contenido>
function createCheckBox(){
for (var i:int=0;i<xml.child('url').length();i++){
var checkBox:CheckBox=new CheckBox()
checkBox.label=xml.url[i].@name
checkBox.y=checkBox.height*i
addEvent(checkBox,i,xml.url[i])
addChild(checkBox)
}
}
function addEvent(checBox:CheckBox,id:int,url:String):void{
var loader:Loader=new Loader()
addChild(loader)
checBox.addEventListener(Event.CHANGE, upLoadDownLoad);
function upLoadDownLoad(event:Event):void{
if (checBox.selected) {
loader.load(new URLRequest(url))
}else{
loader.unload();
}
}
}
createCheckBox()