0
這裏是一個flex新手。 我已經從sqlite + flex 4.6 +陣列疑惑
測試的回答2'的代碼,但我修改它:扔在一個按鈕,它的目的是填充數據的列表中,被點擊後;結果是成功的,在列表中取回了「[object Object]」而不是數據;如何克服這個問題? Flex是4.6,代碼如下:
<?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"
title="">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:VerticalLayout paddingTop="10" paddingLeft="10"/>
</s:layout>
<fx:Script>
<![CDATA[
import flash.data.SQLConnection;
import flash.data.SQLStatement;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import mx.collections.ArrayCollection;
private function getData():ArrayCollection
{
var stmt:SQLStatement = new SQLStatement();
stmt.sqlConnection = new SQLConnection();
stmt.sqlConnection.open(File.applicationStorageDirectory.resolvePath("assets/test.sqlite"));
stmt.text = "SELECT one, two FROM zero";
stmt.execute();
var result:Array = stmt.getResult().data;
resultArr = new ArrayCollection();
if (result)
{
resultArr.source = result;
}
return resultArr;
}
[Bindable]private var resultArr:ArrayCollection = new ArrayCollection();
protected function button1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
getData();
}
]]>
</fx:Script>
<s:Button label="OK" click="button1_clickHandler(event)"/>
<s:List width="302" height="234" dataProvider="{resultArr}"></s:List>
</s:View>
由於誰想幫我。
沒有概率,如果它是正確的,將其標記爲回答這樣其他人可以信任它:) – Nate
解決了!謝謝!! – shazbat
在有上/下箭頭和數字的答案旁邊,應該有一個區域將其標記爲已接受。 :) – Nate