Flash Builder SWFLoader Embed Giving Errors

205 Views Asked by At

I am working on a Flash Mobile project in Flash Builder 4.7. I am getting 4 "Flex Problem" errors when embedding the source of a spark SWFLoader object in the MXML. The errors I get occur in a range of Flex SDKs, from 4.6 to 4.14. For years I have not had a problem doing such an embed, but recently this began to crop up. Similar code works on a coworkers computer, despite everything about our setups seemingly identical. To troubleshoot this error, I created a new Flex Mobile project, with the only code in the MXML being:

<?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">

    <s:SWFLoader source="@Embed(source='Logo.swf')"/>

</s:Application>

The errors I get are:

1084: Syntax error: expecting rightbrace before end of program. line 29
1084: Syntax error: expecting rightbrace before stream. line 25
1084: Syntax error: expecting rightparen before s. line 25
1094: Syntax error: A string literal must be terminated before the line break. line 25

There is no Path given for the errors. My project clearly has no line 25 or 29, so I don't know where this error could even be occurring.

The 'Logo.swf' file is in the right location. It is just a vector graphic with no action script code in it.

EDIT: The source of the problem appears to be the very nature of embedding a SWF, even external to SWFLoader. The below MXML code, with a script embed in place of the SWFLoader embed, gives the same 4 errors as the previous:

<?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">

    <fx:Script>
        <![CDATA[
            [Embed(source="Logo.swf")]
            [Bindable]
            public var swfCls:Class;
        ]]>
    </fx:Script>

</s:Application>
1

There are 1 best solutions below

0
MMPGreg On

While not a complete solution, I found a workaround to the problem. It appears that once a workspace has this bug, it stays there. Any new projects created within it will have this bug.

My solution was to create a new workspace, create a new dummy project with an embedded SWF which DID work, and then import a previous project which had been having the error into this new workspace. Alas, the old program's bug disappeared. Apparently, if the workspace already has a working program in it, anything subsequent should not have the problem.