good code man, efficient usage of "instanceof " operator...

Jason Lutes <[EMAIL PROTECTED]> wrote:  Not super efficient, but definitely 
readable and functionally comprehensive:

// Assigns common property values to all dynamic text fields within a specified 
timeline.
function setCommonTextFieldProperties(targetClip:MovieClip):Void
{
// defaults to targeting the root timeline
if (!targetClip)
{
targetClip = _level0;
}
// cycles through all of a movie clip's child objects, looking for dynamic text 
fields or movie clips 
for (var propertyName in targetClip)
{
// sets property values for each dynamic text field child
if (targetClip[propertyName] instanceof TextField && 
targetClip[propertyName].type == 'dynamic')
{
with (targetClip[propertyName])
{
autoSize = 'left';
// additional properties can be assigned
}
}
else
{
// recursively invokes this function for each movie clip child
// obs: components are bypassed because properties that reference ancestors 
cause infinite looping
if (targetClip[propertyName] instanceof MovieClip && !(targetClip[propertyName] 
instanceof UIObject))
{
arguments.callee(targetClip[propertyName]);
}
}
}
}

this.setCommonTextFieldProperties();


-
Jason
_______________________________________________
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


 Send instant messages to your online friends http://asia.messenger.yahoo.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