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 ... 3 4 [5] 6 7 ... 17
61  Announcements and General Discussion / General Discussion / Re: FLEX GUMBO ISSUES on: June 16, 2009, 10:10:57
I'm using Flash Builder with the 3.4 sdk and no issues so far. I don't use Flex, just AS3, so I haven't tried the Flex 4 sdk.
62  Announcements and General Discussion / Fabrication / Re: FlashDevelop Fabrication Templates and Video Tutorial on: June 13, 2009, 09:14:42
Nice! Wish I still used FD, but I'm hooked on Flash Builder and Ant now :(
63  Announcements and General Discussion / Fabrication / A big "gotcha" to watch for with dynamic Proxies extending FabricationProxy on: June 10, 2009, 08:59:50
When using Fabrication with dynamically generated Proxies, there's a big gotcha to be aware of. I just spent hours debugging this problem so I thought I'd share my findings and save others the hassle.

When using dynamically named proxies, Fabrication will alter any outgoing notification names from that proxy. For instance, if you have a proxy named DataProxy_563 and you send a notification from within the Proxy called DataComplete, Fabrication will alter the outgoing notification name to DataProxy_563/DataComplete. This is done, in conjuction with a second notification sent named NOTIFICATION_FROM_PROXY, so that you can have mediators listen for specifically named proxys using a respondToDataProxy_563(note). The problem, however, is that this alteration requires your mediator to know ahead of time that the proxy they are interested in is named DataProxy_563, which you can't do when naming proxys using a dynamic generated name like _563. You lose the simple DataComplete notification altogether and can only listen for "DataProxy_563/DataComplete" (which won't work as a respondTo name) so you have to use the respondToDataProxy_563(note) method.

In my case I wanted to listen for that basic DataComplete notification and then inside the respodToDataComplete() call figure out what Instance of DataProxy it came from and go about my business that way.

