snipt

Ctrl+h for KB shortcuts

ActionScript 3

XMLLoader

import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;

_loader = new XMLLoader("kata-data.xml",{name:"kataData",requireWithRoot:this.root,estimatedBytes:2000});
_loader.addEventListener(LoaderEvent.COMPLETE, onComplete);
_loader.load();

function onComplete(le:LoaderEvent):void
{
      trace(le.target.content);
}
https://snipt.net/embed/127b426db207cbd4ab35ecba67fa5fbe/
/raw/127b426db207cbd4ab35ecba67fa5fbe/
127b426db207cbd4ab35ecba67fa5fbe
as3
ActionScript 3
14
2019-07-19T03:44:10
True
False
False
/api/public/snipt/20311/
xmlloader
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">import</span> <span class="nn">com.greensock.loading.</span><span class="o">*;</span> </span><span id="L-2"><a name="L-2"></a><span class="k">import</span> <span class="nn">com.greensock.events.LoaderEvent</span><span class="o">;</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="n">_loader</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">XMLLoader</span><span class="o">(</span><span class="s2">&quot;kata-data.xml&quot;</span><span class="o">,{</span><span class="n">name</span><span class="o">:</span><span class="s2">&quot;kataData&quot;</span><span class="o">,</span><span class="n">requireWithRoot</span><span class="o">:</span><span class="k">this</span><span class="o">.</span><span class="na">root</span><span class="o">,</span><span class="n">estimatedBytes</span><span class="o">:</span><span class="mi">2000</span><span class="o">});</span> </span><span id="L-5"><a name="L-5"></a><span class="n">_loader</span><span class="o">.</span><span class="na">addEventListener</span><span class="o">(</span><span class="n">LoaderEvent</span><span class="o">.</span><span class="na">COMPLETE</span><span class="o">,</span> <span class="n">onComplete</span><span class="o">);</span> </span><span id="L-6"><a name="L-6"></a><span class="n">_loader</span><span class="o">.</span><span class="na">load</span><span class="o">();</span> </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="kd">function </span><span class="nf">onComplete</span><span class="o">(</span><span class="n">le</span><span class="o">:</span><span class="kt">LoaderEvent</span><span class="o">):</span><span class="kt">void</span> </span><span id="L-9"><a name="L-9"></a><span class="o">{</span> </span><span id="L-10"><a name="L-10"></a> <span class="nf">trace</span><span class="o">(</span><span class="n">le</span><span class="o">.</span><span class="na">target</span><span class="o">.</span><span class="na">content</span><span class="o">);</span> </span><span id="L-11"><a name="L-11"></a><span class="o">}</span> </span></pre></div> </td></tr></table>
as3, greensock, loading, xml