Flex 4.5.1 运行时 ReferenceError:错误 #1065:变量......未定义 [英] Flex 4.5.1 runtime ReferenceError: Error #1065: Variable ... is not defined
问题描述
好的,我需要一些帮助.我从 Flash Builder 4 升级到 Flash Builder 4.5,并将我的项目切换到 4.5.1 sdk.我使用了一个 ant 脚本来构建我的项目,所以我修改了它以使用适当的 flexTasks.jar、mxmlc 等...
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...
现在,如果我从一个空白的 bin-debug 文件夹开始,然后构建并运行应用程序,一切正常.但是,如果我随后更改代码并构建(不删除 bin-debug)然后运行该应用程序,则会出现运行时错误:
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()
同样,如果我删除 bin-debug 文件夹并再次编译,它运行没有问题.
Again, if I delete the bin-debug folder and compile again it runs with no problems.
它抱怨的变量始终是指向用作图标的图像文件的类变量.我用来创建 var 的代码:
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;
该文件存在,我验证了当它给出该错误时,该文件位于 bin-debug/assets/icons 文件夹和 src/assets/icons/文件夹中.
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.
抛出错误后,如果我点击 Flash Builder 中的继续按钮,它会在下一个指向图像文件的类变量上再次抛出相同的错误.
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.
在调试模式下编译的 Ant 任务:
<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>
其中 FLEX_HOME =
Where FLEX_HOME = < path to flash builder >/sdks/4.5.1
推荐答案
答案被埋在了Maxim 在上面的评论中引用的帖子:
--> 尝试关闭增量编译.
--> Try turning off incremental compilation.
我在这里使用一个简单的 mimeType='application/octet-stream'
嵌入遇到了同样的问题,在阅读 Maxim 的文本时,这个问题突然出现,因为我最近更改了我的自定义构建工具以使用增量编译:在增量编译期间嵌入有时会失败"
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"
此失败的结果是 .swf 包含如下内容:
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>
(这为我解决了这个问题,非常感谢 Maxim.我希望它也为你解决了.)
(This solved it for me, so a big thank-you to Maxim. I hope it solves it for you too.)
这篇关于Flex 4.5.1 运行时 ReferenceError:错误 #1065:变量......未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!