close / unload UiLoader as3 - actionscript-3

I'm using a Loader to display a SWF. I have a button to load the SWF and I want that same button to close or hide or unload the SWF.
Here's part of my code:
var so:Boolean = false ;
glossary.addEventListener(MouseEvent.CLICK, glossaire)
function glossaire (e:MouseEvent) {
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("glossary.swf");
if (so == false )
{
so = true ;
myLoader1.load(url);
addChild(myLoader);
}
else{
so = false ;
//i tried
myUILoader.unload();
removeChild(myUILoader);
// but my loader still appear in the stage how can remove or hide it
}
}

Your issue is that your loader is scoped to the click function, and that you are creating a new Loader every click (when really you only want to create a new loader on the first click). Also, you seem to be confused on what your loader is called as you have references to myLoader, myLoader1 and myUILoader.
//put the loader var out of the function scope here (so it persists after the function finishes).
var myLoader:Loader;
glossary.addEventListener(MouseEvent.CLICK, glossaire);
function glossaire (e:MouseEvent){
//instead of using the so boolean, just check if loader is null
if (myLoader == null){
myLoader = new Loader();
myLoader.load(new URLRequest("glossary.swf"));
addChild(myLoader);
}else{
myLoader.unloadAndStop();
removeChild(myLoader);
myLoader = null; //set it to null now that it's been removed, so the next time this click function runs, a new loader will be made
}
}
If you just wanted to hide the loaded swf (instead of completely unloading it), you could do this:
function glossaire (e:MouseEvent){
//create the loader and load if it hasn't been done yet
if (myLoader == null){
myLoader = new Loader();
myLoader.load(new URLRequest("glossary.swf"));
}
//the parent property of the loader will be null if it hasn't been added (or has been removed) via addChild/removeChild
if(myLoader.parent != null){
removeChild(myLoader);
}else{
addChild(myLoader);
}
}

Ok , let me tell you an easy way to solve this issue,
Create a load complete event Event.Complete and listen it to a function , set a boolean from there , in your case var so:Boolean and use the same functionality,
var so:Boolean = false ;
glossary.addEventListener(MouseEvent.CLICK, glossaire)
function glossaire (e:MouseEvent) {
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("glossary.swf");
myLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, swfload);
if (so == false )
{
so = true ;
myLoader.load(url);
addChild(myLoader);
}
else{
so = false ;
//i tried
myUILoader.unload();
removeChild(myUILoader);
// but my loader still appear in the stage how can remove or hide it
}
}
function swfload(e:Event):void
{
if(e.type == Complete)
so = false;
}

Related

ActionScript3 remove child error

