Actionscript :: PureMVC Proxies Send Notifications Themselves ApplicationFacade?

Aug 24, 2009

In the PureMVC framework, Proxies communicate with the ApplicationFacade (and thus any interested components) via a Notification. Should this Notification be sent via their own instance, or the Singleton instance of the ApplicationFacade? Frankly, does it matter?

[Code]...

The second method looks more verbose and less intuitive to me. Moreover, the Proxy has the ability to send Notifications, which, in my mind, means it probably should. Are there instances where the Proxy should only send a Notification via the ApplicationFacade instance?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: PureMVC Dilemmas - Getting References To Proxies/mediators By Global String?

Jan 26, 2009

As part of the learning PureMVC I've created this example (sources). And I must say that I'm quite disappointment about PureMVC.Here's things that I don't like:

1. Getting references to proxies/mediators by global string.

Code:

var model:SomeProxy=facade.retrieveProxy(SomeProxy.NAME) as SomeProxy;

What's the point in this? In that case why just don't create bunch of references in static public variables in some main class (ApplicationFacade.someProxy)? And after all, what if I want to have dynamic number of proxy/mediator class instances? Ones removed, another ones is created in running time.

2. "The events (notifications) from nowhere, handled by anyone" Let's say I have at my app five models of clocks. And I have also five corresponding views of clocks. With every thick of every clock model, one of clocks views should be updated.In normal approach there's just created control class which create view and model instances, and make decisions if there's any events from them.In PureMVC looks like there's only "global events" - ApplicationFacade.SOME_EVENT so if I want to do my 5 clocks I will have to:

- create notfication id: ApplicationFacade.CLOCK_TICK

- broadcast about it. But I will have to also pass the reference from what clock model it's:

Code:
sendNotification(ApplicationFacade.CLOCK_TICK, this);Now, from some command class that handle that event, should be made decision about updating certain clock view. The question is - from where that command class will know *which* clock view it is? And why this must be so complicated? Updating all clocks with every tick event is not the answer.

BTW: comments from INotification.sendNotification

Code:
@param notificationName the name of the notification to send
@param body the body of the notification (optional)
@param type the type of the notification (optional)
"name" is name, "body" is body, "type" is type - o rly?

3. Only "one level" model allowed?

I don't know how to say this clear so maybe images will be better

In PureMVC conceptual diagram things looks like this: But in real world things looks more like this: Our SubSubModel should have some kind of proxy? Or only "first level" models "deserve" for proxy?What if SubSubModel visual representation is so complicated that it should have dedicated view. How that view will get reference to that "deep-level" model? How they communicate?

View 1 Replies

Flex - Design - Mediators Coupled To Proxies In Flex PureMVC?

Aug 14, 2009

I've just recently learned the PureMVC framework, and am a little confused as to the coupling between Proxy and Mediator objects. The links on this page connect to some documents describing the framework. (Please note, the links on the aforementioned page open PDFs.)

The diagrams and examples of PureMVC I've examined often show a direct coupling between a Mediator and Proxy. When the proxy's state is updated, rather than sending a new Notification, the Mediator (which retrieves a reference to the Proxy from the Facade) has its state updated.

This certainly seems to simplify the logic of the code, but it also directly couples two seemingly disparate components together. To my understanding, a Mediator's purpose is to translate Events from a view into PureMVC Notifications. Proxies are meant to perform some function to gather data and relay it back to the view. These two components seem to exist in different layers of the application, and perhaps shouldn't necessarily be coupled together.

Wouldn't it make more sense to have the Proxy objects send their own Notifications when their state updates, which are forwarded to the interested Mediator by the Facade?

View 2 Replies

Actionscript 3 :: Send Push Notifications From AIR Desktop Client Without Middleware?

Jan 19, 2012

With this PHP code:

<?php
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsCert = 'apns-dev.pem';

[code].....

View 2 Replies

ActionScript 3.0 :: Proxies And Interfaces And Context

Jan 6, 2011

Does anybody know a way to apply an Interface to ObjectProxy, so that you don't have to declare the Interface implementations within the proxy?In other words, if the purpose of ObjectProxy is to proxy the Object in question (passing requests for properties and methods silently to the embedded Object), is it possible to tell the interface "hey, the functions you are looking for are already proxied, so don't bug me about them!"[code]But the function declarations kinda defeat the purpose of using ObjectProxy to begin with... I'd like the Interface to just "know" that "nemesis" is managed by the proxy, but still use the Interface for displaying context-help.which is how to code the context help so people using my MeatwadProxy will see context-help for the Meatwad class it contains?(And yes, I can already hear DrkStr and ASWC snickering at me in the background for continuing to believe in ActionScripts Proxy class. I also believe in Santa Claus, so there!)

