Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're not exactly clear in your question, so I'll answer in two ways:</p> <p><strong>1. You need to have an external MXML</strong></p> <p>In this case, you need to compile the XML file with mxmlc.exe (or just rename it to .mxml and include it in Flex Builder) and use the SWFLoader component to access the file. I don't have a lot of experience with SWFLoader, so I'll leave it up to you to look it up.</p> <p><strong>2. You need to set the properties of the components through an external XML</strong></p> <p>Create a HTTPService, assign an ID to it, and use the url property to point it to your XML file. Do not assign a result format. Then, use the result event and point to a function that will execute when your XML is done loading. It should look like this:</p> <pre><code>&lt;mx:HTTPService id="service" url="myXml.xml" result="Foo (event)" /&gt; </code></pre> <p>Lets say myXml looks like this:</p> <pre><code>&lt;properties&gt; &lt;button1Enabled&gt;false&lt;/button1Enabled&gt; &lt;button2Visible&gt;true&lt;/button2Visible&gt; &lt;button3Text&gt;"TEXT"&lt;/button3Text&gt; &lt;/properties&gt; </code></pre> <p>This is what your function Foo should look like. It will be executed when the HTTPServices finishes loading myXml.xml.</p> <pre><code>private function Foo (e : ResultEvent) : void { myButton.enabled = e.result.properties.button1Enabled; // false myOtherButton.visible = e.result.properties.button2Visible; // true myLastButton.label = e.result.button3Text; // "TEXT" } </code></pre> <p>This function gets the result of service and assigns various buttons some properties as defined in the XML. Alternatively, you can also use service.lastResult to access the most recent result from anywhere in the script.</p> <p>Hope this helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload