在 Flash Professional 中使用 Flex SDK 的问题(对于 as3corelib) [英] Issue Using Flex SDK in Flash Professional (for as3corelib)
问题描述
我最近在寻找将舞台渲染到文件的方法时发现了 Mike Chambers 的 as3corelib.在我的 Flash Professional 中的 ActionScript 3.0 项目中效果很好(如果重要,则为 CS6).
I recently found Mike Chambers' as3corelib when looking for ways to render the stage to a file. Works great in my ActionScript 3.0 project in Flash Professional (CS6 if it matters).
我决定查看 Mike 的一些实用程序类,尤其是与日期相关的类.但是,他的 DateUtil 类导入了 mx.formatters.DateBase,当我尝试使用某些方法时,我得到了很多(很多)未定义属性 DateBase 的访问".
I decided to look at some of Mike's utility classes, notably the date related ones. However, his DateUtil class imports mx.formatters.DateBase, and when I attempt to use some of the methods, I'm getting lots (and lots) of "Access of undefined property DateBase."
我假设这是因为对 Flex SDK 的某些引用丢失或错误.我已将 $(FlexSDK)/frameworks/libs/flex.swc 添加到我项目的库路径中,但这并没有帮助.
I'm assuming that's because some reference to the Flex SDK is missing or wrong. I've added $(FlexSDK)/frameworks/libs/flex.swc to my project's Library path, but that's not helping.
我已经使用 Flash 多年了,但这是我第一个真正以代码为中心的项目,并且仍在通过努力学习的学校学习.不知道这里出了什么问题.想法?
I've used Flash for years, but this is my first truly code-centric project, and still learning through the school of hard knocks. No idea what's going wrong here. Ideas?
来自 as3corelib 的示例
Example from as3corelib
package com.adobe.utils
{
import mx.formatters.DateBase;
/**
* Class that contains static utility methods for manipulating and working
* with Dates.
*/
public class DateUtil
{
/**
* Returns a date string formatted according to RFC822.
*/
public static function toRFC822(d:Date):String
{
var date:Number = d.getUTCDate();
var hours:Number = d.getUTCHours();
var minutes:Number = d.getUTCMinutes();
var seconds:Number = d.getUTCSeconds();
var sb:String = new String();
sb += DateBase.dayNamesShort[d.getUTCDay()];
sb += ", ";
...
行:
sb += DateBase.dayNamesShort[d.getUTCDay()];
... 生成上述错误,类中的任何其他 DateBase 引用也是如此.同样,此代码直接来自 GitHub 上最新的 as3corelib:https://github.com/mikechambers/as3corelib
...generates the mentioned error, as does any other DateBase reference in the class. Again, this code is directly from the latest as3corelib, located on GitHub: https://github.com/mikechambers/as3corelib
推荐答案
不知道你有没有舔过这个,但我碰到了同样的事情.喜欢图书馆,讨厌错误信息.
Don't know whether you got this one licked or not, but I hit the same thing. Love the library, hate the error messages.
我从这里下载了 Flex SDK:
I downloaded the Flex SDK from here:
然后,我将其解压缩到一个临时文件夹中.
Then, I unzipped that into a temporary folder.
然后,因为我不想让整个 flex 框架潜伏在里面,所以我在 .fla 文件所在的目录中创建了一个 ./lib 目录.然后我从这里移动了这些 swcs(在解压缩的文件结构内):
Then, since I didn't want the whole flex framework lurking about, I created a ./lib directory inside the directory where the .fla file lives. I then moved these swcs from here (Inside the unzipped file structure):
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/framework.swc ./lib
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/core.swc ./lib
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/mx/mx.swc ./lib
不确定为什么需要所有三个,但它阻止了编译器的抱怨(并使日期转换正常工作).
Not sure why all three were required, but it stopped the compiler complaining (and got the date conversions working).
您还需要将它们添加到 .fla 的库列表中(在 ActionScript 设置下);但我打赌你已经知道了.
You need to add them to the .fla's library list as well (under ActionScript Settings); but I'm betting you already knew that.
也许有用,也许没有.
这篇关于在 Flash Professional 中使用 Flex SDK 的问题(对于 as3corelib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!