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
Similar Posts:
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
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
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
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
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
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
Nov 26, 2009
How to use interfaces?
View 2 Replies
Jul 21, 2010
Our company is about to create and distribute (and possibly to sell ) the utility to convert Silverlight apps to its equivalents on Flash.For this purpose we're writing our own AS3-compiler. The compiler for correct work must know how to interact with the classes
backed into the FlashPlayer. The Flex Builder solves it by using the playerglobal.swc that is the part of its distribution package.As far as I know we have no right to redistribute the separate playerglobal.swc without the rest of Flex SDK.
And here is the question: Tehnically we're able to learn all the class interfaces defined inside of the playerglobal.swc with the help of e.g. the plugin ExportSWC (shipped for FlashDevelop) and redeclare them inside of our own swc (e.g. named PlayerGlobalInterfaces. swc) or somehow else.It would be enough for the correct work of our AS3-compiler without the need of using playerglobal.swc at all. But I'm not sure would it violate any copyrights or not?
View 2 Replies
Jan 3, 2010
Is there any way to create a sort of interface for variables? In other words to enforce a class to create and use a variable if they implement an interface or subclass something?
View 1 Replies
May 25, 2011
What I was told, which sparked my curiosity on this topic:Java gui classes can implement hundreds of Listeners and Callbacks and many books teach you to implement all these interfaces in your gui class. Alternatively, these aspects can be implemented in inner classes, so methods called by that listeners do not get mixed up.'d like to know how to do this in ActionScript, which doesn't have inner classes, but has private classes. But, I don't think I fully realize what inner classes are about, so I'm merely trying to wrap my head around the situation where I would use them to organize a class' methods by their usages.
View 2 Replies
Apr 30, 2010
I'm reading up on interfaces and to me I don't see the point in using them? I understand they follow a certain structure but I don't see the use of it in real world usage?
View 2 Replies
Sep 5, 2009
It seems that Actionscript doesnt support defining static functions in interfaces. Whats the reasoning behind this?I think it would be useful to have that ability but I'm sure there must be a reason why its not there.
View 8 Replies
Jan 5, 2010
Should each button get a class and a listener, or should I dump everything into one Object and use e.target.name to figure out what is getting clicked? That way I can just use one listener, but then I won't be able to recycle anything. I could probably work around that though.
View 1 Replies
Jul 22, 2009
I am trying to get a handle on interfaces with AS3 and am kind of at a sticking point. Someone tried to explain them to me using legos and conceptually I get the idea of consistent interaction. Where I seem to get stuck is, I don't really see how the implementation of interfaces accomplishes this.
[Code]....
View 3 Replies
Apr 27, 2010
What's the best way around this problem with interfaces?
public interface ITest {
function set testField(test:String):void;
}[code]......
Test does have a setter for testField (an implicit one).I don't want to define an explicit one for every single field I have defined in my interface.There doesn't seem to be a way to define getters/setters in interfaces (or the syntax just escapes me).Do I have to do this explicit getter/setter nonsense in order to use interfaces in this way?
View 6 Replies
Nov 13, 2010
Is there any way of being able to use the standard iOS interfaces in Flash CS5? i.e blue title, grey striped background, popup keyboard, standard alert message? etc p.s where would one find example code and tutorials for writing the iphone apps as there seems to be nothing available.
View 1 Replies
Sep 10, 2010
Ive looked this up in a few different locations, but to be honest, i dont really get it. I get what loose coupling is, but not how interfaces in Flex?
View 1 Replies
Sep 16, 2010
Is there any way to get interface to play along with custom namespace? Example follows.
IHeaderRenderer.as:
public interface IHeaderRenderer{
function set header(value:IHeader):void;
function get header():IHeader;
}
[Code]...
Sorry for all the blabbing. Any cunning ideas how this kind of situation could be handled?
View 1 Replies
Sep 26, 2010
I'm making a game which loads map .swfs at runtime. The maps will contain graphics and code, which can both vary from map to map. I've decided to make all the maps implement an interface, so they can all be used in the same way by the game. I'm using a .swc to contain the interface, like in this page.
I can get classes to work in the .swc, but not interfaces!
I'm using Flash cs5, and flashdevelop for editing, in AS3. Here's how I've been doing it:
1- create map.fla with a symbol called Map, and a Map.as:
[Code]...
View 1 Replies
Feb 25, 2011
The following code seems to create an ambiguity for the compiler (please see error commented near the bottom). Is it not possible to have getters and setters split between interfaces?
[Code]...
View 2 Replies
Aug 20, 2011
From what I read, interfaces are basically classes for methods, right? If two classes implements the same interface, then they should both have methods described in the interface.
Now, how is this useful? Let's say I want to call foo()
[Code]...
View 5 Replies
Feb 2, 2012
I have two interfaces that declare functions with the same name but incompatible signatures:
interface IDog
{
function bark() : void;
}
[code]....
1) Missing 'public' qualifiers in the class definition were a typo. I fixed it.
2) I missed an additional requirement that interfaces CAN'T be modified (for the purpose of this question). In the real project they're defined in two different libraries that are a part of a large project. Multiple classes implement both interfaces (separately). So, any changes of interfaces will require cascading updates of all those classes, recompilation, testing, etc. So, I wanted first to find out if there was a solution without such intrusive modifications. It doesn't seem there is.
View 2 Replies
May 29, 2010
Let us assume I have classes "Main", "Sub1" and "Sub2". I also have interface "Inter".[code] Basically, I want the constructor function of any class implementing "Inter" to take the same parameters, and thus avoid initialization errors. (So as that the code above gives a compiler error) With any other function,[code]But As the constructor name differs from function to function, I cannot do this.
View 4 Replies
Jan 24, 2011
I'm trying to learn to program to interfaces. I'm using "Advanced AS3 with Design Patterns" (Lott and Patterson) as my guide. Doesn't look so tough at first, but I'm really stretchin' to get a grip on it.
Even though there are no parameters required for "ILoadable" or "ImageGallery", I'm getting the error "1136: Incorrect number of arguments. Expected 1." on
[Code]...
View 9 Replies
Feb 19, 2009
I would like people to be able to change this custom scrollItem class, but as the scroller class has some interaction with this scrollItem class (sets id etc), I have the scrollItem class implement an interface to guarantee the presence of the required methods.This works fine, but only if I keep the type of the scrollingItem class within the scroller class. I would prefer to substitute in the interface type for each scrolling item. However, I cant, as the interface is not a DisplayObject. I can get around this by casting the interface type as a DisplayObject whenever it needs to do DisplayObject type things, but this seems like a hideous hack.
View 5 Replies
Jan 3, 2011
I know it is impossible to extend two classes in the same .as file, but, after some extensive googling, I see that it is possible to implement more than one interface in the same package.
View 3 Replies
Jun 17, 2009
Is it possible to implement 2 interfaces with conflicting methods?
[Code]....
View 1 Replies
Dec 6, 2010
I have a question I wanted to ask you guys, it's pretty complex because it involved classes and interfaces and can get confusing. I'll try my best to explain it below. The gist of the story is, when I click the duck, I want it to give birth and also increment the number of ducks in my farm. Here goes:
[Code]...
View 3 Replies
Mar 8, 2011
On my personal project, I'm starting to use tons of interfaces and I got to thinking how nice it'd be to know which of my class' members serve which of its interfaces. For instance, my class might implement 5 different interfaces, but I only want to see the members that play a role in 1 of those.
View 3 Replies