2 Replies Latest reply on Jul 16, 2014 7:45 AM by paul_james123

    making an object name

    paul_james123 Level 1

      Hi All,

      I have to do what I thought was a simple thing:


      A cue point comes into my function and is read. I find the name of that cue point (which is the name of the MC it will act upon) and convert it from a string to an object name so I can work on it. Here's how I do that:


      function onCuePoint(event:CuePointEvent):void


        trace (event.name);                                                       // output: "childMovieClipA" <==this is a string.

        newChildObjectName = this[event.name];

        trace ( newChildObjectName.name );                          // output: "childMovieClipA" <==this is an object..



      That works. How do I make the name of another related MC by adding a string to the event.name and then convert that string to an object name?

      I'm trying to create the name of this MC: "childMovieClipA_grandChild"


      For example, I'm trying to do this below but get an error:

        newGrandChildObjectName = this [event.name + "__grandChild"];

        trace ( newGrandChildObjectName.name );                //TypeError: Error #1010: A term is undefined and has no properties.


      Any help is appreciated.