You gathered correct. Unfortunately, what I was trying to do was a sort of "runtime load" of an MXML component, which, in retrospect, I should have known wasn't possible.
I tried what you said verbatim, and it didn't work. However, I got the jist of what you were saying; what I did was to simply assign an xmlns to where my custom Panel innards are, and then load them all with a long list of tags, each with the name of the MXML file, and an id to match. The import isn't enough apparently, I need to actually instatiate them. Then, using your eval(resource) -- something I MUST thank you for, I would have lost a lot of time on that one -- I link the ComboBox selection to the component's id. It's ugly, and I can see it making my app huge (potentially, anyway) but there isn't much choice otherwise. As always, my humble thanks for all the help, everyone. This group is literally priceless. -Josh --- In flexcoders@yahoogroups.com, Scott Barnes <[EMAIL PROTECTED]> wrote: > Basically from what I can gather you are trying to load in an MXML > component based on a combo box's data attribute. > > This cannot be done unless that mxml component has been imported at > compile time. > > The reason for this is even though FLEX is a server-side "compiler" > once a MXML file has been processed, it basically disconnects from > FLEX server itself *much like html does to a web server*. Through > events like RemoteObject we can reconnect if need be but thats another > discussion. > > There is a way though. > > in your main mxml file (ie index.mxml) put an import statement, ie: > > <mx:Script> > import com.mossyblog.customviews.*; > > function loadMessageSpecificsPanel(event) { > var resource = event.target.selectedItem.data.resource; > var child = editMessageSpecificsPanel.createChild(eval(resource), > undefined, {label:'TEST', width:'100%', height:'100%'}); > } > </mx:Script> > > note the eval(resource). > > ? > > > On 7/7/05, cazzaran <[EMAIL PROTECTED]> wrote: > > I have a Panel in my application that needs to include different form > > stuff based on what a user chooses in a ComboBox. I have a Panel that > > looks like: > > > > <mx:Panel title="Message Specifics" width="100%" height="100%" > > id="editMessageSpecificsPanel"/> > > > > Based on the selection they choose in the ComboBox, I need what shows > > up in the Panel to change. I have created several MXML files that have > > an HBox that lays out what the Panel's internals need to look like. > > One very simple one looks like: > > > > <mx:HBox width="100%" xmlns:mx="http://www.macromedia.com/2003/mxml"> > > <mx:Form width="100%" marginTop="5" marginBottom="0"> > > <mx:FormItem label="Text"> > > <mx:TextArea id="messageText" text="" width="250" > > height="80" enabled="false" editable="true" /> > > </mx:FormItem> > > </mx:Form> > > </mx:HBox> > > > > I call, upon the change event on the ComboBox. It contains a bunch of > > objects, with the property "resource" containing the name of the MXML > > file I need to include: > > > > private function loadMessageSpecificsPanel(event) { > > var resource = event.target.selectedItem.data.resource; // Get the > > name of the MXML file we need > > var child = editMessageSpecificsPanel.createChild(resource, > > undefined, {label:'TEST', width:'100%', height:'100%'}); > > } > > > > This isn't working though. Even though child IS getting populated with > > something, it's not correct, doesn't have any of the variables I > > specified in the included MXML, and the Panel in the UI is still blank. > > > > Any help is MUCH appreciated! > > > > -Josh Oransky > > > > > > > > > > -- > > 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 > > > > > > > > > > > > > > > > > -- > Regards, > Scott Barnes > http://www.mossyblog.com -- 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/