Isaac, If you don't mind, post your code and I am sure that we can help figure out the problem.
In the mean time, have you tried using HTTPService for your needs? Jeff http://www.flexauthority.com ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, February 07, 2005 12:07 AM Subject: Re: [flexcoders] Dynamic model Jeff, Yes, the filename changes. It depends on the user selection(obviuosly at runtime). Just I want to load the specified XML at runtime. Avoid to load all the possible XML�s in the startup. Thanks for your help Isaac Bib�s Forado "Jeff Steiner" <[EMAIL PROTECTED] Para: <[email protected]> ty.com> cc: Asunto: Re: [flexcoders] Dynamic model 04/02/2005 18:14 Por favor, responda a flexcoders Isaac, Are we to understand that the XML filename changes and that you are trying to compile the result into the swf at compile time, or are you, for example, passing a querystring variable to a dynamic page which results in dynamic XML? mx:Model and mx:XML tags grab the XML at compile time and store it in the compiled swf. mx:HTTPService does not store the actual file but rather stores a url that the swf uses at runtime to grab xml dynamically. Does that answer your question? Jeff http://www.flexauthority.com ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, February 04, 2005 4:17 AM Subject: RE: [flexcoders] Dynamic model Thanks Abdul, but I think I�ve not explained my problem correctly. As the XML name is dynamic, I need to create the Model at runtime. In other words, I know the XML name in the moment the .mxml page is built , I cannot declare the Model as you suggest. me. Any thoughts? Isaac Bib�s Abdul Qabiz <[EMAIL PROTECTED] Para: [email protected] a.com> cc: Asunto: RE: [flexcoders] Dynamic model 04/02/2005 12:19 Por favor, responda a flexcoders Hi, You can't use Model to load XML on runtime. It works at compile time... However, you can use HTTPService object to load xml dynamically at runtime. Please search the flexcoders archive, this question has been discussed recently.. Also check out Flex documentation for HTTPService. I answered something similar last month, following is the code. Might help you.. ##app.mxml## <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" creationComplete="setOptions()"> <mx:Model id="optionsXMLModel" source="options.xml"/> <mx:Script> <![CDATA[ import mx.utils.ArrayUtil; var optionsDP; function setOptions() { /* List controls like, List, ComboBox, etc can't use XML object as their model(dataProvider)... So we are using ArrayUtil.toUtil(..) utility function to covert a XML object to an Array of Objects. */ optionsDP = ArrayUtil.toArray(optionsXMLModel.option); _cb2.dataProvider = optionsDP; } function onComboChange(eventObj) { alert(eventObj.target.selectedItem.data); } ]]> </mx:Script> <mx:HBox backgroundColor="#CCCCCC"> <mx:Label fontSize="15" text="ComboBox populated from XML using DataBinding"/> </mx:HBox> <mx:ComboBox id="_cb1" dataProvider="{ArrayUtil.toArray(optionsXMLModel.option)}" change="onComboChange(event);"/> <mx:Spacer height="10%"/> <mx:HBox backgroundColor="#CCCCCC"> <mx:Label fontSize="15" text="ComboBox populated from XML using ActionScript" /> </mx:HBox> <mx:ComboBox id="_cb2" change="onComboChange(event);"/> </mx:Application> ###data.xml### <?xml version="1.0" encoding="utf-8"?> <options> <option label="A-ADD" data="A"/> <option label="C-COPY" data="C"/> </options> -abdul -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 3:03 PM To: [email protected] Subject: [flexcoders] Dynamic model Hi coders, I intend to create a generic screen containing a comboBox its content depends on externalized parameter specifying a XML file. I�ve tried unsuccessfully the following: <mx:Model id="fieldList" source="{the_XML_path}"/> In a AS function: myModel:Model = new Model(); myModel.source=the_XML_path; Anybody knows how to create model dynamically? Thanks in advance for your help. Isaac Bib�s Yahoo! Groups Links 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 the Yahoo! Terms of Service. Yahoo! Groups Links 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 the Yahoo! Terms of Service. Yahoo! Groups Links

