Didn't mean it to be 'broad'. I agree but there are still problems with it.

Mike

On Sun, Jun 15, 2008 at 8:53 AM, Josh McDonald <[EMAIL PROTECTED]> wrote:

>   That's a pretty broad statement to make. I think bubbling system-wide
> events are a great way to achieve loose coupling between UI and business
> code. But then again if you're listening for a NewUserCreated event, your
> function should be expecting a NewUserCreatedEvent, not an Event.
>
> -Josh
>
> On Sun, Jun 15, 2008 at 9:03 PM, Michael Schmalle <[EMAIL PROTECTED]>
> wrote:
>
>>   Right Eric, this was a quick and dirty example.
>>
>> Another thing to note: Event bubbling is dangerous.
>>
>> Only make your event bubble if it is absolutely necessary.
>>
>> I have made some big components and learned the hard way. :)
>>
>> This is just my opinion but event bubbling almost breaks OOP
>> encapsulation. If there is a chance some instance that has not 'subscribed'
>> to your api gets your event, BUGS happen. This problem is synonymous to name
>> collisions and since the compiler can't type check events, here in lies the
>> problem.
>>
>> This can also hurt a dev that does not truly understand bubbling and is
>> trying to use your component or application.
>>
>> Mike
>>
>>
>> On Sat, Jun 14, 2008 at 9:40 AM, EECOLOR <[EMAIL PROTECTED]> wrote:
>>
>>>   Whenever you create a custom event. Make sure you override the 
>>> *clone*method. If you do not do that you will get strange results when
>>> re-dispatching an event.
>>>
>>>
>>> Greetz Erik
>>>
>>>
>>> On 6/12/08, Michael Schmalle <[EMAIL PROTECTED]> wrote:
>>>>
>>>>  Hi
>>>>
>>>> package my.event.package
>>>> {
>>>>
>>>> public class MyEvent extends Event
>>>> {
>>>>     public static const IS_GREATER_CHANGED:String = "isGreaterChanged";
>>>>
>>>>     public var isGreater:Boolean;
>>>>
>>>>     public function MyEvent(type:String, isGreater:Boolean)
>>>>     {
>>>>         super(type);
>>>>         this.isGreater = isGreater;
>>>>     }
>>>> }
>>>> }
>>>>
>>>> // app as file
>>>>
>>>> [Event(type="isGreaterChanged", type="my.event.package.MyEvent")]
>>>>
>>>> ...
>>>>
>>>> var e:MyEvent = new MyEvent(MyEvent.IS_GREATER_CHANGED, true);
>>>> dispatchEvent(e);
>>>>
>>>> ... event handler
>>>>
>>>> private function isGreaterHandler(event:MyEvent):void
>>>> {
>>>>     trace(event.isGreater);
>>>> }
>>>>
>>>> Mike
>>>>
>>>
>>>
>>
>>
>> --
>> Teoti Graphix, LLC
>> http://www.teotigraphix.com
>>
>> Teoti Graphix Blog
>> http://www.blog.teotigraphix.com
>>
>> You can find more by solving the problem then by 'asking the question'.
>>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>  
>



-- 
Teoti Graphix, LLC
http://www.teotigraphix.com

Teoti Graphix Blog
http://www.blog.teotigraphix.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to