Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

making an object name

$
0
0

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.


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>