Flex 4 ~ get top level Application

在Flex 3的時候如果要取得原本Application的物件

Application.application;

設定id叫OfferEndLabel的元件隱藏

Application.application.OfferEndLabel.visible = false;



可是在Flex 4 的寫法是這樣~

FlexGlobals.topLevelApplication;


import mx.core.FlexGlobals;
//call changeForm
FlexGlobals.topLevelApplication.changeForm('register');


reference
http://www.unitedmindset.com/jonbcampos/2009/06/06/migrating-from-flex-3-to-flash-builder-4-mxcoreapplication/

沒有留言: