External swf loaded into Adobe Air does not get displayed properly

I have an application whose front end is written in flex. The code is compiled into swf and run in browser by accessing localhost:8080/aps. (loads html, which runs the swf).

When I load it in browser, it looks like this …

But when I load it from using
var ldr:Loader = new Loader();
var url:String = “http://localhost:8080/aps/Shell.swf”;
var urlReq:URLRequest = new URLRequest(url);
it looks like

And I have been wondering why is that the case ?

It seems a customer with a commercial application developed in Flex
hired someone (you? your team?) to port it to AIR

because this is commercial and so paid work you and/or your team should then do your job
I see no incentive to be the free help/support of such thing

and yeah I know how it sound boohhooo zwetan is not nice and rude and harsh etc.
but man … if you accept such job you should know what you’re doing

it’s all here in the doc

so because you are supposed to be a professional, RTFM
loading a SWF in AIR is like lesson 101

Don’t bother that bully @aditya_zagade simply what you need is to follow this tutorial and you will be good and dendy.

Hi @zwetan, yes I happened to work in a company that has a legacy application in Flex. I was tasked to convert it to AIR application.

I followed your article which said how one can achieve that. I also read throught a lot of resouces provided by Adobe as well:
http: // help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d9e.html
http: // AIR, HTML and SWF

After a while, I got everything to work fine by using HTMLLoader to load the ( as mentioned in one of your posts) , but what I didn’t realise is that the HTMLLoader needs Flash Plugin internally.
Due to security constraints, I cannot use ADOBE AIR 21 or lesser version (which has flash plugin internally). And flash plugin is coming to End of life in Dec 2020. So my only option was to use components like SWFLoader, Loader to load external swf file.

What I am seeing is that when I use SWFLoader, Loader, the external swf loads but the components are not rendered on the screen properly. I also observed that in the external swf file, if the width and height were set in pixels, like width=“1200” height=“800”, then it renders properly.

e.g. External swf file entry mxml.
<s:Application namespaces … width=“100%” height=“100%” creationComplete=“Created()” resize=“Resized()” addedToStage=“Added(event)” >


So I wonder why does external swf does not take the entire space ? How can it be forced to take entire space ? When I use standalone flash player, the same external swf loads perfecly fine. So how does external swf take entire space when loaded in stand alone flash player.

PLEASE help me. I shall also commit to solving problems others face when i post it here.

I had also posted a question on stack overflow : https://stackoverflow.com/questions/62692869/external-swf-loaded-does-not-render-properly

And tried all the suggestions but none worked for me. I am asking for help after trying a lot of things.

Which version of Flex are you using? I recommend the latest version from https://flex.apache.org/.

What I can offer as a solution is to either calculate the width and height of the component after it is creationComplete triggered or better simply put this in :

width=“{parent.width}” height=“{parent.height}”

or something like this:

function onCreationComplete(e:Event):void{
this.width = parent.width;
this.height = parent.height;

this it doesn’t work try


and so on until you get out of the scope of the loaderInfo
Here more info about it : https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/LoaderInfo.html#includeExamplesSummary

Maybe that could fix it

Setting the width and height just makes the content of external swf go disappear !

Using Flex 4.6.

I also created a dummy application just to reproduce the same problem.

Then zip your dummy project and put it here I can check.
You can upload files in your messages.

I recommend using Apache Flex which might give many fixes to bugs in 4.6.

As a new user, I cannot attach zip or any attachments.
So I uploaded to my drive and sharing the link…


PS: appreciate the help.

I think I know what is the problem of your whole rendering issue but I need you to send the dummy apps.

I need the source code not the compiled files please.
Put the whole dummy folder in a zip.

Okay, give me 2 minutes


I also posted the dummy code at

I meant the whole FlashBuilder project man why you give me single files?

Anyway ok I will loose some time making a project myself.

Here is the solution: dumdum.zip (2.3 MB)

You need to use the ModuleLoader instead and convert your shell into a Module.
That class was implemented specially only for you so you don’t have to worry.

@duanga.yanga, let me check this out… So there is no way to do this without changing the Shell1.mxml ?

Why I ask you this is because, when I load the Shell1.swf file directly into the Standalone flash player OR run it as an air app, it works perfectly fine. Only when its loaded from Main.swf it causes trouble.

Thanks in advance. Im checking your solution.

You will see that changing your shell is nothing more than replacing <s:Application> by <s:Module> nothing more. And also you need to change your main Applicatioin from <s:Application> to <s:WindowedApplication> because you can only have one in Adobe AIR Desktop mode.