Skip to main content
Known Participant
August 13, 2014
Answered

Variables for object names

  • August 13, 2014
  • 1 reply
  • 438 views

Hi all,

Is it possible to use variables in place of object names? So i have a function that looks like this:

public static function xmlText(OBJECT,TEXT):void

{

     some_mc.[OBJECT].some_mc.text = lodedXML.someNode.[TEXT].someNode;

}

I'm trying to create a  function that changes the variables in the paths to the objects passed when the function is called.

This might be a daft question but i just cant seem to find an answer!

Many Thanks

Matt

This topic has been closed for replies.
Correct answer Ned Murphy

Give me an example of what you want to do and explain it and I will try to give you an example beyond this...

var someMC:Movieclip = new MovieClip();

at this stage you only need to target someMC since you have a direct reference to it, even if you make it a child of some other object.

1 reply

Ned Murphy
Legend
August 13, 2014

If you assign a variable as a reference to an object you can use that to target the object.

SFMltdAuthor
Known Participant
August 13, 2014

Thanks Ned i was sure it could be done. Could you show me a quick example of how i'd write it?

Cheers!

Matt

Ned Murphy
Ned MurphyCorrect answer
Legend
August 13, 2014

Give me an example of what you want to do and explain it and I will try to give you an example beyond this...

var someMC:Movieclip = new MovieClip();

at this stage you only need to target someMC since you have a direct reference to it, even if you make it a child of some other object.