Wacky!  That works with no brackets at all and "fieldClip.setTextFormat" 
is evaluated as "leftInfoClip.topLeftTabs.leftTab.tabTitle.setTextFormat". 
 You got it!

Thank you very much,
Brandon




Gerry Creighton <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
05/22/2006 12:07 PM
Please respond to
Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>


To
Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
cc

Subject
Re: [Flashcoders] Passing TextField Instance Name to Function






Here's another...
Using your movieclip path I have this working...
<code>
function setTextColor(formatName, fieldClip, col, align) {
         formatName = new TextFormat();
        formatName.color = col;
        formatName.align = align;
         fieldClip.setTextFormat(formatName);
}
leftInfoClip.topLeftTabs.leftTab.tabTitle.text = "testing color";

_root.onLoad = function(){ //just to test that the function is called
 setTextColor(myColor,leftInfoClip.topLeftTabs.leftTab.tabTitle, 
0x990000,left);
 
}
</code>

Gerry

........................................................................ 
...
http://www.thespikeranch.com
Certified Macromedia Flash MX Designer
........................................................................ 
...

On May 22, 2006, at 11:04 AM, Brandon Krakowsky/MTC wrote:

> 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
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> 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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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