Well Pankaj,

If you want to do this as modules, here is a piece of code to load modules:

var info:IModuleInfo = ModuleManager.getModule(modulePath);
info.addEventListener(ModuleEvent.ERROR, errorLoadModuleHandler);
info.addEventListener(ModuleEvent.READY, displayModule);
info.load();

Then in displayModule I have:

var module:TitleWindow = event.module.factory.create() as TitleWindow;

In my specific case this works fine because every module that I have is a
TitleWindow. Here how I make this:

[Frame(factoryClass="mx.core.FlexModuleFactory")]
public class MyCustomModuleBase extends TitleWindow

This metatag "Frame" with this factoryClass is making my class available to
manipulate like a module, in my specific case that was VERY helpful that all
my modules were subclasses of TitleWindow, it helped me a lot.

But you can simply make your class subclass of Module that the way to
load/unload it will work fine too.

If you have some doubts you can search in the list too.

Hope this helps,

PS

On Tue, Sep 2, 2008 at 5:35 PM, Derrick Anderson <
[EMAIL PROTECTED]> wrote:

>   I agree with Nate and Tracy, that doesn't sound like a good use for
> modules.  Everything you mention can be done very easily in 1 swf.
>
> Consider your 'pages' as 'views' instead, I know this sounds nitpicky but
> the sooner I got away from the 'page refresh' mentality the sooner the rest
> made sense.  use a viewstack to hold the different forms (or states to
> hide/show them).
>
> Unless you have many very large forms to fill out I'd stay away from
> modules.
>
> Another thing that helped me learn is the docs
>
> http://livedocs.adobe.com/flex/3/html/
>
> read the first couple chapters, and you'll know how to handle this.
>
> D.
>
>
> On Tue, Sep 2, 2008 at 4:18 PM, Pankaj Arora <[EMAIL PROTECTED]> wrote:
>
>>    The example I gave you is what I wish to achieve. I am not sure how to
>> handle this in single application. I am new to flex.
>>
>> Business reason:
>>
>> I have one page where I have one form. User fills this information and
>> press one button (button1). He is taken to another page (Page1) where he
>> fills another form. Some information from first page is used in the next
>> page- Page 1. If user had pressed button2 then he would have been taken to
>> page2. All the pages currently are separate applications. As suggested by
>> you guys I am trying to make modules out of it and then load/unload modules
>> as the button is clicked. Problem is that the pages are not part of main
>> application so I made main application as module too and loaded it as
>> default. Now on clicking button 1 I want to unload main module and load
>> another module which is another page.
>>
>>
>>
>> Thanks,
>>
>> Pankaj Arora
>>
>>
>>  ------------------------------
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Nate Beck
>> *Sent:* Tuesday, September 02, 2008 12:41 PM
>>
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* Re: [flexcoders] Using view stack to link to mxml
>>
>>
>>
>> I agree.. I'm trying to understand exactly why you need separate swfs.
>> What you're trying to achieve, as far as I can tell, sounds like it can all
>> be handled in one single application.
>>
>> Cheers,
>> Nate
>>
>> On Tue, Sep 2, 2008 at 12:50 PM, Tracy Spratt <[EMAIL PROTECTED]>
>> wrote:
>>
>> Do you have a compelling business reason to avoid a straight-forward
>> component architecture?
>>
>>
>>
>> Such reasons exist, but be sure you have not missed the best solution by
>> jumping to a more complex one.
>>
>>
>>
>> Tracy
>>
>>
>>  ------------------------------
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Pankaj Arora
>> *Sent:* Tuesday, September 02, 2008 3:05 PM
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* RE: [flexcoders] Using view stack to link to mxml
>>
>>
>>
>> Yes I do have control and can make all of them modules.
>>
>> But I am not able to understand how to load/unload various modules.
>>
>>
>>
>> To put it in perspective: My main application has a button which when
>> pressed takes me to another application which has another button which
>> pressed takes me to 3rd application.
>>
>> If I make all of them modules and load the main application and on
>> pressing the button I should be able to load the second swf file and unload
>> the main application. And so forth..
>>
>>
>>
>> Can you please give some examples to how to do this? I am attaching my 2
>> application which I attached before and my requirement is when I add text on
>> the text box in Hello1.mxml and click the "click me" button Hello2.mxml is
>> shown and the text box in Hello2 contains the text from the Hello1.mxml text
>> box. I don't need Hello1 to be shown so I guess I need to unload it. I am
>> not sure.
>>
>>
>>
>> Thanks,
>>
>> Pankaj Arora
>>
>>
>>  ------------------------------
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Pedro Sena
>> *Sent:* Saturday, August 30, 2008 3:17 PM
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* Re: [flexcoders] Using view stack to link to mxml
>>
>>
>>
>> Pankaj,
>>
>> Do you have control (can alter the source) of all those swfs? I would
>> recomend you to manipulate those swf files as flex modules instead of put
>> all of them in yout html. That way you can easily send/receive data between
>> them AND have the advantage to load them just when you need it, what does
>> not happens when you put all together in your html file.
>>
>> Hope this helps
>>
>> On Fri, Aug 29, 2008 at 8:29 PM, Pankaj Arora <[EMAIL PROTECTED]>
>> wrote:
>>
>> Yes they are completely different swf files( there are 4 of them in
>> total). One of them is main.swf which has few text boxes and buttons. On
>> clicking button 1 hello2. swf is loaded and it access all the information
>> from main.swf and similarly on clicking button2 another swf file hello2.swf
>> is loadead and so forth.
>>
>>
>>  ------------------------------
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Nate Beck
>> *Sent:* Friday, August 29, 2008 3:58 PM
>>
>>
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* Re: [flexcoders] Using view stack to link to mxml
>>
>>
>>
>> Okay, so just to clarify. You're wanting to communicate from one
>> application to another application?  They are completely different swf
>> files?
>>
>>
>>
>> Like this?
>>
>>
>>
>> Example HTML page:
>>
>> <html>
>>
>> <head><title>Testing Flex</title></head>
>>
>> <body>
>>
>>             <object id="Hello1" width="300" height="200">
>>
>>                                     <param name="movie" value="Hello1.swf"
>> />
>>
>>                                     <param name="allowScriptAccess"
>> value="sameDomain" />
>>
>>                                     <embed src="Hello1.swf"
>>
>>                                                 width="300" height="200"
>> name="Hello1"
>>
>>
>> allowScriptAccess="sameDomain"
>>
>>
>> type="application/x-shockwave-flash">
>>
>>                                     </embed>
>>
>>             </object>
>>
>>
>>
>>             <object id="Hello2" width="300" height="200">
>>
>>                                     <param name="movie" value="Hello2.swf"
>> />
>>
>>                                     <param name="allowScriptAccess"
>> value="sameDomain" />
>>
>>                                     <embed src="Hello2.swf"
>>
>>                                                 width="300" height="200"
>> name="Hello2"
>>
>>
>> allowScriptAccess="sameDomain"
>>
>>
>> type="application/x-shockwave-flash">
>>
>>                                     </embed>
>>
>>             </object>
>>
>> </body>
>>
>> </html>
>>
>>
>>
>> On Fri, Aug 29, 2008 at 3:43 PM, Pankaj Arora <[EMAIL PROTECTED]>
>> wrote:
>>
>> I am sorry I dint explain it well. Let me give you one example.
>>
>>
>>
>> Two files attached are 2 mxml applications I have in my project. I load
>> each independently in an .xhtml file.
>>
>>
>>
>> My requirement is when I add text on the text box in Hello1.mxml and click
>> the "click me" button Hello2.mxml is shown and the text box in Hello2
>> contains the text from the Hello1.mxml text box.
>>
>>
>>
>>
>>
>> Do tell me if you need any more information.
>>
>>
>>
>> Thanks,
>>
>> Pankaj Arora
>>  ------------------------------
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *Nate Beck
>> *Sent:* Friday, August 29, 2008 3:15 PM
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* Re: [flexcoders] Using view stack to link to mxml
>>
>>
>>
>> I'm a bit confused on how you mean "load another application".  You could
>> either load a Component (compiled into your swf) or a Module
>> (compiled separate from your application).
>>
>>
>>
>> From how I read it, this sounds like you're trying to load one MXML swf
>> inside of another application. One of the easiest ways to do this would be
>> through using Flex Modules (mx:Module).
>>
>>
>>
>> More information would we useful.
>>
>>
>>
>> Cheers,
>>
>> Nate
>>
>>
>>
>> On Fri, Aug 29, 2008 at 2:10 PM, pankajarora_in <[EMAIL PROTECTED]>
>> wrote:
>>
>> I have a appplication abc.mxml
>> and there are 2 buttons but1 and but2 in it.
>> WHen I press but1 I need to call to anothe application 1.mxml
>> and when I press button 2 I need to call 3rd application 3.xml. Note
>> that pressing any button pass on data from abc.mxml to 1.mxml and
>> 2.mxml. Any ideas how it can be done. I think viewstack can be one way
>> but any examples will be appreciated.
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> /**
>> * Pedro Sena
>> * Systems Architect
>> * Sun Certified Java Programmer
>> * Sun Certified Web Component Developer
>> *
>> * Net Sar
>> * www.netsar.com.br
>> */
>>
>>
>>
>>
>  
>



-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*
* Net Sar
* www.netsar.com.br
*/

Reply via email to