Hi Derrick, Maybe this helps you? You can construct class instances dynamically by getting the constructor for a class with
mx.utils.ClassUtil.findClass(aClassName:String); But before you can do it, you have to register a class like this: Object.registerClass("TitleWindowTest", TitleWindowTest); Try the following example: ################################### TitleWindowTestCreator.mxml - File: ################################### <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" horizontalAlign="left"> <mx:Script><![CDATA[ import mx.containers.TitleWindow; import mx.managers.PopUpManager; private function showTitleWindow():Void { Object.registerClass("TitleWindowTest", TitleWindowTest); var testWindowName : String = "TitleWindowTest"; var oInitObj:Object = new Object(); oInitObj.title = "Title Window Data"; oInitObj.width = 600; oInitObj.height = 200; var titleWindowInstance:Object = TitleWindow(PopUpManager.createPopUp(this, mx.utils.ClassUtil.findClass(testWindowName), false, oInitObj, false)); titleWindowInstance.centerPopUp(this) } ]]></mx:Script> <mx:Button label="ShowTitleWindow" click="showTitleWindow()"/> </mx:Application> ################################### TitleWindowTest.mxml - File: ################################### <?xml version="1.0" encoding="utf-8"?> <mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml" closeButton="true" click="this.deletePopUp();" creationComplete=""> <mx:HBox > <mx:Label text="Test Label" width="150" /> </mx:HBox > </mx:TitleWindow> > -----Ursprüngliche Nachricht----- > Von: Derrick Grigg [mailto:[EMAIL PROTECTED] Im Auftrag von > Derrick Grigg > Gesendet: Freitag, 7. Oktober 2005 20:13 > An: flexcoders@yahoogroups.com > Betreff: RE: [flexcoders] PopupManager.createPopUp - varying the className > argument > > Thanks Matt and Jester > > No luck though. The background of my app goes white the first time this > function gets called, and the app completely disappears the second time. > If I put hard codeed class names in everything works. I have come up > another solution that seems to work. Each option that calls the loadWin > function is based on a class so instead of dispatching an event to loadWin > I am having the class use popupmanager to open it's respective window. > > var win1: views.elements.image; > var win2: views.elements.swf; > var win3: views.elements.text; > > function loadWin(event){ > var cn:String = "views.elements."+ event.target.type; > var initObj = { > helpButton: true, > stateButton: true, > resizeButton: true, > closeButton: true > } > var win = mx.managers.PopUpManager.createPopUp( _root, _global[cn], > true, initObj, false ); > win.centerPopUp(_root); > } > > Thanks for the help though. > > ________________________________ > > From: flexcoders@yahoogroups.com on behalf of Matt Chotin > Sent: Fri 07/10/2005 10:44 AM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] PopupManager.createPopUp - varying the className > argument > > > > Also you need to make sure that the class still gets linked into your app. > Create some dummy variables of the potential types that could be loaded: > > > > Var linkhelper1:MyWindow1; > > Var linkhelper2:MyWindow2; > > > > Etc. > > > > Matt > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of JesterXL > Sent: Friday, October 07, 2005 7:38 AM > To: flexcoders@yahoogroups.com > Subject: Re: [flexcoders] PopupManager.createPopUp - varying the className > argument > > > > Close! > > var yourClass:String = "Pooki"; > PopUpManager.createPopUp(this, _global[yourClass], false); > > ----- Original Message ----- > From: "Derrick Grigg" <[EMAIL PROTECTED]> > To: <flexcoders@yahoogroups.com> > Sent: Friday, October 07, 2005 10:04 AM > Subject: RE: [flexcoders] PopupManager.createPopUp - varying the className > argument > > > Tried the string idea, no luck. The switch/if looks like the only way. I > was > hoping not to have to do that since I want to have a lot of variability on > the user's window options but not luck apparenetly. > > Thanks. > > ________________________________ > > From: flexcoders@yahoogroups.com on behalf of Mink, Joseph > Sent: Fri 07/10/2005 9:48 AM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] PopupManager.createPopUp - varying the className > argument > > > I would guess you could use a string...like, instead of ...createPopUp( > _root, SomeClass, true, initObj, false ); maybe you could do createPopUp( > _root, "SomeClass", true, initObj, false ); > > But I would guess your best bet is to arrange your implementation in such > a > way that you can just go through a few if-statements and based on your > user's input, execute the necessary call to createPopUp. > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of derrickgrigg > Sent: Friday, October 07, 2005 9:39 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] PopupManager.createPopUp - varying the className > argument > > > I have a instance where I want to vary the pop window that gets > created based on a user's selection. Instead of having to hard code in > the a seperate instance of: > > var popup = mx.managers.PopUpManager.createPopUp( _root, > views.OptionX, true, initObj , false ); > > in a switch statement I would like to just be able to use a variable > for the className argument. > > Ideally I would like to do the following: > > var winClass = options_cmb.value; > var popup = mx.managers.PopUpManager.createPopUp( _root, winClass, > true, initObj, false ); > > I have tried unsuccessfully using a shared libray. Does anyone know if > this is even possible, and it so how I would go about it. > > > > > > > -- > 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 > > > > * Visit your group "flexcoders <http://groups.yahoo.com/group/flexcoders> > " > on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service > <http://docs.yahoo.com/info/terms/> . > > > ________________________________ > > > > > > -- > 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 > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > > SPONSORED LINKS > Web site design development > <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+si > te+design+development&w2=Computer+software+development&w3=Software+design+ > and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c > =5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ> Computer software development > <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+ > site+design+development&w2=Computer+software+development&w3=Software+desig > n+and+development&w4=Macromedia+flex&w5=Software+development+best+practice > &c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw> Software design and development > <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=We > b+site+design+development&w2=Computer+software+development&w3=Software+des > ign+and+development&w4=Macromedia+flex&w5=Software+development+best+practi > ce&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> > Macromedia flex > <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+de > velopment&w2=Computer+software+development&w3=Software+design+and+developm > ent&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.si > g=OO6nPIrz7_EpZI36cYzBjw> Software development best practice > <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1 > =Web+site+design+development&w2=Computer+software+development&w3=Software+ > design+and+development&w4=Macromedia+flex&w5=Software+development+best+pra > ctice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> > > ________________________________ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] <mailto:flexcoders- > [EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service > <http://docs.yahoo.com/info/terms/> . > > > ________________________________ > > > > -- > 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 > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- 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/ <*> 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/