View 2 Replies

ActionScript 3.0 :: Object Proxies Into ArrayCollections?

Jun 14, 2011

1 . Retrieve data from MySQL table using PHP and echo it in XML - This part is working fine and prints the data in XML form2 .I receive that XML and assign it as ArrayCollection . Then pass that ArrayCollection into a Component - For this i have done :

ActionScript Code:
<fx:Script>
![CDATA[

[code]......

View 1 Replies

ActionScript 2.0 :: Loading Xml In HTML Pages From Aspx Proxies?

Aug 20, 2007

I'm having a problem retrieving xml data from aspx proxies only when the swf is embedded in an HTML page on a staging server. I developed the swf on my local machine, providing urls to the proxy pages via full urls to my local machine (a la, [URL]. While this worked, I need the path to the proxy page to be relative to the html page, so that when it's on the site, it can still reach the proxy page.

The code looked like this when it worked:

var localProxyPageUrl:String = "http://machinename/sitename/proxypage.aspx";
var proxyPage:XML = new XML();
proxyPage.ignoreWhite = true;

[Code]....

PS: Forgot to mention that I tried even putting the absolute url in the 2nd version to the proxy page, to no avail... <sigh>

PPS: The proxy page is in the same folder as the swf & html page...

View 6 Replies

ActionScript 3.0 :: Stop All Notifications

Dec 11, 2011

stop all notifications
 

View 3 Replies

Ios :: Flex AND IOS Push Notifications?

Aug 31, 2011

It's posible build a Flex 4.5.1 and Adobe AIR app for iOS, And use push notifications?

View 2 Replies

Actionscript :: What Are Benefits Of Spring Considering Dynamic Proxies And Reflection Is Limited

Aug 14, 2009

What are the benefits of Spring Actionscript considering Dynamic Proxies are not possible in the current version of Actionscript and Reflection is quite limited.So for example I could specify my object creation in an XML application context, but why would I do that when I can simply specify that in code, and hence take advantage of static type checking etc.It is by no means my intent to belittle the work done on Spring Actionscript but more to find an application for it in my projects.

View 3 Replies

Flash - Add Chat Sound Notifications?

Jan 6, 2011

I have developed a chat site and would like to add a sound notification (beep or something) when there is a new message kind of like facebook chat.

I know this requires flash but have no idea on how this could be accomplished. Can anybody explain how to make this or a good resource that explains it?

View 2 Replies

Flash :: Xml - Javascript / Notifications In Slideshow Pro?

Jun 11, 2009

I am using SlideShow Pro (a flash slideshow/media player) on a site. I want to receive notifications (in JavaScript) from the flash player when a video is finished playing so I can load another video via Ajax.There is an onVideoEnd() ActionScript call in the API:

[Code]...

How do I receive notifications or execute this in JavaScript? Slideshow Pro comes with many examples of how to send messages TO SlideShow Pro, but none on how to receive notifications via JavaScript. The docs say that the entire API is available via JavaScript

View 1 Replies

Javascript :: Notifications To Flex On Multiple Objects

Feb 24, 2010

I know that with ExternalInterface, we can register ActionScript functions that will be callable from JavaScript, But i want to register actionscript function for of one class which has multiple instance created in the Application. So how it will recognize which object action script function will called from java script.

[Code]...

View 1 Replies

Flex :: Display Notifications In Windows Taskbar?

Aug 19, 2011

I've searched a LOT, but dint get the solution to this: Is there a way to display flex notifications in Windows taskbar, ie, the notification should still be visible even if the application s not exactly frontmost in the monitor..There are ways to do this on AIR, or even flex4..but not Flex3??

View 1 Replies

ActionScript 3.0 :: Receive Email Notifications Upon Receiving Replies From Others?

May 4, 2011

Is it possible to receive email notifications upon receiving replies from others?

View 5 Replies

ActionScript 2.0 :: Check For External Variable To Show Update Notifications?

Mar 25, 2011

I was wondering if it's possible to show a notification for new updates in a swf file.

Like what if I upload a .txt file somewhere and inside it there's a variable, something like;

Code:
newupdate="Version 2.0 is ready for download at domainname.com."

And this will show up in a text field somewhere in my swf file. Is this possible? Are there any pros and cons about using this method of notification?

(Using Flash CS5, AS2)

View 3 Replies

Actionscript :: Where To Register Mediator In Puremvc

Mar 17, 2010

Currently I am working on flex using puremvc framework. Actually my question is related to where to register mediator in puremvc framework. One of my colleague is registering mediator in views(components) creationComplete method only (inside view). While my preference is send some notification from creationComplete method which could be handle by some command and command will register mediator. So which one is better approach in terms of best practice ?

View 3 Replies

Flex :: BlazeDS/PureMVC And Shared Vos?

Apr 21, 2010

I'm building modular application with 2 modules which share common vo: ShopRegionVO

This vo is also a BlazeDS entity and is mapped to a remote java object. When shell loads first module everything is ok. The second module is a list of ShopRegionVOs and item change is handled with the following code:

sendNotification(CoverageConstants.SET_SELECTED_REGION_COMMAND, ShopRegionVO(List(e.target).selectedItem));

The exception is thrown right here:

Main Thread (Suspended: Error #1034: Type Coercion failed: cannot convert model.vo::ShopRegionVO@14961809 to model.vo.ShopRegionVO.)
view.list::RegionListMediator/onChange
flash.events::EventDispatcher/dispatchEventFunction [no source][code].....

View 1 Replies

Actionscript 3 :: One Way Deep Linking In PureMVC?

Sep 2, 2010

A project requirement is that it be 1 way deeplinkable(a specific query string will load a section within the swf).I have a URLProxy that I use for all external linking. It makes sense to me to put the query string logic in this proxy. So in the constructor, I check for a querystring, and then send a notification if it equals a predefined value.One problem with this is that I'd like to predefine this query string key value I am checking against in an external xml file. So another proxy, loads-parses this config xml, then the URL proxy checks against this.

View 1 Replies

Actionscript 3 :: PureMVC For Flash Games

Oct 20, 2011

I dont have any experiencie using this pattern when developing a game, except on a data driven website made mostly in Flex.The question is, are there any drawbacks of this pattern?, let say, performance for example?If anyone implemented a game using this framework.

View 1 Replies

ActionScript 3.0 :: PureMVC Or Gaia Framework?

Apr 19, 2010

Which framework is the best one to execute Website projects? I was researching around Flash website blogs and articles talking about the great advantage at daily production with these frameworks.In my case i'm used to get basic/intermediate projects that consists in Animations, Transitions between swf pages and at the most important point: liquid layouts.Gaia Framework seems to help a lot at organization and singular work time reduction spent.

View 4 Replies

Flex :: PureMVC: Unique Mediator For Each Tab In An Interface?

Oct 12, 2009

I am building a tabbed interface for switching between various similar layers. Each layer will have a number of graphs. By dragging with the mouse the graphs can be rearranged or even moved between layers. My question is, is it best practice to register a unique mediator for each layer that keeps track of the layers content / organization, or should i keep track of it all with one central mediator.some considerations:

the layer contents and organization will be saved(in a db) so that it can be restored when a user comes back to the app.the layers themselves are functionally identical.the user can add and remove layers at will.

View 1 Replies

Flex :: Mediator Must Hold View In PureMVC?

Dec 28, 2009

I have one question about pureMvc. I use pureMvc to build an engine, in the engine init part i have an requirement

1) moduleA must init firt
2) moduleB , moduleC need init after moduleA init complate.
3) moduleD need init after moduleB & moduleC init complate.
4) moduleA , moduleB , moduleC , moduleD all extends Proxy beacuse the four system all need to send notifiation ,but no need to listen it.

