Flex :: Loose Coupling Achieved By Using Interfaces?
Sep 10, 2010Ive 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 RepliesIve 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 Repliesin my flash, I have an interface which loads pictures through button clicks. During the "loading stage" of every picture, a preloader animation is displayed.Currently, after the swf starts, the first picture is loaded without said preloader animation. I wish to call the preloader function (see code example below) ONCE during startup of the swf, with the first picture load.
loadMovie("load/beach.jpg", _root.content_mc);
// image 1 loads the beach image using startPreload
image1_btn.onPress = function(){
[code]....
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?
can the same techniques like random motion be achieved in swish???
View 7 RepliesI have this flash header in my website. On older computers the flash file askes a lot of recourses and that is not considered user friendly. Can this effect be achieved in a other way of scripting for example with ajax or Jquery?
View 4 RepliesI know that the best way to make a connection from my main app to my modules is through interfaces.
So, my problem is, how can I implement an interface so my module can send and receive data from my main app?, cuz, I understand that my module implements an interface that is used by my main app.. but, can I do it "viceversa"?
Other issue I have is, why do I need to call my main app children if I can just import a module's class?.
im using as3 and components. here i make a combobox.editable=true; i type something inside.. then click outside, the combobox doesn't loose focus. i tried to write stage.focus=null;. but i got d following error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at fl.controls::ComboBox/close()
at fl.controls::ComboBox/fl.controls:ComboBox::onStageClick()
I have a tile based game à la Scrabble where tiles are placed on the board.. during the game the tiles must all be touching, and there should be no groups of tiles anywhere else on the board..I can find single loose tiles and check for surrounding tiles easily enough but how would I go about checking if every tile is touching on a horizontal or vertical axis and if there are loose groups of tiles on the board ??
View 3 Repliesi just created a basic form in flash nothing too fancy it works perfectly well but when your inputting data and hit tab to go to the next one it randomly picks a box to jump to if you press tab again it jumps out of the flash movie and goes into some random symbol has this ever happened to any of you guys?
View 2 RepliesHow to use interfaces?
View 2 RepliesOur 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?
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 RepliesWhat 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 RepliesI'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 RepliesDoes 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 RepliesIt 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 RepliesShould 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 RepliesI 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]....
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?
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 RepliesI'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]...
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]...
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]...
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.
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 RepliesI'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]...
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 RepliesI 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 RepliesIs it possible to implement 2 interfaces with conflicting methods?
[Code]....
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]...