查看过渡故障排除

时间:2011-09-01 13:07:42

标签: flex actionscript-3 sqlite

我正在我的应用的每个视图中从异步数据库加载图像。

我正在使用Pop / PushView中的视图转换来更改视图。

问题:图像在ViewTransition完成后加载,而不是之前加载。

解决方案?

代码:

private function NextView():void
{
selectStmt = new SQLStatement();
selectStmt.sqlConnection = conn;
var sql:String = "SELECT rowid, List, CAST(Image AS ByteArray) AS Image FROM Data 
WHERE rowid = @nextPage" ;
selectStmt.parameters["@nextPage"] = nextPage;   // Id of next record
selectStmt.text = sql;
selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);
selectStmt.execute();

navigator.pushView(NextView, nextPage, null, nextViewTransition);
}

private function selectResult(event:SQLEvent):void
{       
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);

var result:SQLResult = selectStmt.getResult(); 

if (result.data != null) 
{
    resultArray = new ArrayCollection(result.data);
    rowid = result.data[0].rowid;
    listName = result.data[0].List;
    viewImage = result.data[0].Image; 
    pageImage.source = viewImage;
}
}

1 个答案:

答案 0 :(得分:0)

在中从获取图像后,只推动视图