I recently have been converting an as2 fla to as3 (new to AS3) and have the entire thing working on export, but I am getting an error when I try to remove previously loaded swf's before a new swf is loaded
ArgumentError: Error #2025: The supplied DisplayObject
must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at MethodInfo-11()
I know the error relates to my removeChild code here:
`stage.addEventListener(MouseEvent.CLICK, removeSWF);
function removeSWF (e:MouseEvent):void
{
if(vBox.numChildren !=0){
// swfLoader.unloadAndStop();
vBox.removeChild(swfLoader);// empty the movieClip memory
}
}`
However, I cannot seem to find a suitable rewrite for this code that will work and not have an error. This code IS working, so I'm not sure if it would be worth my time to fix this error, or just leave it. I've already messed with it for a couple days, so at this point it's just frustrating me that I cannot fix it.
The stage mouse click listener is useful in this case because I have a back button not shown in this code that clears the loaded swf's before moving to another scene.
Does anyone see a simple solution for this, or do you think it is unnecessary to pursue since the code does what I require?
ENTIRE CODE:
function launchSWF(vBox, vFile):void {
var swfLoader:Loader = new Loader();
var swfURL:URLRequest = new URLRequest(vFile);
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
swfLoader.load(swfURL);
function loadProdComplete(e:Event):void {
trace("swf file loaded");
vBox.removeChild(preLoader);
vBox.addChild(swfLoader);
currentSWF = MovieClip(swfLoader.content);
currentSWF.gotoAndPlay(1);
currentSWF.addEventListener(Event.ENTER_FRAME , checkLastFrame);
swfLoader.x = 165;
swfLoader.y = 15;
function checkLastFrame(e:Event):void {
if (currentSWF.currentFrame == currentSWF.totalFrames) {
currentSWF.stop();
// trace("DONE");
}
}
}
var preLoader:loader = new loader();
preLoader.x = 450;
preLoader.y = 280;
vBox.addChild(preLoader);
function onProgressHandler(event:ProgressEvent){
var dataAmountLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
//preLoader.bar.scaleX = dataAmountLoaded/100;
preLoader.lpc.text= int(dataAmountLoaded)+"%";
//trace(preLoader.bar.scaleX );
}
//NEW ERRORS BUT WORKING
stage.addEventListener(MouseEvent.CLICK, removeSWF);
function removeSWF (e:MouseEvent):void
{
if(vBox.numChildren !=0){
// swfLoader.unloadAndStop();
vBox.removeChild(swfLoader);// empty the movieClip memory
}
}
}
var container:MovieClip = new MovieClip();
var currentSWF:MovieClip = new MovieClip();
fall_b.addEventListener(MouseEvent.CLICK, fall_bClick);
function fall_bClick(e:MouseEvent):void {
var swfFile:String = 'load/fall.swf';
launchSWF(container, swfFile);
addChild(container);
}
face_b.addEventListener(MouseEvent.CLICK, face_bClick);
function face_bClick(e:MouseEvent):void {
var swfFile:String = 'load/face.swf';
launchSWF(container, swfFile);
addChild(container);
}
rott_b.addEventListener(MouseEvent.CLICK, rott_bClick);
function rott_bClick(e:MouseEvent):void {
var swfFile:String = 'load/rottgut.swf';
launchSWF(container, swfFile);
addChild(container);
}
//MORE SWFS...
Any advice anyone has is appreciated
First of all function launchSWF(vBox, vFile):void { isn't closed. You've also got function inside functions which is easy enough for you to solve if you click the lines the curly brackets start and end on to track them.
I can't see anything wrong with the code you said has an error but I'm guessing this isn't all the code. If you using Flash Professisonal you can use permit debugging to show the line the error is on.
EDIT: Please note this hasn't been tested as I'm on my mobile writing out code. That being said this should now work:
var container:MovieClip;
var currentSWF:MovieClip;
var swfFile:String;
var swfLoader:Loader;
var preLoader:Loader;
var swfURL:URLRequest;
init();
function init():void {
preLoader = new Loader();
preLoader.x = 450;
preLoader.y = 280;
vBox.addChild(preLoader);
container = new MovieClip();
currentSWF = new MovieClip();
fall_b.addEventListener(MouseEvent.CLICK, fall_bClick);
face_b.addEventListener(MouseEvent.CLICK, face_bClick);
rott_b.addEventListener(MouseEvent.CLICK, rott_bClick);
stage.addEventListener(MouseEvent.CLICK, removeSWF);
}
function launchSWF(vBox, vFile):void {
swfLoader = new Loader();
swfURL = new URLRequest(vFile);
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
swfLoader.load(swfURL);
}
function loadProdComplete(e:Event):void {
trace("swf file loaded");
vBox.removeChild(preLoader);
vBox.addChild(swfLoader);
currentSWF = MovieClip(swfLoader.content);
currentSWF.gotoAndPlay(1);
currentSWF.addEventListener(Event.ENTER_FRAME , checkLastFrame);
swfLoader.x = 165;
swfLoader.y = 15;
}
function checkLastFrame(e:Event):void {
if (currentSWF.currentFrame == currentSWF.totalFrames) {
currentSWF.stop();
// trace("DONE");
}
}
function onProgressHandler(event:ProgressEvent) {
var dataAmountLoaded:Number = (event.bytesLoaded / event.bytesTotal * 100);
//preLoader.bar.scaleX = dataAmountLoaded/100;
preLoader.lpc.text = int(dataAmountLoaded)+"%";
//trace(preLoader.bar.scaleX );
}
function removeSWF (e:MouseEvent):void {
if(vBox.numChildren !=0){
//swfLoader.unloadAndStop();
vBox.removeChild(swfLoader);// empty the movieClip memory
}
}
function fall_bClick(e:MouseEvent):void {
swfFile = 'load/fall.swf';
launchSWF(container, swfFile);
addChild(container);
}
function face_bClick(e:MouseEvent):void {
swfFile = 'load/face.swf';
launchSWF(container, swfFile);
addChild(container);
}
function rott_bClick(e:MouseEvent):void {
swfFile = 'load/rottgut.swf';
launchSWF(container, swfFile);
addChild(container);
}
I have this rewritten. I could not get the vBox errors cleared in the original code, and I was getting many other errors with what was posted. The vBox code was seen on a tutorial. I think it was supposed to reference the loader for the preloader and the swf, and vFile was for the actual .swf. The following code preloads multiple swfs and clears them with no errors. I appreciate your help AntBirch. I'm beginning to understand loaders in as3 a little more now.
//LOAD FIRST PIECE ON OPEN (required to removeChild later)
var swfLoader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("load/fall.swf");
swfLoader.load(defaultSWF);
swfLoader.x = 165;
swfLoader.y = 15;
addChild(swfLoader);
//PRELOADER
var preLoader:loader = new loader();
preLoader.x = 450;
preLoader.y = 280;
function loadProdComplete(e:Event):void {
trace("swf file loaded");
removeChild(preLoader);
addChild(swfLoader);
}
function onProgressHandler(event:ProgressEvent){
var dataAmountLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
preLoader.lpc.text= int(dataAmountLoaded)+"%";
}
//BUTTONS
function btnClick(event:MouseEvent):void {
swfLoader.unloadAndStop();
removeChild(swfLoader);
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
addChild(preLoader);
var newSWFRequest:URLRequest = new URLRequest("load/" + event.target.name + ".swf");
swfLoader.load(newSWFRequest);
swfLoader.x = 165;
swfLoader.y = 15;;
addChild(swfLoader);
}
// BUTTON LISTENERS
fall.addEventListener(MouseEvent.CLICK, btnClick);
face.addEventListener(MouseEvent.CLICK, btnClick);
rott.addEventListener(MouseEvent.CLICK, btnClick);
angel.addEventListener(MouseEvent.CLICK, btnClick);
ratts.addEventListener(MouseEvent.CLICK, btnClick);
metal.addEventListener(MouseEvent.CLICK, btnClick);
//etc...
//BACK BUTTON
BB3.addEventListener(MouseEvent.CLICK, BB3Click);
function BB3Click(e:MouseEvent):void {
swfLoader.unloadAndStop();
removeChild(swfLoader);
this.gotoAndPlay(1 ,"Scene 2")
}

unload external swf (child) from the main screen when it has reached last frame?

I have an external swf loading into a main frame (the URL request), and when the swf reaches it's final frame I need it to UNLOAD itself. I need to do this without any code on the CHILD swf, as this is for an iOS application. Can anyone help?
//start button
start_button_aboriginal.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);
import fl.display.ProLoader;
var fl_ProLoader_3:ProLoader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_3:Boolean = true;
function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
{
if(fl_ToLoad_3)
{
fl_ProLoader_3 = new ProLoader();
fl_ProLoader_3.load(new URLRequest("myths/myth_aboriginal.swf"));
addChild(fl_ProLoader_3);
fl_ProLoader_3.x = 114;
fl_ProLoader_3.y = 41;
}
else
{
fl_ProLoader_3.unload();
removeChild(fl_ProLoader_3);
fl_ProLoader_3 = null;
}
// Toggle whether you want to load or unload the SWF
fl_ToLoad_3 = !fl_ToLoad_3;
//here, I want to UNLOAD the external SWF when it is finished playing.
var totFrames:Number=childMC.totalFrames;
var curFrame:Number;
childMC.addEventListener(Event.ENTER_FRAME, remove);
function remove(evt:Event):void {
curFrame=childMC.currentFrame;
if (totFrames==curFrame) {
removeChild(childMC);
}
}
You need to declare childMC in a global scope and the assign the loader content.
and dont declare functions inside of functions!!
something like this NOT TESTET
import fl.display.Loader; // impoerts belong at the top
var fl_ProLoader_3:ProLoader; // then your global vars
var childMC:MovieClip; // instatiate childMC with global scope
start_button_aboriginal.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3,false,0,false); // listener with weak refference
var fl_ToLoad_3:Boolean = true;
function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
{
if(fl_ToLoad_3)
{
fl_ProLoader_3 = new Loader();
var url:URLRequest = new URLRequest("myths/myth_aboriginal.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null); // IOS needs this
fl_ProLoader_3.load(url, loaderContext);
fl_ProLoader_3.addEventListener(Event.COMPLETE, loadCompleteHandler,false,0,false);
}
else
{
if(childMC){
removeChild(childMC);
childMC.unloadAndStop();
childMC = null;
}
}
// Toggle whether you want to load or unload the SWF
fl_ToLoad_3 = !fl_ToLoad_3;
}
function loadCompleteHandler(evt:Event):void
{
childMC = evt.target.content as MovieClip;
childMC.addEventListener(Event.ENTER_FRAME, remove);
addChild(childMC);
childMC.x = 114;
childMC.y = 41;
}
function remove(evt:Event):void {
var totFrames:Number=childMC.totalFrames;
var curFrame:Number =childMC.currentFrame;;
if (totFrames==curFrame) {
childMC.removeEventListener(Event.ENTER_FRAME, remove);
removeChild(childMC);
childMC.unloadAndStop();
childMC = null;
}
}

Force to refresh movie clip?

I have a really simple code piece like that;
loadingMc.visible = true;
trace("ok");
// send photo to server
loadingMc.visible = false;
Sending photo takes 3-5 seconds but movie clip becomes visible only for last second of process. I can see "ok" message in output at start of the process. So i assume problem is not redrawing movie clip. Is there any option to force redraw before process starts?
UPDATE:
Sending to server part;
upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
loadingText.visible = true;
trace("ok");
var bmd:BitmapData = new BitmapData(1024,768,true,0);
bmd.draw(imageArea);
savePicToServer(bmd);
});
function savePicToServer(bmd:BitmapData):void
{
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(bmd);
var loader:URLLoader = new URLLoader();
configureListeners(loader);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var request:URLRequest = new URLRequest("http://localhost/test/upload.php?key=prvkey");
request.requestHeaders.push(header);
request.method = URLRequestMethod.POST;
request.data = jpgStream;
loader.load(request);
}
In the COMPLETE event;
loadingText.visible = false;
EDIT
Just from reading your code, I don't see why this should not be working - but FP does strange things sometimes.
In similar cases, I used setTimeout() to force the player to delay the subsequent actions and allow the screen to refresh:
upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
loadingText.visible = true;
trace("ok");
setTimeout( doSave, 10 );
});
private function doSave() : void {
var bmd:BitmapData = new BitmapData(1024,768,true,0);
bmd.draw(imageArea);
savePicToServer(bmd);
}
If this still doesn't work, perhaps a longer timeout will do the trick - but 10ms usually should be enough to refresh the screen.
EDIT
Another way would be to add and remove an ENTER_FRAME listener to make sure the frame really was refreshed:
upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
loadingText.visible = true;
trace("ok");
addEventListener( Event.ENTER_FRAME, onNextFrame );
});
private function onNextFrame( ev:Event ) : void {
removeEventListener( Event.ENTER_FRAME, onNextFrame );
doSave();
}
private function doSave() : void {
var bmd:BitmapData = new BitmapData(1024,768,true,0);
bmd.draw(imageArea);
savePicToServer(bmd);
}

