Here's the deal:

If you had googled your error message "1046: Type was not found or was not a
compile-time constant: Event", you would have found the answer to your first
question in the first 3 results.

A 1046 error is a very common error message, seasoned developers already
know what's wrong before they finish reading the message, but that's not the
point. The point is that this list shouldn't be the first option for such a
trivial issue.

Secondly, it is basic programming knowledge that you never pass arguments to
a listener/callback function by doing
testFunction(callbackFunction(argument1,argument2)), because that will run
the function and use the return value of that function as the argument for
testFunction.

In my opinion, both of his questions, albeit they were encountered while
working with flash/as3, are not really flash/as3 related questions. The
first is not knowing when/how to run a simple search to solve basic
programming bugs/errors. The second is just a general lack of basics in
programming in general.

Maybe I'm alone here, which is fine and John, I am not trying to single you
out or anything like that, I just see too many of these types of questions
happen on this list. There are some notorious offenders in the past that I'm
sure we can all think of (at least those of us that have been on this list
for a while).

I'm subscribed to this list to help people when I see an actual issue that
really warrants help, maybe I should just ignore these types of messages in
general and not get myself involved, I don't know.

On Tue, Jul 27, 2010 at 11:54 AM, Henrik Andersson <he...@henke37.cjb.net>wrote:

> Kerry Thompson wrote:
>
>> Henrik Andersson wrote:
>>
>>  Custom events are usually overkill.
>>>
>>
>> If I understand you correctly, Henrik, I disagree. Custom events are
>> incredibly useful.
>>
>
> That they are. But they are not miracle tool. You should use them wisely
> and only when it makes sense.
>
>
>
>> AS3 is event-driven, and I routinely have all sorts of custom events.
>> In a recent game, I added event listeners to 7 different custom events
>> in the main class's constructor. When an animation in a MC finishes,
>> the MC sends the ANIMATION_FINISHED message. When the timer fires, it
>> sends another message. When the student answers a question, I send
>> another message.
>>
>
> Sounds like you missed Event.COMPLETE, it is just as good to signal when a
> task is done.
>
>
>
>> I have a class that extends Event, and custom events are defined in
>> this class. So, when you send a custom event, you get an event object
>> just as you would with a system event.
>>
>
> Did you bother adding any properties in your custom class? If not, you
> could just have used the Event class instead.
>
>
>
>> To me, this is a lot cleaner and easier to follow than callbacks or
>> calls to other methods. It's also less prone to mysterious bugs--when
>> you call a method, it always returns to the caller. If that caller no
>> longer exists, you get a crash that can be very hard to diagnose. When
>> you send a custom message, the code doesn't automatically return to
>> the sender.
>>
>>
> Actionscript is a garbage collected language, objects can not vanish while
> they are used as the value of this for a method. And if you manage to pull a
> stunt like that in something like c++, bad you.
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to