But to fit for the requirement I can't use command to do it, because they have ini order and also they need to remember current state(ex: moudelB is init Complate but moudleC is not init complete then can't init moudleD) but command is stateless. The best way I think is use one Mediator to do it, beacuse it can both listen and send notification. My question is :

1) Is this a good way to use one Mediator to do it?
2) If use Mediator is good way, then when it hear first moduleA is init complate
registerCommand(FIRST_MODULE_INIT_COMPLATE , initStepTwoCommand);
sendNotification(FIRST_MODULE_INIT_COMPLATE);
removeCommand(FIRST_MODULE_INIT_COMPLATE);
Need to do things like that way or just do the inti logic in the Mediator?

View 1 Replies

Flash - Popup Dialog Box Manager Using PureMVC

Apr 22, 2010

I am developing a a game in Flash using the PureMVC framework. From time to time I need to show dialog pop-up window to get a user response back (e.g. "Cancel", "OK" and other kinds of asynchronous user feedback) while "locking" the background for interactivity.

I need some management for my pop-ups: all pop-up notifications should be stacked up, so that if two (or more) pop-up messages are initiated at the same time I show them one by one.

What's the best practice here? Should I employ a proxy to manage my pop-ups (sounds unreasonable). How do I get feedback back from my dialog? using notifications?

