我将继续进行C / P整个功能,以确保你们看到一切正在进行:
public function directorsPrepsToShow():void
{
var tempDPrepsAC:ArrayCollection = new ArrayCollection;
var dprepSD:Date = new Date;
var dprepED:Date = new Date;
var viewSD:Date = rightDate(startViewDate.getMonth(), startViewDate.getDate(), startViewDate.getFullYear());
var viewED:Date = rightDate(viewSD.getMonth(), viewSD.getDate() + 14, viewSD.getFullYear());
var newACIDs:String = new String;
var useACIDs:String = new String;
for each (var item:Object in dPrepAC)
{
dprepSD = textToDate(item[2]);
dprepED = rightDate(dprepSD.getMonth(), Number(dprepSD.getDate() + (item[3] - 1)), dprepSD.getFullYear());
if (dateCollider(dprepSD, dprepED, viewSD, viewED))
tempDPrepsAC.addItem(item as Array);
}
if (tempDPrepsAC.length != usePrepAC.length)
{
usePrepAC = new ArrayCollection();
usePrepAC = tempDPrepsAC;
Alert.show("HI");
}
}
此函数位于一个单独的文件中,该文件通过以下命令从主mxml调用:
<mx:Script source="functions/dprep.as" />
导致应用停止的行是“usePrepAC = tempDPrepAC;”。 usePrepAC在主mxml中声明如下:
[Bindable] public var usePrepAC:ArrayCollection = new ArrayCollection;
任何人都知道为什么这一行会导致应用程序失速?如果我注释掉该行,则应用程序加载正常(加载除此AC应包含的信息之外的所有内容)。我一直在看这个大约一个小时,尝试不同的方法将tempDPrepsAC的内容变为usePrepAC - 但没有任何工作。我试着用Google搜索,但什么也没找到:(
谢谢, BRDS
修改
dprep AC在主mxml中声明如下:
[Bindable] public var dPrepAC:ArrayCollection = new ArrayCollection;
填充它的功能如下:
public function createDirectorsPrepCollection(e:ResultEvent):void
{
var xmlList:XMLList = XML(e.result).directorsprep;
var dupString:String = "|";
var tempArray:Array = new Array;
for (var i:int = 0; i < xmlList.length(); i++)
{
if (dupString.indexOf(String("|" + xmlList[i].name.@id) + "|") == -1)
{
tempArray = new Array;
tempArray[0] = xmlList[i].prepDBID;
tempArray[1] = xmlList[i].projectDBID;
tempArray[2] = xmlList[i].startdate;
tempArray[3] = xmlList[i].numdays;
tempArray[4] = xmlList[i].positions;
dPrepAC.addItem(tempArray);
dupString += "|" + xmlList[i].prepDBID + "|";
}
}
directorsPrepsToShow();
}
此功能由此调用:
<mx:HTTPService id="dprepHttp" url="{dprepXML}" resultFormat="e4x" makeObjectsBindable="true" result="createDirectorsPrepCollection(event)" />
dPrepAC填充精细btw ...我在每个循环中检查它。
答案 0 :(得分:0)
尝试使用以下代码:
usePrepAC.source = tempDPrepsAC.source;