【发布时间】:2011-06-01 15:16:09
【问题描述】:
我正在尝试创建一个自定义组件,该组件在中间显示一个红色矩形,并带有以下 Android 的 Flex 移动项目(在 Flash Builder 4.5 Burrito 中)-
MyComp.mxml(没有错误):
<?xml version="1.0" encoding="utf-8"?>
<components:MobileApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:components="spark.components.*"
firstView="views.MyCompHome">
</components:MobileApplication>
views\MyCompHome.mxml(没有错误):
<?xml version="1.0" encoding="utf-8"?>
<components:View
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:components="spark.components.*"
xmlns:comps="comps.*"
title="My Component">
<comps:MyRect width="100%" height="100%"/>
</components:View>
还有有问题的comps\MyRect.mxml(有1个编译错误):
<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent
xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%" height="100%">
<mx:Script>
<![CDATA[
private var rect:Shape = new Shape();
override protected function createChildren():void {
super.createChildren();
trace('createChildren');
rect.graphics.beginFill(0xFF0000);
rect.graphics.drawRect(0, 0, 20, 20);
addChild(rect);
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
trace('updateDisplayList(' + unscaledWidth + ', ' + unscaledHeight + ')');
rect.x = unscaledWidth / 2;
rect.y = unscaledHeight / 2;
}
]]>
</mx:Script>
</mx:UIComponent>
编译错误是:
Description Resource Path Location Type
Could not resolve <mx:UIComponent> to a component implementation.
MyRect.mxml /MyComp/src/comps line 4 Flex Problem
即使我已将 c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\mx\mx.swc 添加到 Flex 构建路径(通过单击项目属性对话框中的“添加 SWC”按钮)。
【问题讨论】:
标签: apache-flex mobile