action script 3.0 .I had tried a program that should move the dragger as well as the content movieclip,

In this code i need a progressbar to progress through while the imported .swf file is playing, meanwhile i should able to drag the dragger in the progress bar (i.e the rate of movement of dragger should sync with rate of .swf file playing). I got Argument error: #2109 Frame label 459.99 not found in scene1.
var loader:Loader = new Loader();
playBtn.visible = true;
pauseBtn.visible = false;
btn_00.addEventListener(MouseEvent.CLICK, fileLoaded);
btn_01.addEventListener(MouseEvent.CLICK, fileLoaded);
btn_02.addEventListener(MouseEvent.CLICK, fileLoaded);
function fileLoaded(evt:MouseEvent):void
{
var fileName:String = evt.currentTarget.name;
var fileNumber:String = fileName.split("_")[1];
var urlPath:String = "assets/file_" + fileNumber + ".swf";
loader.load(new URLRequest(urlPath));
addChild(loader);
}
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
function swfLoaded(event:Event):void
{
addEventListener(Event.ENTER_FRAME, trackPlayback);
}
function trackPlayback(event:Event):void
{
var perPlayed:Number = MovieClip(loader.content).currentFrame / MovieClip(loader.content).totalFrames;
progressbar.drag.x = (progressbar.bar.width - progressbar.drag.width) * perPlayed;
}
progressbar.drag.buttonMode = true;
var dragClicked:Boolean = false;
var xpos:Number = progressbar.bar.x * progressbar.drag.width;
progressbar.drag.addEventListener(MouseEvent.MOUSE_DOWN,dragMouseDown);
function dragMouseDown(evt:MouseEvent):void
{
trace(" inside mouse down ");
dragClicked = true;
progressbar.drag.startDrag(false,new Rectangle(xpos,0,progressbar.width-progressbar.drag.width,0));
}
progressbar.drag.addEventListener(MouseEvent.MOUSE_UP,dragMouseUp);
function dragMouseUp(evt:MouseEvent):void
{
dragClicked = false;
progressbar.drag.stopDrag();
var cnt:Number = (progressbar.drag.x/(progressbar.width-progressbar.drag.width))*MovieClip(loader.content).totalFrames;
MovieClip(loader.content).gotoAndPlay(cnt);
}
Pls solve my issue.
Thanks in advance.
To access a specific frame, you need to provide an integer value where at the moment you are using a floating-point value.
A simple fix would be to cast the Number to an int:
MovieClip(loader.content).gotoAndPlay(int(cnt));

