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/