RE: [Flashcoders] to apply the property to the all the dynamic textboxes in my file.
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
Re: [Flashcoders] to apply the property to the all the dynamic textboxes in my file.
Hey Walkoli, Edit the constructor.. as fallowed.. o = TextField; style = TextField.StyleSheet; _global.TextField = function() { super(); var myName = this._name; if (this.type == dynamic) { // Do your autosize here } } // reattach the stylesheet class _global.TextField.StyleSheet = function() { super(); }; TextField.prototype = new o(); TextField.StyleSheet.prototype = new style(); delete o; delete style; Hope this helps! Best regards, Dennis I Sioux - Original Message - From: Walkoli, Nilesh (Cognizant) [EMAIL PROTECTED] To: Flash Coders Mailing List Flashcoders@chattyfig.figleaf.com Sent: Friday, December 15, 2006 7:23 AM Subject: [Flashcoders] to apply the property to the all the dynamic textboxes in my file. Hi , Please anyone help me to apply the property to the all the dynamic text boxes in my file. I am referring some text boxes by name and some by variable. I want to apply the autosize property to all the dynamic textboxes in the file at the start only. Thnx in advance . Please do reply if anyone knows. Thanks and regards, Nilesh Walkoli Programmer Analyst Cognizant Technology Solutions Plot # 26, Rajiv Gandhi Infotech Park, MIDC, Hinjawadi, PUNE - 411 057 Vnet: 22253 Mob : 9881872422 This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.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
RE: [Flashcoders] to apply the property to the all the dynamic textboxes in my file.
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