Flash As3 Loader Problem

Hi iam trying to load a few external jpegs in As3.
It works fine locally in Flash, but it dosen't work at all ion my server.
My app also loads a youtube video simultaneously.
function drawResult(index,videoID,song_title,thumbnail:String=null)
{
var theClip:resultRowClip=new resultRowClip ();
_clip.addChild(theClip);
myArray[index] = new Array(videoID,theClip);
theClip.y=0+(43*(index-1));
theClip.rowText.text = song_title;
theClip.rowBack.visible = false;
if (thumbnail != ""){
theClip.tHolder.visible=true;
loadImage(thumbnail,index);
}
}
function loadImage(url:String,index):void
{
//this.myClip.myText.text += "load image";
// Set properties on my Loader object
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (evt:Event){imageLoaded(evt,index)});
}
function imageLoaded(evt,id):void
{
//this.myClip.myText.text += "id : evt : " + evt.status;
// Load Image
var image:Bitmap = new Bitmap(evt.target.content.bitmapData);
myArray[id][1].tHolder.addChild(image);
myArray[id][1].tHolder.width=myArray[id][1].tHolder.width*0.35;
myArray[id][1].tHolder.height=myArray[id][1].tHolder.height*0.35;
}
Does anyone knows what the problem is ?
** I added two Evenet listeners from io Error :
imageLoader.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
This is the function for handling the errors :
private function ioErrorHandler(event:IOErrorEvent):void {
this.myClip.myText.text +=("ioErrorHandler: " + event);
}
anyway, I got no errors...
I also tried to move the listeners before imageLoader.load but it's still the same...no errors and no data loaded..
I change my code to patrikS suggestion :
function loadImage(url:String,index):void
{
//this.myClip.myText.text += "load image";
// Set properties on my Loader object
//if (index != 1) return;
var imageLoader:Loader = new Loader();
imageLoader.name = index.toString();
//myArray[index][1].addChild(imageLoader);
//imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (evt:Event){imageLoaded(evt,index)});
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
imageLoader.load(new URLRequest(url));
}
My current completeHandler function(tnx patrikS ) :
private function completeHandler(evt:Event):void{
//this.myClip.myText.text += "id : evt : " + evt.status;
// Load Image
trace("evt target loader name : "+ evt.target.loader.name );
evt.target.removeEventListener(Event.COMPLETE, completeHandler );
var image:Bitmap = new Bitmap(evt.target.content.bitmapData);
myArray[evt.target.loader.name][1].tHolder.addChild(image);
myArray[evt.target.loader.name][1].tHolder.width=myArray[evt.target.loader.name][1].tHolder.width*0.35;
myArray[evt.target.loader.name][1].tHolder.height=myArray[evt.target.loader.name][1].tHolder.height*0.35;
//trace (hadar.y + "Y / X" + hadar.x);
}
It still work only on flash IDE and dosent work on any browser...
try urlstream and check crossdomain.xml :)
urlstream = new URLStream();
urlstream.addEventListener(Event.COMPLETE, onLoad);
urlstream.addEventListener(IOErrorEvent.IO_ERROR, onErr);
urlstream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onErr);
urlstream.load(req);
private function onLoad(e:Event):void {
var ba:ByteArray = new ByteArray();
urlstream.readBytes(ba, 0, urlstream.bytesAvailable);
_loader.contentLoaderInfo.addEventListener(Event.INIT, onBytesLoad);
_loader.loadBytes(ba);
}
Listeners should be added before calling the load() method.
Also there's no real advantage in using a closure for the complete event listener & think of removing the event listeners!
function loadImage(url:String, index:int):void
{
//this.myClip.myText.text += "load image";
// Set properties on my Loader object
var imageLoader:Loader = new Loader();
imageLoader.name = index.toString();
//make sure you to add your listeners here!
imageLoader.contentLoaderInfo.addEventListener(
IOErrorEvent.IO_ERROR,ioErrorHandler);
imageLoader.contentLoaderInfo.addEventListener(
Event.COMPLETE, completeHandler );
imageLoader.load(new URLRequest(url));
}
function completeHandler(event:Event ):void
{
//imageLoaded(evt,index);
trace( event.target.loader.name );
event.target.removeEventListener(Event.COMPLETE, completeHandler );
}
In debug model, you can load files from any avaliable site, but release model.
may be this help : http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html