Consider this code: ================================================================
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ public function thisTest(someString:String = "[default value]"):void { trace("someString = " + someString); } ]]> </mx:Script> <mx:HBox> <mx:Button click="thisTest()" label="Button 1" /> <mx:Button click="thisTest('this is a string')" label="Button 2" /> </mx:HBox> </mx:Application> ================================================================ ...pretty simple, and the trace output is "[default value]" if button 1 is clicked and "this is a string" if button 2 is clicked. All good. Does anyone know how to have a default value to be a new Object? eg: ======================================================== public function thisTest(someObject:Object = new Object()):void { } ======================================================== Is it possible to have defaults that are not simple datatypes? The best I have come up with is something like: ======================================================== public function thisTest(someObject:Object = ""):void { if(typeof someObject != "object") { someObject = new Object(); } } ======================================================== Please feel free to point out what I am missing! -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/