我已經實現了代碼,在這裏我將複選框放在DataGrid中。問題是,當複選框被選中並向下滾動時,其他複選框也會被檢查,而我沒有檢查它們。如果我再次滾動,複選框,我最初檢查,不再檢查。請有人能幫助我嗎?DataGrid中的複選框在actionscript 3中向下滾動後被選中。
這裏是代碼:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
initialize="main()" textAlign="right" textRotation="rotate270" title="HomeView">
<fx:Script>
<![CDATA[
import mx.collections.ArrayList;
import mx.graphics.SolidColorStroke;
import spark.primitives.Rect;
import spark.skins.spark.DefaultComplexItemRenderer;
import spark.skins.spark.DefaultItemRenderer;
private var bL:ArrayList;
public function main():void{
hey.dataProvider=dataprovider;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayList id="dataprovider">
<fx:Object actName="myact1" actnumber="2" name="1"/>
<fx:Object actName="myact2" actnumber="55" name="2"/>
<fx:Object actName="myact1" actnumber="2" name="3"/>
<fx:Object actName="myact2" actnumber="55" name="4"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
<fx:Object actName="myact1" actnumber="2" name="1"/>
<fx:Object actName="myact2" actnumber="55" name="2"/>
<fx:Object actName="myact1" actnumber="2" name="3"/>
<fx:Object actName="myact2" actnumber="55" name="4"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
<fx:Object actName="myact1" actnumber="2" name="1"/>
<fx:Object actName="myact2" actnumber="55" name="2"/>
<fx:Object actName="myact1" actnumber="2" name="3"/>
<fx:Object actName="myact2" actnumber="55" name="4"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
<fx:Object actName="myact1" actnumber="2"/>
<fx:Object actName="myact2" actnumber="55"/>
</s:ArrayList>
</fx:Declarations>
<s:DataGrid id="hey" x="-2" y="-1" width="323" height="415">
<s:columns>
<s:ArrayList>
<s:GridColumn id="my" dataField="wierd">
</s:GridColumn>
<s:GridColumn id="hi" dataField="checkboxes">
<s:itemRenderer>
<fx:Component>
<s:GridItemRenderer>
<fx:Script>
<![CDATA[
protected function checkbox1_clickHandler(event:MouseEvent):void
{
trace("clicked");
}
]]>
</fx:Script>
<s:CheckBox click="checkbox1_clickHandler(event)">
</s:CheckBox>
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
</s:View>