I just tried it on my machine and it compiled without any problems after I took out the dependencies I didn't have access to. I never got the error you mentioned. Maybe it's referring to something else? Cut everything out of your project (maybe make a new one) except the onResult function you believe may be the cause and see if you still get the error. I suspect you won't. Good luck!
Aaron On Mon, Jan 18, 2010 at 7:29 AM, Tim Romano <[email protected]> wrote: > > > I am having trouble with an override, getting "Method marked override must > override another method". > > No problem at all doing this: > > in the BASE CLASS: > protected function foo(): void{} > in the SUBCLASS > override protected function foo(): void{} > > > But the error given above occurs here: > in the BASE CLASS > protected function onResult(e:ResultEvent, token:Object=null):void {} > in the SUBCLASS > override protected function onResult(e:ResultEvent, > token:Object=null):void {} > > > I don't see why it's not working. All of the requirements set out here seem > to be satisfied: > > http://livedocs.adobe.com/flex/3/html/help.html?content=04_OO_Programming_11.html > > I've included the class implementations below. Is the cause of the error > evident? > > Thanks again for the help, it's appreciated doubly because I'm stumped by > this. > Tim > ======= BASE CLASS ========== > package TESTREST > { > import mx.rpc.http.HTTPService; > import mx.rpc.AsyncResponder; > import mx.rpc.AsyncToken; > import mx.rpc.events.FaultEvent; > import mx.rpc.events.ResultEvent; > > import OEREST.events.*; > import OEUTIL.BindableArrayCollection; > import json.*; > import OEUTIL.SearchConstants; > > public class MYHTTPSERVICEBASE extends HTTPService > { > > private var _params: Object; > private function get Params(): Object {return _params;} > public function MYHTTPSERVICEBASE(destination: String, > params:Object = null) > { > > var _params: Object=params; > var baseURL: String; > > if ( SearchConstants.DEBUGMODE) { > baseURL = SearchConstants.DEBUG_BASEURL ; > > }else{ > baseURL= SearchConstants.RELEASE_BASEURL ; > } > > super(baseURL, destination); > > } > > public function execute(): void { > var myResponder : AsyncResponder= new AsyncResponder(onResult, > onFault); > this.resultFormat= HTTPService.RESULT_FORMAT_TEXT; > > > var token: AsyncToken; > if ( this.Params == null) { > this.method="GET"; > token = this.send(); > } else { > this.method="POST"; > token = this.send(Params); > } > > token.addResponder(myResponder); > } > > protected function foo(): void {} > > protected function onResult(e:ResultEvent, > token:Object=null):void {} > > protected function onFault(evt:FaultEvent, token: Object=null):void > {} > > > } > } > ============================ > > ====== SUBCLASS ============ > package TESTREST > { > public class TestService extends TESTREST.MYHTTPSERVICEBASE > { > > import mx.rpc.events.ResultEvent; > > protected const DEBUGMODE:Boolean = CONFIG::debug; > protected const DEBUG_BASEURL:String = > "http://localhost/OESharpDeploy/" <http://localhost/OESharpDeploy/> > protected const RELEASE_BASEURL:String = ""; > > import TESTREST.events.*; > import json.JParser; > > > public function TestService() > { > var dest: String =getServiceURL(); > > var selTitles : Array =new Array(1,2,3,4,5,6,7,8,9,10,11,12); > var ss:String = JParser.encode(selTitles); > var params:Object = {"selectedTitles": ss}; > > super( dest, params); > } > > > > private function getServiceURL(): String { > if (DEBUGMODE) { > return DEBUG_BASEURL + "/SSQ.ashx" ; > > }else{ > return RELEASE_BASEURL + "/SSQ.ashx" ; > } > > } > > > override protected function foo(): void{} > > override protected function onResult(e:ResultEvent, > token:Object=null):void {} > > > } > } > ============================ > > > > > On 1/17/2010 10:49 PM, Aaron Hardy wrote: > > > > I'm not sure I understand your question clearly but if I assume correctly I > think the answer will be yes, there is no need for each descendant to > instantiate its own responder. > > Aaron > > On Sun, Jan 17, 2010 at 6:37 PM, Tim Romano <[email protected]> wrote: > >> >> >> Thank you, Aaron, for the helpful answers. My intention would be to have >> each of the descendants of MYHTTPSERVICEBASE point to a different >> destination and raise an event specific to that destination, and to have a >> separate listeners for each kind of event. If I've understood you correctly, >> there is no need for each of the descendants to instantiate their own >> Responder and no requirement for them to override the base execute() method >> too. >> >> Tim >> >> /* this method is in the descendant class and overrides the base method */ >> private overrides function onResult(e:ResultEvent, token:Object=null):void >> { >> // raise a specific event >> } >> >> /* these two methods are in the base class */ >> >> public function execute() : void { >> myResponder = new AsyncResponder(onResult, onFault); >> this.resultFormat= HTTPService.RESULT_FORMAT_TEXT; >> var token: AsyncToken = this.send(); >> token.addResponder(myResponder); >> } >> >> private function onResult(e:ResultEvent, token:Object=null):void { >> // this method is overridden by descendants >> >> } >> >> >> >> On 1/17/2010 3:38 PM, Aaron Hardy wrote: >> >> >> >> I'll take a crack at it. >> >> Can the event object be dispatched from within the MYHTTPSERVICEBASE? >> Sure. I think there may be a separate underlying question here though. >> Are you asking how? Maybe you can clarify? >> >> Will the GUI hear it if it's dispatched from the base class? >> First of all, if the service classes you're talking about aren't on a >> display list (it's very likely they are NOT) then an event doesn't bubble in >> the traditional sense. Nothing will hear the event unless it specifically >> has added an event listener to your service object. So if you want any view >> component to hear the event being dispatched by your service object, the >> view component will need to add an event listener to your service object. >> Depending on the framework you're using, there may be some other mechanism >> whereby the view can hear about a command's completion. Something else you >> can do (though some architecture developers will cringe) is dispatch the >> event off the stage, the system manager, or the base application from your >> command and then the view would add an event listener to whichever object >> that is. >> >> In a class that extends MYHTTPSERVICEBASE, can I override the onResult() >> method that has been registered with the Responder by the base class? >> Yes. In the case of your sample code, if you override onResult in your >> class that extends MYHTTPSERVICEBASE, it is the overriding function that is >> passed into the responder. That is, when you reference onResult, you're >> referencing the "most extended" onResult function, not just the onResult >> function in the class from which onResult is referenced. >> >> I hope that makes sense. It's very likely I misinterpreted your >> questions. >> >> Aaron >> >> >> > > >

