4ucai
|
|
« on: November 02, 2011, 08:16:37 » |
|
Hi, im still learning how to get around the PureMVC framework. Im a bit confused as to how i should load external swf(basically they are movieclips which contains buttons, sprites, etc.). I separated my single project(all movieclips,etc. in 1 big .fla file) into modules(e.g. editTools,commonTools). I did these things so far.. 1. In my applicationfacade
override protected function initializeController():void { super.initializeController(); //starting the application registerCommand(STARTUP, StartupCommand); }
2.In on StartupCommand.as
public class StartupCommand extends SimpleCommand implements ICommand { // Register the Proxies and Mediators override public function execute(note:INotification):void { // Create and register proxy facade.registerProxy(new CanvasProxy()); //the stage here should add all the viewcomponent var stage:Stage = note.getBody() as Stage; //how can i get reference to the external swf //and add it on stage and pass reference to the mediator //stage.addChild(theswf); //facade.registerMediator(new EditToolMediator(theswf)); } }
Btw, i have a ToolbarProxy which i think should handle the loading of swf
public class ToolbarProxy extends Proxy implements IProxy { //Cannonical name of the Proxy public static const NAME:String = 'ToolbarProxy'; public function ToolbarProxy() { super(NAME, new ToolbarVO()); //pass the cannonical name to the superclass } public function loadToolbar():void { var request:URLRequest = new URLRequest(); var loader:URLLoader = new URLLoader(); request.url = vo.dataURL; loader.addEventListener( Event.COMPLETE, handleLoadingToolbarComplete ); loader.load( request ); } private function handleLoadingToolbarComplete(e:Event):void { vo.Toolbar_mc = e.target; sendNotification( PureMvcConstants.TOOLBAR_LOADED, vo.Toolbar_mc ); } public function get vo():ToolbarVO { return data as ToolbarVO; }
And the ToolbarVO
public class ToolbarVO { public function ToolbarVO() { public var dataURL:String = 'toolbar.swf'; public var Toolbar_mc:MovieClip = new MovieClip(); } }
More Power & Best Regards
|