How to determine which class has called a function
Posted
by dannyc
on Stack Overflow
See other posts from Stack Overflow
or by dannyc
Published on 2010-04-16T11:32:33Z
Indexed on
2010/04/16
11:43 UTC
Read the original article
Hit count: 315
Hi,
I am working on a Flex Front End at the moment, and have been using the Parsley framework for passing messages/events around.
I was wondering if there is a simple way for a function (in this case, an event's constructor) to obtain a reference to the object which called it?
This is to ensure that a certain event that I am defining can only be dispatched by one specified class. My thinking is to check the caller of the constructor somehow, and throw an error if it is not of the correct type.
I am open to suggestions of alternative approaches here, but I would ideally like to stick to using the Parsley 'MessageHandler' approach if at all possible.
Thanks for reading guys..
© Stack Overflow or respective owner