A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: getQualifiedClassName

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    996

    getQualifiedClassName

    I'm running into an issue with a Library class not being able to get the correct getQualifiedClassName. Here is my setup.

    I have a lot of MovieClips on the stage with instances names like item0, item1, item2 and so on. What I need to do is extend some of those items and give them extra functionality so I opened the items Symbol properties dialog box that I wanted to add a custom Base class to and Checked Export For Actionscript. Kept the Class name the same as the stage instance name. as it needs a unique class name. Then for the BaseClass I added a path to my class that I wanted each item to have extra functionality. The base class was called StageItem which extends MovieClip

    In my Main class I add each item to an array.

    Actionscript Code:
    for (var i:int = 0; i < mainContent.numChildren; i++)
                {

                    var child:MovieClip = mainContent.getChildAt( (mainContent.numChildren-1) - i ) as MovieClip;
                    child.alpha = 0;
                    itemArray.push(child);

                }

    Then In another method I do a check on each item in the array to see which ones are of the StageItem class type.

    Actionscript Code:
    trace( itemArray[i] is StageItem);

    trace(getQualifiedClassName(itemArray[i]);

    the getQualifiedClassName is returning the unique class name which is the same as the instance name which is correct. Example : item0, item1 and so on....

    Here lies the problem every item is showing false. to the first trace When it should be showing true for the ones that has a BaseClass of StageItem.
    Even when I do a trace to see if its of a MovieClip type it still traces fales.
    trace( itemArray[i] is MovieClip);

    Is this something to do with having Class names been created by flash in the Symbol properties dialog box. I can't see any other way to give certain Libray assets a custom base class any other way.

    Anyone know why this would happen.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I tried to reproduce your case and even placed the objects on stage also but unlike you get the right traces. Can you post example files?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    Thanks for the reply cancerinform. I did a quick test outside of my file and it worked correctly. It must have something to do with my file. At least I know I'm not going mad and this does in fact work.

    Thanks

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