On 1/10/09, dorkie dork from dorktown <dorkiedorkfromdorkt...@gmail.com> wrote:
> I have a class on the application like this: > > <managers:MyClass /> > > How do I find out inside that class in the constructor if that class is on > the Application? By "Application" I assume the Flex application (instance of mx.core.Application). The only way to do this is to walk the parent chain (parent.parent.parent....) until you come across an Application instance, or null. inApplication = false; p = this.parent; while (p != null) { if (p is Application) { inApplication = true; break; } p = p.parent; } Your loop will never run, however, since parent will always be null in the constructor. Note that checking for Application is different from checking for stage. The Application may not have been added to the stage when you're doing this check (even if not in the constructor). So if you want to check if you're on the stage yet, just check for the stage property. onStage = (stage != null); Manish -- http://manishjethani.com