Hi Friend,
Are u developed your project in MVC framework?
If yes then use flowing code in your all helper.as file
package ba.core.helper
{
import ba.core.view.MainView;
import ba.event.UserNotify;
import ba.model.User;
import flash.display.DisplayObject;
import mx.core.Application;
import mx.core.Container;
import mx.core.IFactory;
public class MainHelper
{
public static const VIEW_FACTORY_NAME:String =
"contentViewClass";
public static const CONTENT_VIEW_NAME:String = "contentView";
public var view:MainView;
public function get currectUser():User
{
return view.userInfo.data as User;
}
public function get contentView():Container
{
return view.getChildByName( CONTENT_VIEW_NAME ) as
Container;
}
public function setupUserInfo(user:User):void
{
view.userInfo.data = user;
}
public function setupContentViews():void
{
var app:Application = Application.application as
Application;
if ( !app.hasOwnProperty( VIEW_FACTORY_NAME ) )
{
return;
}
var contentFactory:IFactory = app[ VIEW_FACTORY_NAME ];
if ( contentFactory == null )
{
return;
}
var content:DisplayObject =
contentFactory.newInstance() as
DisplayObject;
content.name = CONTENT_VIEW_NAME;
view.addChild( content );
}
public function notifyUserLogout():void
{
view.dispatchEvent(UserNotify.Logouted(currectUser));
}
public function removeContentView():void
{
if ( contentView )
{
view.removeChild( contentView );
}
}
public function updateTopicPath( value:Object ):void
{
view.topicPath.dataProvider = value;
}
public function updateContentViewState( value:Object ):void
{
contentView.currentState = value.state;
}
}
}
Thanks
Jewel
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.