2011年11月21日 星期一

passing variable to gaia page

passing variable to gaia page

using deeplink

Gaia.api.goto(Pages.YOUR_PAGE + "/variable);

function transitionIn():void
{
    var type:String = Gaia.api.getDeeplink().substr(Gaia.api.getDeeplink().lastIndexOf("/") + 1);
    handleDeeplink(type);
}
function handleDeeplink(__arg:String):void
{
    // do something...
}


或者用 override 的方式,不過要注意當頁面尚未完全載入時的狀況。
override public function onDeeplink(event:GaiaSWFAddressEvent):void
{
    handleDeeplink(event.deeplink.substr(event.deeplink.lastIndexOf("/") + 1));
}

Note: Sometimes, there will be a deeplink but your page won't be loaded and
ready to receive it before the event fires.

沒有留言:

張貼留言