Link to home
Start Free TrialLog in
Avatar of stewdogg61
stewdogg61

asked on

Get original MovieClip name from Library with Actionscript

I need to be able to access a property of my components that will tell me whether or not they are a ComboBox, TextArea, etc.  If I use the ._name property it gives me the instance name, how do i get the original name like ComboBox with Actionscript?
Avatar of Montoya
Montoya

what are you trying to accomplish? there is no property in the UIcomponent class that identifies the type of class. Maybe if you can describe what you're actually trying to do...perhaps there's a workaround.
Avatar of stewdogg61

ASKER

On my page I have 37 different compenents, some of them are ComboBox components, some are TextInput, some are TextArea.  The instances are named sequentially "cca1", "cca2", and so on.  I want to be able to check and see if _root["cca"+i] is a ComboBox or a TextInput, etc.  Right now I have the following script running, but I only want it to execute if the component type is a ComboBox:

for(i=1;i<38;i++){
     _root["cca"+i].editable = true;
     _root["cca"+i].rowCount = 3;
     _root["cca"+i].addItem("");
}

I was thinking if I could just get to the MovieClip name (the actual name in the Library) I could check to see if that was equal to "ComboBox" and then only run the code then.
 
I figured it out:

for(i=1;i<38;i++){
     if(_root["cca"+i].addItem("")){
          _root["cca"+i].editable = true;
          _root["cca"+i].rowCount = 3;
     }
}

This made it so it only made the ComboBox components editable becuase they were the only components that allowed the addItem property.
if you reached your conclusion without our assistance, you can ask the mods to cancel the question, and your points will be reimbursed.

Glad you reached the answer.
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial