Jeff,

I imported the path where my components are (for example import
com.avsa.src.testes.*). Doing this, I could pass the component (form1.mxml)
as a parameter using the ViewHelper:

//****ViewHelper method****

public function LoadComponent(component:Object) : Void{         
        view.mainViewStack.destroyAllChildren();
        view.mainViewStack.createChild(component);
}


//***Change Tree function ****
function fnChangeTree(event){                   
        contentViewHelper.LoadComponent(form1);
}

Doing this, I don't need to have a AS class containing a switch/case to pass
the component as a parameter.

Maybe this could help!!!


-----Mensagem original-----
De: [email protected] [mailto:[EMAIL PROTECTED] Em nome
de Battershall, Jeff
Enviada em: quarta-feira, 20 de abril de 2005 11:52
Para: [email protected]
Assunto: RE: [flexcoders] Re: Flex/Cairngorm architecture


I agree with Romain's solution.

The way I chose to solve this problem was create all my views (forms,
reports, etc) as custom mxml components, and instantiate these using
myViewStack.createChild().  That way the component isn't instantiated until
it is actually requested.  The one gotcha to this approach is that there is
no "eval" of custom component names at runtime (as the component must be
compiled), so if you're passing a component name to your view stack, you
must first get a reference to a compiled component, which I am doing via an
AS class containing a switch/case statement based upon the app name strings
I am passing from the tree component.  Not as elegant as I wanted, but it
does work, and work well. 

There may be a more elegant solution, but this is what I came up with given
my level of knowledge at the time.

With a little bit of work with HistoryManager, you can get the app to flip
through a user's instantiated views using the back/forward button of the
browser.

Jeff Battershall
Application Architect
Dow Jones Indexes
[EMAIL PROTECTED]
(609) 520-5637 (p)
(484) 477-9900 (c)

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of r0main
Sent: Tuesday, April 19, 2005 11:56 PM
To: [email protected]
Subject: [flexcoders] Re: Flex/Cairngorm architecture




Hello,
a simpler solution is to have a viewstack with you 15 views (may be any
container (vbox, hbox, vdividedbox, etc.)), that viewstack standing for
example on the right of your tree. Now when people select a leaf on your
tree, simply change the viewstack index !
(ps: it has nothing to do with Cairngorm, this is a Flex design solution)

Romain


--- In [email protected], "Rafael M. Martinelli"
<[EMAIL PROTECTED]> wrote:
> Hi everybody!!!
>  
> I'm facing a little architecture problem. I'm building an app with
15 forms
> and a lot of reports and charts. I decided to use a Tree as a menu
since I
> have a lot of views. When the user clicks at the Tree I load a mxml 
> file using a Loader component.
>  
> The problem is that the Loader just load mxml file with the
<mx:Application>
> tag or with the </cairngorm:CairngormApplication> tag when using the 
> framework. I think that's not the best way. I would prefer to load a 
> component instead of an application everytime the user request, for
example,
> a form.
>  
> Maybe it's a simple question, but I couldn't solve it.
>  
> Thanks.
>  
>  
> Rafael M. Martinelli
> Gerente de Solu��es Web
> Synex Technologies Co.
> Fone/fax: +(55) 11 3071-3363
> [EMAIL PROTECTED]
> www.synex.com.br <http://www.synex.com.br/>
>  
> 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.9.17 - Release Date: 19/4/2005





 
Yahoo! Groups Links



 






 
Yahoo! Groups Links



 






--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.1 - Release Date: 20/4/2005




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.2 - Release Date: 21/4/2005



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to