Flex 4.5.1 runtime ReferenceError: Error #1065: Variable … is not defined

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

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

回答1:

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.)



回答2:

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!



回答3:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!