【发布时间】:2012-03-30 19:10:02
【问题描述】:
我使用 Inkscape 和 fxg 插件制作了一个 fxg 文件。它被称为 BugattiVeyron.fxg
我还使用 flex sdk 4.6 和 FlashDevelop 4 创建了 AS3 项目,并使用这样的导入语句导入此文件
import BugattiVeyron;
并像这样实例化它
private var bugatti:BugattiVeyron = new BugattiVeyron ();
使用 FD4 中的构建按钮不会出现任何错误,但是当我运行它时,我会收到此错误,尽管当我消除所有错误时,文件已很好地导入并且我可以向其中添加事件。
错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::updateCallbacks()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7345]
at mx.core::UIComponent/set nestLevel()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:4189]
at spark.core::SpriteVisualElement/http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\4.y\frameworks\projects\spark\src\spark\core\SpriteVisualElement.as:2247]
at spark.core::SpriteVisualElement/addChild()[E:\dev\4.y\frameworks\projects\spark\src\spark\core\SpriteVisualElement.as:2211]
at resources::BugattiVeyron_Text_2126220941/createText()
at resources::BugattiVeyron_Text_2126220941()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at mx.core::FlexSprite()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\FlexSprite.as:61]
at spark.core::SpriteVisualElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\core\SpriteVisualElement.as:88]
at resources::BugattiVeyron()[resources\BugattiVeyron-generated.as:10]
所以我收到此错误,但在我消除错误后导入了文件。
可能是什么问题,有什么想法吗?
【问题讨论】:
-
1) 请贴出代码 2) 在调用 createText() 方法时检查 BugattiVeyron_Text 实例是否为空!
-
我将 svg 中的所有文本都创建为矢量路径,为什么我仍然会收到有关文本的错误?
-
可能是 fxg 本身已损坏?也许 Inkscape 插件不能很好地导出。你怎么看?
-
也许您需要将您的 FXG 资产键入为 SpriteVisualElement。所以你可以这样声明:
private var bugatti:SpriteVisualElement = new BugattiVeyron ();
标签: actionscript-3 apache-flex flex4.5 inkscape fxg