Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1] 2 3
1  PureMVC Manifold / Standard Version / Re: stage in flex and the stage mediator 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.
2  PureMVC Manifold / Standard Version / Re: stage in flex and the stage mediator 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.
3  PureMVC Manifold / Standard Version / stage in flex and the stage mediator 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

4  PureMVC Manifold / Standard Version / Re: difference between flex and flash on: October 08, 2009, 07:04:25
From what I now understand since getting to grips with the seeming best practises and example code it looks like the flash views are created on the satge by the stage mediator all are hidden and managed at this point. Of course by this time the pmvc framework is all up and running.

With flex I see the visual elements all created before we run the startup command as they are children of the Application tag (don't have to be) and we only start the pmvc framework on the application complete.
I am looking at just having the application tag then doing similar to the flash creation method doing the framework first idea, it just makes more sense to me.

BTW examples use creationComplete however in this thread this is why null was comming through
I now use applicationComplete="facade.startup(this); this is no longer null !


;D
5  PureMVC Manifold / Standard Version / Re: null value in flashVars vo causing error on: October 08, 2009, 06:59:04
SOLVED :

FLEX:
:
public function StageMediator(viewComponent:Object)
{
super(NAME, viewComponent);
fv = new FlashVarsVo(app.stage);
key=fv.getVar("key")
init();
}

private function init():void
{
MAPBASE = new UIComponent();
app.addChild(MAPBASE);
m = new MapView()
MAPBASE.addChild(m)
m.width = 100
m.height=100
}


/*
         * @return app the viewComponent cast to CafeTownsend
         */
        protected function get app():Main
        {
            return viewComponent as Main
        }
6  PureMVC Manifold / Standard Version / Re: null value in flashVars vo causing error on: October 07, 2009, 02:50:22
In the cafe townsend example we see that stage doesnt really exist we somehow loose that concept but instead get a ref to the app

:
        /**
         * Cast the viewComponent to its actual type.
         *
         * <P>
         * This is a useful idiom for mediators. The
         * PureMVC Mediator class defines a viewComponent
         * property of type Object. </P>
         *
         * <P>
         * Here, we cast the generic viewComponent to
         * its actual type in a protected mode. This
         * retains encapsulation, while allowing the instance
         * (and subclassed instance) access to a
         * strongly typed reference with a meaningful
         * name.</P>
         *
         * @return app the viewComponent cast to CafeTownsend
         */
        protected function get app():CafeTownsend
        {
            return viewComponent as CafeTownsend
        }

I'm not sure how to really work without a stage so much this is an important point you may have also been struggling with. Again not really a puremvc issue but worth making.
7  PureMVC Manifold / Standard Version / Re: null value in flashVars vo causing error on: October 07, 2009, 02:45:12
the passed in value from the application tag is not the same as it is for regular flash

the passed notification is listed as

Notification Name: startup
Body:Main0
Type:null

at least I have some clues, I just cant seem to get stage from the body "Main0" which apppears to be the Application class itself not the stage, here is where my flex knowledge is a bit flakey
8  PureMVC Manifold / Standard Version / Re: null value in flashVars vo causing error on: October 07, 2009, 02:33:59
There is something funny here - I aint laughing though

:
public function StageMediator(viewComponent:Main)
{
super(NAME, viewComponent);
trace(stage,viewComponent)
}


/**
* Retrieves the viewComponent and casting it to type Stage
*/
public function get stage():Stage
{
    return viewComponent as Stage;
}

viewComponent traces as Main0 and stage is null, which is strange maybe when the casting is tried ?

Is this a flex strangeness,

I have discovered a difference in the way that flex and flash work with pmvc is that a lot of view classes get built before the framework has done its thing. This is going to be an issue. Unless I keep the application tag only in the main entry point and instantiate the mxml later using as.
9  PureMVC Manifold / Standard Version / difference between flex and flash on: October 06, 2009, 03:54:05
I noticed that in flex the view components are created from the main application mxml you can then have components registered to mediators.

In flash the stage component items or views are instantiated from the stage mediator, I'm wondering what this means for me trying to get to grips with flex as a flash guy. If there any specific difficulties conceptually I might face.
10  PureMVC Manifold / Standard Version / Re: null value in flashVars vo causing error on: October 06, 2009, 08:58:48
I hadnt passed in any flash vars yet, so it was null for that reason ! I put in try catch now to stop the error. Not a pmvc thing.
11  PureMVC Manifold / Standard Version / null value in flashVars vo causing error on: October 06, 2009, 08:41:49
I'm running my first flex application via pmvc and am having an issue, namely when I try and access or pass the stage here as im doing the view prep command, exactly following the flex demo skeleton application
:
public class ViewPrepCommand extends SimpleCommand
{
override public function execute( note : INotification ) : void
{
trace("view preparation command "+note.getBody() as Main)
facade.registerMediator( new StageMediator( note.getBody() as Main ) );
//sendNotification(LandedFacade.STAGE_MEDIATOR_CREATED);
}
}

The difference is that my model prep is happening immediately as I havent any code in there yet but still I would have thought that the stage might be ready at this point since the flex application tag has sent through its complete handler.

:
public function StageMediator(viewComponent:Main)
{
super(NAME, viewComponent);
trace("stage mediator ",viewComponent )
fv = new FlashVarsVo(stage); // - something passed in which is null when traced at other end
var twidth:String=fv.getVar("_width") // - causing the error
}


/**
* Retrieves the viewComponent and casting it to type Stage
*/
public function get stage():Stage
{
   return viewComponent as Stage;
}

inside the constructor of the flashVars value object null is the traceable parameter though it looks to be passed in ok..

12  PureMVC Manifold / Standard Version / Re: clear proxy on: September 30, 2009, 01:35:31
Internally in my proxy I was caching the array not clearing it there, don't blame me nor pmvc blame my debug.

 :-\
13  PureMVC Manifold / Standard Version / Re: clear proxy on: September 30, 2009, 01:16:20
I tried adding this to the Proxy class but it says this function is undefined ! so tried declaring in the IProxy too though this should not be needed same compiler issue ...

public function clearProxy():void
{
         this.data = null;
}

call to undefined method clearProxy.... ???
14  PureMVC Manifold / Standard Version / clear proxy on: September 28, 2009, 03:43:53
I tried passing a null ref into setData into a proxy to try and empty it. There is no specific method. What is the best way to empty a proxy it seems that every time i do a setData it is adding to the current proxy item count I need it to replace...

??
15  Announcements and General Discussion / General Discussion / Re: Mediator Not Receiving a Notification on: September 21, 2009, 02:36:37
Thank goodness for this posting GOTCHA, not totally obvious !  :P

In my case copy across forgot to rename.
Pages: [1] 2 3