A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Checking parent's class

  1. #1
    Member
    Join Date
    Sep 2010
    Posts
    37

    Checking parent's class

    How can I check what a parent MovieClip's class is?
    I have a Terrain class that I only want to use a function when the parent movieclip is a specific class, so that the terrain object can be used by multiple classes, but only launch that specific function when the parent's class is "WorldBase". How can i detect this through the Terrain class?

  2. #2
    Member
    Join Date
    Jul 2009
    Posts
    56
    PHP Code:
    function checkClass(theObject:Object) {
    if (
    theObject is WorldBase) {
    do...
    }
    else {
    do...

    or perhaps one of these will work without function:

    PHP Code:
    if (theTerrain.parent is WorldBase
    PHP Code:
    if (theTerrain(parentis WorldBase

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center