PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: Tipz on March 20, 2009, 03:48:49



Title: Multicore example please
Post by: Tipz on March 20, 2009, 03:48:49
Hi I have been trying to get my head around using mulitcore and flash as3. The more I read, the more I seem to get confused :-[. Could anyone please post a simple example using multicore? All the examples around are with flex and I have clue on flex. It would be nice to have a basic usage of multicore + flash or flashdevelop + as3.

Cheers


Title: Re: Multicore example please
Post by: Ondina on March 22, 2009, 01:47:29
When I started with puremvc I collected / bookmarked all the examples/links I found on the forum.

Here are some for Flash:

These are the official puremvc examples

http://trac.puremvc.org/Demo_AS3_Flash_HelloFlash (http://trac.puremvc.org/Demo_AS3_Flash_HelloFlash)
http://trac.puremvc.org/Demo_AS3_Sequential (http://trac.puremvc.org/Demo_AS3_Sequential) ( has a standard and a multicore version)


Then here are links from purmvc members' sites

The Minimalist Example
http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/ (http://www.as3dp.com/2007/12/27/minimalist-mvc-example-using-the-puremvc-framework/)

http://blog.log2e.com/2008/05/17/getting-started-with-the-puremvc-startup-manager-part-2/ (http://blog.log2e.com/2008/05/17/getting-started-with-the-puremvc-startup-manager-part-2/)

Flash CS3 Application Config Example source.
http://www.lfpug.com/puremvc/ (http://www.lfpug.com/puremvc/)

Building a Flash site using PureMVC
http://hubflanger.com/building-a-flash-site-using-puremvc/ (http://hubflanger.com/building-a-flash-site-using-puremvc/comment-page-2/#comment-530)

---
For the multicore version you only have  to adjust a few things:

The imports
replace
import org.puremvc.as3
with
import org.puremvc.as3.multicore

The FlashMain.as
import yourPath.ApplicationFacade;
public static const NAME:String = "FlashMain";
private var facade:ApplicationFacade = ApplicationFacade.getInstance( NAME );
facade.startup(this.stage)

The ApplicationFacade.as
import org.puremvc.as3.multicore.patterns.facade.Facade;
public function ApplicationFacade ( key:String )
{
   super( key );
}
       
public static function getInstance( key:String ) : ApplicationFacade
{
      if ( instanceMap[ key ] == null ) instanceMap[ key ] = new ApplicationFacade( key );
       return instanceMap[ key ] as ApplicationFacade;
}


I work with Flex, so maybe what I said above is not accurate. I didn't test it for Flash.

P.S.
PureMVC-enabling your Flash CS3 Installation:
http://trac.puremvc.org/PureMVC_AS3_MultiCore/wiki/Installation

onRegister comes after initializeNotifier, and is the recommended place to do any preparatory facade access (same for Standard version, though the demos haven't yet been changed). This insures that any 'conversations' that are started only happen once the actor is registered and capable of being retrieved or notified.

-=Cliff>


Title: Re: Multicore example please
Post by: puremvc on March 22, 2009, 06:44:51
Thanks so much for responding to this one Ondina.

-=Cliff>


Title: Re: Multicore example please
Post by: Tipz on March 23, 2009, 02:47:57
Thanks for your reply Ondina, but I have been through all those links, before starting this thread. The Sequential http://trac.puremvc.org/Demo_AS3_Sequential (http://trac.puremvc.org/Demo_AS3_Sequential) is the only example I found for multicore but its a demonstration of AsyncCommand utility. It would be great if someone could post a simple example of multicore and flash.

Thanks again


Title: Re: Multicore example please
Post by: Jason MacDonald on March 23, 2009, 06:20:25
The only difference between the Flex multi-core demos and Flash is how you handle the loading of modules, everything else is the same. Since we don't have classes like Module in Flash, you have to use the loader class to load the module just as you would any external asset. It's really that easy.