【发布时间】:2011-10-28 10:21:15
【问题描述】:
编辑 3: 好的,我正在启动 Windows Server 2008 R2 虚拟机,安装 Flex Builder 3,并查看是否可以获得一个新项目来正确编译和执行。 新闻!我在 VM 中启动并运行了 IDE,但在代码编译没有问题后,我仍然得到了完全相同的错误!这是一个大而有力的你的开球效果加倍。
编辑 2: 由于这是一篇相当长的帖子,我将把它放在这里。我刚刚检查并分别删除了两个问题行的每个部分,并尝试在每个部分之后进行编译,但每次都出现错误。我什至从两个DataGridColumns 中删除了所有内容,它仍然没有编译,即使注释掉两个空的<mx:DataGridColumn /> 行会让程序加载!这让我发疯了,谁能帮我解释一下?
/Edit 2
我有一个 AIR 应用程序,当我按下 F5 时,它显然可以正常编译,但在应用程序有机会加载之前,我收到以下错误:
通过注释掉代码块,我将问题缩小到两个特定的行。
<mx:DataGrid id="grid1" width="100%" height="100%" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Symbol" dataField="Symbol" headerWordWrap="true" width="100" textAlign="left"/>
<mx:DataGridColumn headerText="Description" dataField="FullName" headerWordWrap="true" width="150" textAlign="left"/>
<mx:DataGridColumn headerText="Trans" dataField="TransactionCode" headerWordWrap="true" width="75" textAlign="center"/>
<mx:DataGridColumn headerText="Quantity" dataField="Quantity" headerWordWrap="true" width="50" textAlign="right" labelFunction="formatUtil3"/>
<mx:DataGridColumn headerText="Execution Date" dataField="ExecutionDate" headerWordWrap="true" width="80" textAlign="center"/>
<mx:DataGridColumn headerText="Execution Price" dataField="ExecutionPrice" headerWordWrap="true" width="65" textAlign="right" labelFunction="formatUtil1"/>
<mx:DataGridColumn width="15" backgroundColor="0x888888" dataField="blank1" headerText=""/>
<mx:DataGridColumn headerText="Previous Business Day" dataField="PreviousDate" headerWordWrap="true" width="80" textAlign="center" itemRenderer="PD5"/>
<!----> <mx:DataGridColumn headerText="Previous Business Day Price" dataField="PreviousDatePrice" headerWordWrap="true" width="65" textAlign="right" labelFunction="formatUtil1" itemRenderer="PD5"/>
<!----> <mx:DataGridColumn headerText="% Difference" dataField="PreviousDateDelta" headerWordWrap="true" width="65" textAlign="right" labelFunction="formatUtil2" itemRenderer="PD5"/>
<mx:DataGridColumn headerText="Source" dataField="PreviousDateSource" headerWordWrap="true" width="100" textAlign="left" itemRenderer="PD5"/>
<mx:DataGridColumn width="15" backgroundColor="0x888888" dataField="blank2" headerText=""/>
<mx:DataGridColumn headerText="Previous Month End" dataField="PrevMonthEndDate" headerWordWrap="true" width="80" textAlign="center" itemRenderer="PME5"/>
<mx:DataGridColumn headerText="Previous Month End Price" dataField="PrevMonthEndPrice" headerWordWrap="true" width="65" textAlign="right" labelFunction="formatUtil1" itemRenderer="PME5"/>
<mx:DataGridColumn headerText="% Difference" dataField="PrevMonthEndDelta" headerWordWrap="true" width="65" textAlign="right" labelFunction="formatUtil2" itemRenderer="PME5"/>
<mx:DataGridColumn headerText="Source" dataField="PrevMonthEndSource" headerWordWrap="true" width="100" textAlign="left" itemRenderer="PME5"/>
</mx:columns>
</mx:DataGrid>
这两行标有<!---->。如果我将这两行注释掉,那么应用程序将正确编译、运行和显示,但如果我让其中任何一个处于活动状态,我就会收到上述错误。
这是怎么回事?
编辑:根据要求添加代码 -
<mx:CurrencyFormatter id="format1" precision="5" useNegativeSign="false"/>
<mx:NumberFormatter id="format2" precision="2"/>
还有功能-
private function formatUtil1(item:Object, column:DataGridColumn):String
{
var Field:Object = item[column.dataField];
return format1.format(Field);
}
private function formatUtil2(item:Object, column:DataGridColumn):String
{
var Field:Object = item[column.dataField];
return format2.format(Field);
}
接下来是 PD5 的 .as 文件 -
package
{
import mx.controls.Label;
import mx.controls.listClasses.*;
public class PD5 extends Label
{
private const POSITIVE_COLOR:uint = 0x000000; // Black
private const NEGATIVE_COLOR:uint = 0xFF0000; // Red
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
setStyle("color", (data.PreviousDateDelta >= 5 || data.PreviousDateDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);
}
}
}
现在是 PME5.as -
package
{
import mx.controls.Label;
import mx.controls.listClasses.*;
public class PME5 extends Label
{
private const POSITIVE_COLOR:uint = 0x000000; // Black
private const NEGATIVE_COLOR:uint = 0xFF0000; // Red
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
setStyle("color", (data.PrevMonthEndDelta >= 5 || data.PrevMonthEndDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);
}
}
}
【问题讨论】:
-
取出labelFunctions,看看你是否编译我感觉未定义的引用在那些函数中。
-
@The_asMan - 刚刚做了,不是
labelFunctions。此外,它们在故障线下方的两行中工作。 -
是的,我没有看到后面的那些。这很奇怪。我唯一看到的是使用 labelfunc formatUtil 和 formatUtil2 工作的线路上的渲染器将渲染器从 PD5 更改为 PME5,看看会发生什么
-
@The_asMan - 从每一行中删除
itemRenderer="PD5"也无济于事。 -
你能把 PME5、PD5、formatUtil1 和 formatUtil2 贴出来吗
标签: actionscript-3 apache-flex flex3