Hello all.  This is probably very simple.  I'm trying to pass the instance 
name of a textfield to a "setTextColor" function which applies a 
TextFormat.  The function takes 4 parameters, the new format name, the 
textfield instance name, the textfield color, and the textfield alignment. 
 Everything is passed correctly except for the textfield instance name. 
The absolute path is passed, which means "_level0." is appended to the 
beginning of the full path. 

So for instance, I pass "leftInfoClip.topLeftTabs.leftTab.tabTitle", where 
"tabTitle" is the actual textfield.  when I pass it to the "setTextColor" 
function and trace it, "_level0.leftInfoClip.topLeftTabs.leftTab.tabTitle" 
is returned.  This would be fine except for when I try and evaluate the 
variable inside the function with _root[var], it fails.  See below: 

setTextColor("topLeftTab",leftInfoClip.topLeftTabs.leftTab.tabTitle,0x000000,"left");
 


function setTextColor(formatName, fieldClip, col, align) {                 

        _root[formatName] = new TextFormat(); 
        _root[formatName].color = col; 
        _root[formatName].align = align; 

        //this is the problem here. I can't remove "_root", because that 
is bad syntax.  "this" also doesn't work.  so I'm left with "_root." + 
"_level0.leftInfoClip.topLeftTabs.leftTab.tabTitle". 
        _root[fieldClip].setTextFormat(_root[formatName]); 
} 

Thanks, 
Brandon Lee
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to