2
votes

I'm creating an Air Desktop Application. I've compiled an SWF file from FLA, using Flash Player 10, ActionScript 3.0.

I'm now trying to pull the SWF into my desktop application using mxml through FlashDevelop.

However, whenever I run my application, my mxml runs correctly, but the SWF is no imported as I expect; I receive a blank white screen, although the dimensions appear to be correct.

Here is my mxml code which I have changed from the default generated by FlashDevelop:

<?xml version="1.0"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> 

    <mx:SWFLoader width="950" height="500" source="..\..\..\bin\Gameseed.swf" /> 

</mx:Application>

Original code (as generated by FlashDevelop):

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/halo">

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>


</s:Application>

I read somewhere that SWFLoader is only intended to be used for minor user interaction and animations; my SWF is just a background image with a button, so I'm not sure if this would be an issue in future when I begin adding more movie clips such as multiple screens...

Thanks

2
Are you sure the source directory is correct for the Gameseed.swf? Where is Gameseed.swf in relation to the main application's install directory? ( Or if you're debugging, the bin-debug directory ). Does it work if you use a full file path? Does it work if you use a file URL like 'file://C:/something/something/bin/Gameseed.swf'?JeffryHouser
My Main.mxml lives under my src folder, and my SWF under bin. I have tried to use absolute path, as well as the file URL, but I get the same issue.caubry
You don't want to use a path relative to your source folder; you want to use a path relative to where you compiled output is running from. In Flash Builder; that is the bin-debug folder; I'm not sure how FlashDevelop does it. Most likely you need to do: source="gameseed.swf"JeffryHouser
I've found that my problem was to do with my SWF file. What I have is have a movie clip on my scene that contains multiple layers of further movie clips as I thought I would be able to access them through their instance names. When I remove this nested approach, the compiler seems to be happy. In terms of best practices, should I have a separate SWF for each "page" of my application, or build the entire application in flex? Thank you!caubry
please mark as answered then ;)user1901867

2 Answers

1
votes

You are probably getting a Sandbox Security Violation, use the Flash Player debugger to check the actual error code and message. Some common problems are:

Hope this helps!

0
votes

I've found that my problem was to do with my SWF file. What I have is have a movie clip on my scene that contains multiple layers of further movie clips as I thought I would be able to access them through their instance names. When I remove this nested approach, the compiler seems to be happy. In terms of best practices, should I have a separate SWF for each "page" of my application, or build the entire application in flex? Thanks to @www.Flextras.com and @danii !