[flexcoders] Interface help
I have an interface like the following. package myCom.controller { import flash.events.Event; public interface ICommand { function execute(event:Event):void } } I have a pseudo abstract class that implements ICommand package myCom.controller { import flash.events.Event; import myCom.view.events.LoginEvent; public class Command implements ICommand { function execute(event:Event):void } } Now I have a Specific command that extends the pseudo class package myCom.controller { import flash.events.Event; import harmonic.view.events.LoginEvent; import harmonic.model.DashboardModel; import mx.rpc.remoting.RemoteObject; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import harmonic.model.User; import com.adobe.crypto.MD5; public class LoginCommand extends Command { public function LoginCommand() { } public override function execute(event:LoginEvent):void { //var myEvent:LoginEvent = LoginEvent(event); //myEvent.user.isLoggedIn = true; var myService:RemoteObject = new RemoteObject("ColdFusion"); //var md5:MD5 = new MD5(); myService.source = "dm.model.Userdao"; myService.getUser(event.user); myService.getUser.addEventListener(ResultEvent.RESULT, myResult); myService.login(event.user); myService.login.addEventListener(ResultEvent.RESULT,myResult); myService.addEventListener(FaultEvent.FAULT,resultFault); myService.getUser.send(event.user); myService.login.send("nschleifer", MD5.hash("vanTive")); DashboardModel.getInstance().currentScreen = "Main"; //trace(myEvent.user.login + " is logged in"); } public function myResult(event:ResultEvent):void { var temp:User; temp = User(event.result); trace("myEvent is done"); } public function resultFault(event:FaultEvent):void { trace("myeventFault" + event.message.toString()); } } }
[flexcoders] Polymorphism help
I am passing in a custom event that extends Event into a class that implements an interface. I get an incorrect signature and I am wondering why? Why do I not get the benefit of polymorphism? I have an interface as follows: package myCom.controller { import flash.events.Event; public interface ICommand { function execute(event:Event):void } } I have a pseudo abstract class as follows: package myCom.controller { import flash.events.Event; import myCom.view.events.LoginEvent; public class Command implements ICommand { public function execute(event:Event):void { } } } Here is a LoginCommand that extends the Command Class package myCom.controller { import flash.events.Event; import myCom.view.events.LoginEvent; import myCom.model.DashboardModel; import mx.rpc.remoting.RemoteObject; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import myCom.model.User; import com.adobe.crypto.MD5; public class LoginCommand extends Command { public function LoginCommand() { } public override function execute(event:LoginEvent):void { } public function myResult(event:ResultEvent):void { var temp:User; temp = User(event.result); trace("myEvent is done"); } public function resultFault(event:FaultEvent):void { trace("myeventFault" + event.message.toString()); } } } I get an error saying that I have an incompatible signature because my execute function is expecting a LoginEvent. The LoginEvent extends Event. Commands execute signature expects an Event. Why do I not get the advantage of polymorphism here? Thanks for your insight. Arizona
[flexcoders] Re: Polymorphism help
I have already answered my own question. Polymorphism does not work in that direction. All I need to do is pass in the event as type Event, that is where polymorphism works. It treats my custom event as an Event. Then I can cast the Event to a LoginEvent and use the features of my custom event. Maybe this will help someone else. Cheers! --- In flexcoders@yahoogroups.com, "Nathan Arizona" <[EMAIL PROTECTED]> wrote: > > I am passing in a custom event that extends Event into a class that > implements an interface. I get an incorrect signature and I am > wondering why? Why do I not get the benefit of polymorphism? > > I have an interface as follows: > > package myCom.controller > { > import flash.events.Event; > > public interface ICommand > { > function execute(event:Event):void > } > } > > I have a pseudo abstract class as follows: > package myCom.controller > { > import flash.events.Event; > import myCom.view.events.LoginEvent; > > public class Command implements ICommand > { > > public function execute(event:Event):void > { > } > > } > } > > Here is a LoginCommand that extends the Command Class > > package myCom.controller > { > import flash.events.Event; > import myCom.view.events.LoginEvent; > import myCom.model.DashboardModel; > import mx.rpc.remoting.RemoteObject; > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > import myCom.model.User; > import com.adobe.crypto.MD5; > > public class LoginCommand extends Command > { > public function LoginCommand() { > > } > > public override function execute(event:LoginEvent):void { > > } > > public function myResult(event:ResultEvent):void { > var temp:User; > temp = User(event.result); > trace("myEvent is done"); > } > > public function resultFault(event:FaultEvent):void { > trace("myeventFault" + event.message.toString()); > } > > } > } > > I get an error saying that I have an incompatible signature because my > execute function is expecting a LoginEvent. The LoginEvent extends > Event. Commands execute signature expects an Event. Why do I not get > the advantage of polymorphism here? > > Thanks for your insight. > > Arizona >
[flexcoders] Re: Polymorphism help
Thank you Brian. I was not thinking properly. Polymorphism was working. That is why I can pass in an event type of LoginEvent. All I have to do is cast it to LoginEvent. ie LoginEvent(event). --- In flexcoders@yahoogroups.com, "Brian Holmes" <[EMAIL PROTECTED]> wrote: > > > > Change your implementation method to something like. > > > > public override function execute(event:Event):void > > { > > if( event is LoginEvent ) > > { > > var loginEvent : LoginEvent = event as LoginEvent; > > > > // do some stuff here > > > > } > > } > > > > > > > > > > ____ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Nathan Arizona > Sent: Wednesday, January 09, 2008 3:01 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Polymorphism help > > > > I am passing in a custom event that extends Event into a class that > implements an interface. I get an incorrect signature and I am > wondering why? Why do I not get the benefit of polymorphism? > > I have an interface as follows: > > package myCom.controller > { > import flash.events.Event; > > public interface ICommand > { > function execute(event:Event):void > } > } > > I have a pseudo abstract class as follows: > package myCom.controller > { > import flash.events.Event; > import myCom.view.events.LoginEvent; > > public class Command implements ICommand > { > > public function execute(event:Event):void > { > } > > } > } > > Here is a LoginCommand that extends the Command Class > > package myCom.controller > { > import flash.events.Event; > import myCom.view.events.LoginEvent; > import myCom.model.DashboardModel; > import mx.rpc.remoting.RemoteObject; > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > import myCom.model.User; > import com.adobe.crypto.MD5; > > public class LoginCommand extends Command > { > public function LoginCommand() { > > } > > public override function execute(event:LoginEvent):void { > > } > > public function myResult(event:ResultEvent):void { > var temp:User; > temp = User(event.result); > trace("myEvent is done"); > } > > public function resultFault(event:FaultEvent):void { > trace("myeventFault" + event.message.toString()); > } > > } > } > > I get an error saying that I have an incompatible signature because my > execute function is expecting a LoginEvent. The LoginEvent extends > Event. Commands execute signature expects an Event. Why do I not get > the advantage of polymorphism here? > > Thanks for your insight. > > Arizona > > > > > > *** > The information in this e-mail is confidential and intended solely for the individual or entity to whom it is addressed. If you have received this e-mail in error please notify the sender by return e-mail delete this e-mail and refrain from any disclosure or action based on the information. > *** >
[flexcoders] Re: Logging
In flex2 perhaps you can use describeType found in flash.utils. --- In flexcoders@yahoogroups.com, learner <[EMAIL PROTECTED]> wrote: > > Hi all, > Is there any way in which I get the caller function name. As in : > > class Aclass{ > > instanceB:Bclass; >function a(){ > instanceB.b(this) >} > > } > > class Bclass{ > function b(Obj){ > // How to trace function name and class name > } > } > > > I have traced out class name by getFullyQualifiedClassName(Obj) but how to > trace function name ??? > > Please somebody guide me .. its very important for me. > > Regards >
[flexcoders] Re: HTTPService, POST, and QueryString
You can use this I think. var dataset:URLVariables = new URLVariables(); var request:URLRequest = newURLRequest("somepage"); request.data = dataset; request.method = URLRequestMethod.POST --- In flexcoders@yahoogroups.com, "markgoldin_2000" <[EMAIL PROTECTED]> wrote: > > My server side of application uses QueryString to extract parameters > being sent from the client to query data and send it back. To save data > I would want to use POST but I also need to send some parameters to the > server as well. I want to use same server logic to process parameters > in both getting data and saving it. But if I use POST method no > QueryString is available on the server. Any suggestions? > > Thanks >
[flexcoders] HorizontalList shows image place holder instead of image
The code below shows that there are two image tags and one horizontal list. The image tags show the images but the the horizontalList does not. Can anyone see what I am doing wrong. Just an FYI. I am using an example from the flex documenatation. Prior to this the HorizontalList was using the same ArrayCollection that the images are using for a source. I was getting the same result. http://www.adobe.com/2006/mxml"; layout="absolute" creationComplete="init()">