Precia, Two things I see so far - one is there's no () at the end of your new statement (new tester()) and two is you need to add your tester display object to a container using addChild(). Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreate()"> <mx:Script> <![CDATA[ import Tester; private function onCreate():void { var tester:Tester = new Tester(); addChild(DisplayObject(tester)); } ]]> </mx:Script> </mx:Application> Jeff -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of app.developer Sent: Thursday, August 30, 2007 12:01 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Call MXML custom component from AS How do you call an mxml custom component from actionscript of another mxml application? In the current application, I import the tester component, then attempt to call it my making it a new variable in a function. When I add the child to the stage I get a white background empty object and not the red square I'm trying to get into the application. import comps.tester; var myNewTester:tester = new tester; ----tester.mxml---- <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="200" height="150" backgroundColor="#FF0000"> <mx:Text text="Test Me"/> </mx:VBox> Thank you for your help. Precia -- 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