Re: [flexcoders] Error in Adobe class MultiTopicConsumer
Hi Andrew, Can't you subclass MultiTopicConsumer and override this method to use your instead of use this one? On Mon, Jun 2, 2008 at 12:43 PM, bbloggs96 [EMAIL PROTECTED] wrote: I am using the MultiTopicConsumer with Blaze. I have had problems with removeSubscription, it gives me an error when I remove the last subtopic in the array of subscriptions. It works OK if any other subtopic is removed. I tracked down the problem to the actual Adobe Class MultiTopicConsumer and method removeSubscription. The code removes the subtopic, but then does a check afterwards to see if it is ttrying to remove a subtopic that does not exist. But when it is the last subtopic, it always fails. Does anybody have a work around? This is the method from Adobe Class MultiTopicConsumer: public function removeSubscription(subtopic:String = null, selector:String = null):void { for (var i:int = 0; i subscriptions.length; i++) { var si:SubscriptionInfo = SubscriptionInfo(subscriptions.getItemAt(i)); if (si.subtopic == subtopic si.selector == selector) { subscriptions.removeItemAt(i); break; } } if (i == subscriptions.length) throw new MessagingError(Attempt to remove a subscription with subtopic: + subtopic + and selector: + selector + that this consumer does not have); } The problem is the if (i == subscriptions.length), which always is true because it has just been removed. Andrew -- /** * Pedro Sena * System Architect * Sun Certified Java Programmer * Sun Certified Web Component Developer */
RE: [flexcoders] Error in Adobe class MultiTopicConsumer
Hi Andrew, Definitely a bug, and I've logged it: https://bugs.adobe.com/jira/browse/BLZ-189 I'd recommend voting for it and adding yourself as a watcher. Thanks, Seth From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of bbloggs96 Sent: Monday, June 02, 2008 8:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error in Adobe class MultiTopicConsumer I am using the MultiTopicConsumer with Blaze. I have had problems with removeSubscription, it gives me an error when I remove the last subtopic in the array of subscriptions. It works OK if any other subtopic is removed. I tracked down the problem to the actual Adobe Class MultiTopicConsumer and method removeSubscription. The code removes the subtopic, but then does a check afterwards to see if it is ttrying to remove a subtopic that does not exist. But when it is the last subtopic, it always fails. Does anybody have a work around? This is the method from Adobe Class MultiTopicConsumer: public function removeSubscription(subtopic:String = null, selector:String = null):void { for (var i:int = 0; i subscriptions.length; i++) { var si:SubscriptionInfo = SubscriptionInfo(subscriptions.getItemAt(i)); if (si.subtopic == subtopic si.selector == selector) { subscriptions.removeItemAt(i); break; } } if (i == subscriptions.length) throw new MessagingError(Attempt to remove a subscription with subtopic: + subtopic + and selector: + selector + that this consumer does not have); } The problem is the if (i == subscriptions.length), which always is true because it has just been removed. Andrew