Worked like a charm. Your bog really helped. Thanks a lot!!!
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > AS is not Java. See the modules presentation on my blog. > > > > You won't want to reference MyScreen as MyScreen in the main app, but > rather as IScreen. MyScreen should have been created by ModuleLoader > and the child property should be an IScreen. > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of arunprakash dhanabal > Sent: Wednesday, July 23, 2008 6:09 PM > To: [email protected] > Subject: [flexcoders] Loading an ActionScript class from and external > swf file > > > > Hi, > > Im running into an issue with Flex and need some help. > > I have an action script application in flexbuilder. > Here is the setup, > > * interface named IScreen defined in the application > * Created a new mxml module(MyScreen.mxml) which is implementing the > IScreen interface > * The main application's SWF has just the IScreen.as and the > application.mxml > * The MyScreen.swf has the MyScreen.as and the related dependencies > > Im trying to instantiate the class MyScreen from the > application.mxml. Im loading the swf file using a ModuleLoader and > once the module is loaded, Im trying to create an instance of the > MyScreen using the getDefinitionByName. > > I get the following error > Error #1065: Variable MyScreen is not defined. > > I get this because MyScreen is a seperate module and not compiled > into the main swf file. I dont want the MyScreen to be compiled into > the main app as my requirement is that I dont know which > implementation of the screen, I willbe loading in the runtime. > > In Java I would just define the interface in the main application and > then, load the class that is implementing the interface from the > classpath and I should be able to call the methods in the interface. > > Any thoughts!!! > > I have a sample workspace showing this problem > > Thanks for your time in reading this email. >

