I think you probably want parenthesis around your typecast, as var label:Label = (Label)(owner.attachMovie(Label.symbolName, instanceName, depth, initObj));
P. >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:flashcoders- >> [EMAIL PROTECTED] On Behalf Of Lieven Cardoen >> Sent: Monday, September 25, 2006 8:53 AM >> To: Flashcoders mailing list >> Cc: Bert Vandamme; Christophe Herreman >> Subject: [Flashcoders] Label --> null >> >> import mx.controls.Label; >> >> >> >> >> >> public function createLabel(owner:MovieClip, instanceName:String, >> depth:Number, initObj:Object):Label{ >> >> var label = owner.attachMovie(Label.symbolName, instanceName, >> depth, initObj); >> >> logger.debug("label : " + label); >> >> label.autoSize = "left"; >> >> applyStyle(label); >> >> return label; >> >> } >> >> >> >> --> logs a Label ...view0.view1.component12 >> >> >> >> >> >> >> >> If I type the label : >> >> >> >> public function createLabel(owner:MovieClip, instanceName:String, >> depth:Number, initObj:Object):Label{ >> >> var label:Label = Label(owner.attachMovie(Label.symbolName, >> instanceName, depth, initObj)); >> >> logger.debug("label : " + label); >> >> label.autoSize = "left"; >> >> applyStyle(label); >> >> return label; >> >> } >> >> >> >> --> logs 'null' >> >> >> >> >> >> Why the f**k is this??? >> >> _______________________________________________ >> [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 _______________________________________________ [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

