PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: landed on October 13, 2009, 07:00:18



Title: stage in flex and the stage mediator
Post by: landed on October 13, 2009, 07:00:18
I'm stuck with trying to get a text field for example in any view class in flex.
here is the thread in some detail but I feel I need to get hold of the distinction between flash and flex and the stage.

I'm used to getting the reftostage passed to the main stage mediator but I'm told I cannot add stuff to the stage in the normal flash way....here is the link

http://www.actionscript.org/forums/showthread.php3?p=932091&posted=1#post932091



Title: Re: stage in flex and the stage mediator
Post by: puremvc on October 13, 2009, 09:32:21
The reference you are getting in Flex when you do facade.startup(this) is the reference to the MXML Application instance. Begin looking at the Flex API docs there. There is rarely a need to fiddle with the stage in Flex (except in AIR). You work primarily with the view hierarchy starting with the Application.

So if the App had a text box with the id "myText" then you could access it from your ApplicationMediator by app.myText.

-=Cliff>


Title: Re: stage in flex and the stage mediator
Post by: landed on October 13, 2009, 10:16:30
Thanks, I'm trying to get flashvars populated into a value object firstly, and was needing the stage to place my views on. So I'm still thinking in the flash line way too much.

I could in theory have all my view components inside the main Application tags but the main issue I have with mxml is that I cannot seem to instantiate with parameters my custom classes. This is why I'm breaking out in pure script very quickly as I'm used to the flash way.

But I see where I have to go now, instead of using the ref to a view component like we pass round in the flash version of the framework we have to pass round the Application instance and use that instead.

Thanks I know enough to start moving onwards again.


Title: Re: stage in flex and the stage mediator
Post by: landed on October 13, 2009, 10:54:04
Here is my flex pure mvc friendly flashVarsVo script

http://www.calvincrane.com/archives/270-Flex-Value-Object-Script.html

place it in your model package.


Title: Re: stage in flex and the stage mediator
Post by: puremvc on October 13, 2009, 11:44:43
Here's the recommended way to handle FlashVars in a PureMVC app: http://forums.puremvc.org/index.php?topic=622.msg2781#msg2781

-=Cliff>