Luckly, Darshen was smart (like you didn't know) and include a little mysterious property called expansion which, when set to false, will completely bypass the renaming and send the normal notification. YAY!

My only complaint is that I would have rathered this been set to false by default, rather than true. I don't really see many instances where I would want that default behavoir.

Anyway, simply set this to false in your proxy, assuming of course that you are entending FabricationProxy, to have the normal notification behavoir.
64  Announcements and General Discussion / Getting Started / Re: From where do you get the component for a Mediator to mediate? on: June 09, 2009, 10:40:05
For AS3 only projects where the component to mediate is not yet on the stage, you can create it inside of the mediator itself, or inside of another command/mediator that is registering the mediator.

Also, try to do any creation inside of the mediators onRegister() method and not the constructor to ensure the mediator is fully registered with the PMVC apperatus.

Examples:

Register and create component inside mediator
:
// when a mediator is created and you want the mediator itself to create the component
...
override public function onRegister():void
{
    viewComponent = new ComponentToMediate();
    sendNotification(ADD_TO_STAGE, viewComponent, 'type');

}

...

Inside command
:
// when you want a command to handle it (inside of a command)
override public function execute(note:INotification):void
{
    ....

    facacde.registerMediator(new compMediator(new UIComponent()));

}

// then inside said mediator
override public function onRegister():void
{
    // mediator registered alert we need to add this component to stage
    sendNotification(ADD_TO_STAGE, viewComponent, 'type');

}

Have another mediator that is the parent of the component handle it based on some notification
@See the HelloFlash demo for an example of this
:

handleNotification(note:INotification):void {

    switch(note.noteName())
    {
         case 'createSomeChild':
              var comp:UIComponent = new UIComponent();
              facade.egisterMediator(new CompMediator(comp));
              viewComponent.addChild(comp);
              break;
    }
}
65  Announcements and General Discussion / Getting Started / Re: How would you pass references of Mediators between themselves? on: June 07, 2009, 07:07:00
When mutiple mediators are listerning to the same notification, you can use the notifications Type property as a descriminator (if required).
66  Announcements and General Discussion / Getting Started / Re: How would you pass references of Mediators between themselves? on: June 06, 2009, 09:45:24
You should be using notifications to accomplish this rather than having the Mediators talk directly. Have one mediator send a notification requesting something, the other listens for that note and responds to it by sending another note whcih the ornigial sender is listening for. Basically requires two notifications, one that each mediator is listening for and that the other sends.

You put the payload you want in the body of the notification.
67  PureMVC Manifold / Standard Version / Re: Trying to make a simple card matching game (memory) on: June 05, 2009, 01:23:39
Is it really neseccary to run the update on every enter_frame event? Assuming you are using 30 FPS for your app, that's 30 times a second you would be running gameStateProxy.update(). I don't know what that function does but it can quickly hurt performance doing so. You might want to use a timer if you only need to check once a second or longer.

People really shouldn't ever use enter_frame events unless absolutely neseccary. :)
68  Announcements and General Discussion / General Discussion / Flex Code Formatter on: June 05, 2009, 08:52:37
It always drove me nuts that I couldn't control the default way Flex formats it's code. I've always coded by putting bracers on the same line as the method, class etc. I decided to do some searching and found this[1] eclipse plugin. I don't know how I survived before without it! It works perfectly and is highly configurable. Just thought I'd make a mention of it incase others have the same problem as I did.

[1] http://sourceforge.net/project/platformdownload.php?group_id=248408
69  PureMVC Manifold / MultiCore Version / Re: Regarding keeping model and view decoupled -Proxies should know about Mediators? on: May 31, 2009, 08:28:10
It's fine to have mediators call Proxies for simple reads/writes. Anything more complex, or used in mutplie places, should go in a command for reuse.
70  PureMVC Manifold / Standard Version / Re: native PHP PureMVC port on: May 29, 2009, 05:58:39
Sounds great. I haven't used PHP in a while, but I did for many years, so it's great to hear that there's more options out there. A native extension would certainly be a nice thing to have. With PMVC's implemention of utilities it should be easy to build plug-ins for things like Propel and Smarty.
71  Announcements and General Discussion / Fabrication / Re: HelloFlash refactored with Reactions on: May 25, 2009, 01:01:07
It appears only the StageMediator uses Reactions? I was under the impression Reactions couldn't be used with Flash... did you change anything?

Your post is kind of vague and I'd love to find out more on what/how you got reactions working with Flash. I know I could dig through the code myself and find out but I think it would be worth wild to have it here for others.

Thanks.
72  Announcements and General Discussion / Getting Started / Re: PureMVC actors and their responsibilities on: May 24, 2009, 08:14:24
Commands are also the place you perform complex operations like gathering data from multiple Proxys, manipulating data before display (business logic), and for any operations that happen in mutiple areas of your app to avoid duplicating code.
73  Announcements and General Discussion / Architecture / Re: Pipes and the StateMachine Walkthrough on: May 20, 2009, 07:04:30
...as soon as I finish PureMVC TV with it.

*perks up*

Ok, I'll admit you sparked my curiosity! What is this "TV" you speak of?
74  Announcements and General Discussion / General Discussion / Re: dispatch MouseEvent from view component on: May 19, 2009, 08:23:59
All I was trying to say was if you wanted to listen for a Mouse event in the mediator that was generated on an image you don't need a custom event to do so. If you WANT a custom event than you would have to do as you described above but looking at his example he was just testing that one was clicked (the use of event name click lead me to believe he didn't want a custom event name per image).

In my example you would simply listen for the bubbled mouse event in the mediator, you don't even need the sendEvent function because the click even bubbles up from the image. However, if the event did not bubble my example is how you can pass it up to the parent (in the case that Image was a custom component that dispatched an event that didn't bubble).

This is all he needs in the mediator to listen for an image click assuming he doesn't need custom event names.

:
... mediator

override public function onRegister():void {

    // assuming the component was named mediatorComponent
    mediatorComponent.addEventListener(MouseEvent.CLICK, mouseClickHandler, false, 0, true);

}

Again, perhaps I was mislead by the example he gave and he does indeed need custom event names, in which case ignore my post :)
75  Announcements and General Discussion / General Discussion / Re: dispatch MouseEvent from view component on: May 19, 2009, 06:07:42
Maybe I'm missing something but, why recreate another Mouse event? Why not just pass through the original mouse event? The example you took from is more if you want a way of identifying which item was clicked and to dispatch custom events based on that knowledge.

In the case of just listening for a click event try:

:
<?xml version="1.0" encoding="utf-8"?>

<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="80" direction="horizontal">
<mx:Script>
<![CDATA[

// send the event up since it doesn't bubble by default
private function sendEvent( event:MouseEvent):void
{
dispatchEvent(event);
}
]]>
</mx:Script>
<mx:Repeater id="rp">
<mx:Image source="{rp.currentItem}" buttonMode="true" width="60" height="60" click="sendEvent(event)"/>
</mx:Repeater>
</mx:Box>

Pages: 1 ... 3 4 [5] 6 7 ... 17