|
Flash only «Modules with PureMVC pipes» demo
Created : mercredi 25 décembre 2002
Last modified : dimanche 7 février 2010 15:53:34 Flash only «Modules with PureMVC pipes» demo![]() In a first article I posted an example of a PureMVC multicore application for ActionScript 3 with Pipes and Modules using Flex SDK. Some people here and in the PureMVC forums asked for examples of multicore apps done with Flash only (pure ActionScript projects without Flex SDK at least). This is why, I created a new version on my Flex app that uses Flash components instead of the Flex SDK to be able to compile it with a Flash IDE only. If you compare the Flex and Flash app, you will see that the PureMVC parts are near the same in the two apps. This is the PureMVC magic. Only views converted from Flex to Flash need to be different, business logic, pipes and model stay the same.
To convert the Flex app to Flash, I had to use PureMVC multicore and PureMVC pipes libraries sources instead of the SWC files. As you may know Flash CS3 is not able to use external SWC files (Flash CS4 can do it). It's why you will see this two source folders in the project sources. I also have to replace Flex components by Flash components. The only embarrassing change was I have to replace ArrayCollection by DataProvider to feed the DataGrids. But their interfaces are near the same, I only have to change their type declaration. I also have replaced Flex ModuleManager by UILoader and the conversion part was done. The project can now be compiled by a Flash IDE. But I modified it a little to compile it seamlessly from Flex Builder too. This required me to use some hooks I would have preferred not to use, but now we have support for the Flex Builder debugger, profiler and generate a ViewSource. Finally this part was the hardest one. So, at least you'll find some useful tricks to seamlessly compile a Flash application from Flex Builder and Flash IDE. You can launch the live demo, download or browse the sources. Update (10.17.2009)
v1.2 - Applied some refactoring to handle generic modules instead of specialized HelloModule. The project now use an IModule interface instead of the previous IHelloModule. The HelloModuleMediator, LoadHelloModuleCommand, UnloadHelloModuleCommand of the shell are respectively named ModuleMediator, LoadModuleCommand, UnloadModuleCommand. v1.1 - I have updated the project to add a ModuleLoaderMediator in the Shell to better handle HelloModules loading and unloading. The current version is now PureMVC_FlashModulesAndPipes_v1.2 CommentsVery useful example for all non-Flex projects. Thank you! [...] Just want to share some of the links i learned from: pureMVC Multicore pipes: Jens Krause’s Blog WS-Blog » A basic PureMVC MultiCore AS3 example using Pipes Utility and Modules. Frédéric Saunier’s Blog Flash only «Modules with PureMVC pipes» demo [...] Hey, thank you for the information! Is there an actual article on your Flex version of your “pipes” demo? Or can I download the source to study it? Again, thank you very much for your contribution! Hi SideDoor, you can find the article on the Flex version of the PureMVC “pipes” demo there : http://www.tekool.net/blog/2009/06/14/puremvc_flex_modules_and_pipes/ This’s exactly what I’m looking for. Thank you, sir. Hey Tek, I’ve returned to look over your code for this demo as I embark on another pureMVC Actionscript 3 project (Flash only)… My question to you is about application architecture: In the source for your project posted here, you have the Shell.as Class located in the shell.view.components package. I’m finding this confusing: I thought that in a Multicore application, the Shell was synonymous with the Document Class, is it not? Why wouldn’t the Shell exist at the top level of the application? Is it not technically the daddy of all Document Classes? Thanks, sd Hi SideDoor, the real document class for the demo is here the PureMVC_FlashModulesAndPipes class. The Shell class is only the view component that instantiate the Shell “module”. The HelloModule follow the same convention. Its base view component class is located in the “view.components” package. But you can do as you want to. Here the modules were compiled from the same application as I want the application to be compiled from Flex Builder. But in real life you will often have a different application folder for each module. So if you prefer to, in this case just put the document class in the default package, I don’t think this matters. Now, I will wait for the CS5 suite to be there (only a week left). As Flash CS5 can now supports .SWC files, I will try to rewrite this demo to be Flash only to get rid of the Flex Builder structure it has. I only hope to be able to generate the “Browse Source Meu” from Flash CS5. Thank you so much for your time! Leave a comment |
||
| wordpress rss rss français rss english xhtml 1.1 css 2.0 wdg |
Thanks a lot! I’m trying to get deeper into the puremvc multicore and this example is helpful. The only thing I can’t find on the web is some real life application example using multicore and pipes.