Flex 4.5.1运行时ReferenceError:错误#1065:变量...未定义 [英] Flex 4.5.1 runtime ReferenceError: Error #1065: Variable ... is not defined
问题描述
现在,如果我开始一个空白的bin-debug文件夹,然后生成并运行应用程序一切工作正常。然而,如果我然后进行代码更改和构建(不删除bin-debug),然后运行应用程序,我得到一个运行时错误:
ReferenceError:错误#1065:变量...未定义。
at flash.display :: MovieClip / nextFrame()
at mx.managers :: SystemManager / deferredNextFrame()[E:\dev\4.5.1\frameworks\projects\framework \src\mx\managers\SystemManager.as:284)
在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()
在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文件夹并重新编译,它将毫无问题地运行。
它抱怨的变量是总是一个类变量的指针ts添加到用作图标的图像文件。我用来创建var的代码:
[Embed(source =/ assets / icons / close-32x32.png )]
public var closeIcon:Class;
这个文件存在,我确认当它给出这个错误时,文件在bin-debug / assets / icons文件夹和src / assets / icons /文件夹。
在抛出错误之后,如果我点击Flash Builder中的继续按钮,错误指向图像文件的下一个类变量。
任何想法?删除/重新编译需要几分钟的时间,所以显然这使我疯狂。
编辑:在调试模式下编译的Ant任务:
< target name =compile-debug>
< echo>编译MXML< / echo>
file =$ {SRC_DIR} / $ {MAIN_SOURCE_FILE}
debug =true
optimize =false
output =$ {DEBUG_DIR} / $ {APP_ROOT_FILE}
append =true
动作文件编码=UTF-8
keep-generated-actionscript =false
link-report =MyReport.xml
maxmemory =2048m
incremental =true>
<! - 获取默认编译器选项。 - >
< load-config filename =$ {FLEX_HOME} /frameworks/flex-config.xml/>
< load-config filename =$ {FLEX_HOME} /frameworks/air-config.xml/>
<! - 构成ActionScript类层次结构根元素的路径元素列表。 - >
< source-path path-element =$ {FLEX_HOME} / frameworks/>
<! - 包含主题 - >
<! - 注意:需要Spark主题 - >
< 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>
<! - 包含SWC文件的SWC文件或目录列表。 - >
< compiler.library-path dir =$ {FLEX_HOME} / frameworksappend =true>
< include name =libs/>
< include name =../ bundles / {locale}/>
< /compiler.library-path>
<! - 如果您有外部库(swc文件)则取消注释 - >
< 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 = <路径到Flash Builder> /sdks/4.5.1
答案埋在,他说:他是一个伟大的人物,他是一个伟大的人物,而不是他的人物。在上面的注释中引用: - >尝试关闭增量编译。 我有同样的问题这里有一个简单的 这个失败的结果是.swf包含这样的内容: 看起来像是空的,而不是(从工作文件): (这个解决了我的问题,所以Maxim非常感谢,希望能解决这个问题。对你也是。) 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: 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: 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: Where FLEX_HOME = < path to flash builder >/sdks/4.5.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 The result of this failure is that the .swf contains something like this: which looks like it's empty, instead of this (from the working file): (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屋!
mimeType ='application / octet-stream'
嵌入,当读Maxim文本时,这个跳出来了,因为我最近改变了我的自定义构建工具来使用inremental编译:在增量编译期间嵌入有时会失败
< DefineBinaryData id ='1'length ='1024'/>
< DefineBitsLossless2 id ='1'encoding ='base64'>
(在我的情况下,1024字节的base64编码数据)
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()
[Embed(source="/assets/icons/close-32x32.png")]
public var closeIcon:Class;
<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>
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"<DefineBinaryData id='1' length='1024' />
<DefineBitsLossless2 id='1' encoding='base64'>
(.. in my case, 1024 bytes of base64-encoded data)
</DefineBitsLossless2>