View 1 Replies

Actionscript 3 :: Creating An API For A View Component In PureMVC?

May 8, 2010

In the context of AS3 and specifically a framework such as PureMVC, what an API for a View Component means.

View 2 Replies

Flex :: Multiple Instances Of Views In PureMVC

Sep 15, 2010

Often multiple instances of the view component would be used in multiple places in an application. Each time I do this, I register the same mediator with a different name. When a notification is dispatched, I attach the name of the mediator to the body of the notification, like so:

[Code]...

View 1 Replies

Flex :: Implementing Process Workflow In PureMVC

Oct 11, 2011

I'm looking for suggestions regarding implementing process flow / work flow management in a PureMVC based application. Our Flex application includes a number of processes such as account creation, payment processing, etc. Within our team, there is some discussion of how rigidly we should adhere to the PureMVC model. Within the PureMVC model, it seems reasonable that the current state in the process could be managed in a Proxy. Commands are clearly responsible for processing the actions required of each node and for node transitions. Mediators for managing the UI.

However, I think that there is an important bit still missing here: a ProcessController. The approaches we've reviewed all seem to either violate the PureMVC model (even just slightly) or make unreadable code. A proxy would maintain the state of the process. As such, it seems to be an appropriate way to implement the controller. However, this is putting a lot of business logic into the proxy.

[Code]...

View 3 Replies

AS3 :: Flex - Inherited Classes And Dynamic Views In PureMVC

Jul 14, 2009

I was wondering best practices for views of inherited classes in PureMVC in this situation: Multiple classes inherit a BaseClass (lets say InheritedClass1 and InheritedClass2) Each InheritedClass has a respective view (derived from a base view class, but each unique) With a given dataset (lets say ArrayCollection of InheritedClass1/2 Objects), the respective views need to be dynamically loaded. The dataset is relatively large, so a TileList would be nice (since it only instantiates objects which are currently displayed) I can think of a couple solutions, but I find them to be too "hackish" to be the best solution:

In View: Repeater over a BaseClassView which attributes a view to a State (set to the "InheritedClass1" state to add a InheritedClass1 object) Pros: No unneeded memory increase (States' objects are instantiated when needed) Cons: View is dependent on the data types, so adds coupling In Mediator: Loop over the ArrayCollection and addChild() the views based on data type Pros: Works. Cons: Mediator is adding things to the View, which defeats the point of the separation of Mediator and View. Slower than a Repeater.

View 4 Replies

Flex :: Unit Testing Puremvc Based Application?

Jul 10, 2010

I have a flex application written using PureMVC framework.Now,I want to write tests.We are using FlashBuilder 4.Is FlexUnit sufficient for testing? Are there any issues you have faced while writing tests?

View 1 Replies

Flash :: PureMVC Mediators And Views - Creation And Control?

Aug 16, 2011

I'm making an app with flash AS3 and puremvc, the way to correctly handle view mediators is sort of throwing me a little...I have 3 or 4 distinct views, each governed by it's own mediator.Each view is only displayed on its own - ie. when 1 is visible/on stage - the others are invisible/removed from stage (over simplified, but I guess could be thought of as seperate pages, viewed one at a time, a nav bar allows a user to change views when they like)

At first each view mediator I had creating and added to stage it's own view component, and as such, when it was 'turn' to show or hide that view, it was simple - addChild and removeChild for it's view component.However, I read over at puremvc.org that it's not good practice to

a. pass round the stage (which was the viewComponent for each mediator in my case - where each view was added to - eg. viewComponent.addChild(foo)

b. create its own view - which allowed me to add and remove it in the first place.

So I changed to the recommended way - when I create each mediator, what I pass in is the view component it governs (rather than the stage/main doc class eg.

var view:MyView = new MyView();
facade.registerMediator( new MyViewMediator( view ) );
viewComponent.addChild(view);

with that the case - I have no idea how I would go about removing/adding each view when needed.I could easily enough set the visibility from within each mediator, but I sort of wanted to avoid doing that - prefer removing when not in use for resource management...how I am 'meant' to go about this (as in, when a view is no longer needed on stage, remove it - temporarily, and add it later on when it is needed?)

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved