我将继续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在主xml中声明如下:
[Bindable] public var usePrepAC:ArrayCollection = new ArrayCollection;
有人知道为什么这一行会导致应用程序停滞吗?如果我注释掉这一行,应用程序就会正常加载(加载除了这个AC应该包含的信息之外的所有内容)。我一直在看这个现在大约一个小时,尝试不同的方法来获得tempDPrepsAC的内容到usePrepAC -但没有工作。我试着谷歌一下,但是什么也没找到:(
谢谢,惟妙惟肖
编辑
dprep AC在主xml中声明如下:
[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();
}
这个函数由This调用:
<mx:HTTPService id="dprepHttp" url="{dprepXML}" resultFormat="e4x" makeObjectsBindable="true" result="createDirectorsPrepCollection(event)" />
dPrepAC正在填充。我在每个循环中检查它
尝试使用以下代码:
usePrepAC.source = tempDPrepsAC.source;