3

Ok, I need some help on this one. I upgraded from Flash Builder 4 to Flash Builder 4.5 and have switched my project to the 4.5.1 sdk. I use an ant script to build my project, so I modified it to use the appropriate flexTasks.jar, mxmlc, etc...

Now, if I start out with a blank bin-debug folder, then build and run the app everything works fine. However, if I then make a code change and build (without deleting the bin-debug) then run the app I get a runtime error:

ReferenceError: Error #1065: Variable ... is not defined.
at flash.display::MovieClip/nextFrame()
at mx.managers::SystemManager/deferredNextFrame()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:284]
at mx.managers::SystemManager/preloader_preloaderDocFrameReadyHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2633]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

Again, if I delete the bin-debug folder and compile again it runs with no problems.

The variable it complains about is always a Class variable that points to an image file used as an icon. The code I use to create the var:

[Embed(source="/assets/icons/close-32x32.png")] 
public var closeIcon:Class;

The file exists, and I verified that when it gives that error the file is in the bin-debug/assets/icons folder and the src/assets/icons/ folder.

After the error is thrown, if I hit the continue button in Flash Builder it then throws the same error again on the next Class variable pointing to an image file.

Any ideas? The delete/recompile takes several minutes, so obviously this is driving me mad.

Edit: Ant task that compiles in debug mode:

<target name="compile-debug">
    <echo>Compile MXML</echo>
    <mxmlc 
        file="${SRC_DIR}/${MAIN_SOURCE_FILE}"               
        debug="true"
        optimize="false"
        output="${DEBUG_DIR}/${APP_ROOT_FILE}" 
        append="true"               
        actionscript-file-encoding="UTF-8"              
        keep-generated-actionscript="false"
        link-report="MyReport.xml"
        maxmemory="2048m"
        incremental="true">

        <!-- Get default compiler options. -->
        <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
        <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>

        <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
        <source-path path-element="${FLEX_HOME}/frameworks"/>

        <!-- Include Themes -->
        <!-- NOTE: Spark theme required -->
        <theme dir="${FLEX_HOME}/frameworks/themes/Spark/">
        <include name="spark.css" />
        </theme>
        <theme dir="${FLEX_HOME}/samples/themes/spark_graphite/">
        <include name="spark_graphite.css" />
        </theme>                

        <!-- List of SWC files or directories that contain SWC files. -->
        <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
        <include name="libs" />
        <include name="../bundles/{locale}" />                  
        </compiler.library-path>

        <!-- uncomment if you have external libs (swc files) -->    
        <library-path dir="${LIB_DIR}/riaspace/" append="true">
        <include name="*.swc" />
        </library-path> 
        <library-path dir="${LIB_DIR}/AlivePDF/" append="true">
        <include name="*.swc" />
        </library-path>             
        <library-path dir="${LIB_DIR}/coltware/" append="true">
        <include name="*.swc" />
        </library-path>
    </mxmlc>

</target>

Where FLEX_HOME = < path to flash builder >/sdks/4.5.1

Abram
  • 784
  • 5
  • 11
  • I'd guess there is something w/ the ANT Script you're using, but am not really sure what that could be. – JeffryHouser Aug 22 '11 at 18:21
  • 1
    Embed directive is buggy and compiler-time-wasting, try this approach - http://kachurovskiy.com/2010/storing-icons-in-external-zip-and-seamless-work-with-composite-icons/ – Maxim Kachurovskiy Aug 22 '11 at 18:27
  • @www.Flextras.com - Thanks for the reply. I've edited my question to include my ant build task – Abram Aug 22 '11 at 18:48
  • @Maxim Kachurovskiy - Very interesting approach that I'll have to explore a bit. Was hoping I could get the build to work with embeds as it should though. – Abram Aug 22 '11 at 18:54
  • Are you using a custom preloader? – J_A_X Aug 23 '11 at 00:19
  • @J_A_X, No custom preloader. I should mention this app is an air app (though probably obvious from the ant build script) – Abram Aug 23 '11 at 16:24

3 Answers3

2

The answer is buried in the middle of Maxim's post that he referenced in a comment above:

--> Try turning off incremental compilation.

I had the same issue here with a simple mimeType='application/octet-stream' embed, and when reading Maxim's text this jumped out because I'd recently changed my custom build tools to use inremental compilation: "Embed sometimes fails during incremental compilation"

The result of this failure is that the .swf contains something like this:

<DefineBinaryData id='1' length='1024' />

which looks like it's empty, instead of this (from the working file):

<DefineBitsLossless2 id='1' encoding='base64'>
(.. in my case, 1024 bytes of base64-encoded data)
</DefineBitsLossless2>

(This solved it for me, so a big thank-you to Maxim. I hope it solves it for you too.)

Peter Hansen
  • 21,046
  • 5
  • 50
  • 72
  • could you tell us how you enabled disabled incremental compilation? – frankelot May 13 '16 at 16:15
  • @feresr That's so long ago I've got no memory of it, sorry. I suspect I must have just used this though: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7ed3.html – Peter Hansen May 13 '16 at 22:13
1

I had the same problem, so I "Clean"ed the project and then re ran. It worked.

AabinGunz
  • 12,109
  • 54
  • 146
  • 218
1

I have Flash Builder 4.7 and am using sdk 4.5.1A.

I was using Flash Player debugger version 15 before Christmas of 2014 and everything was working. I had Firefox set up as the default browser. However, in 2015, Adobe has a new player so I upgraded to version 16 and that's when I got the same problem. After much struggle, I found that the problem had to do with the new version of Firefox Flash player debugger. I had to switch the default browser to Internet Explorer and installed the Internet Explorer Flash player debugger. Prior to debugging, I had to clean and update first. Then everything worked again!

Monte Chan
  • 1,193
  • 4
  • 20
  • 42