dynamic script loading synchronization
<p>I have a script that knows to load dynamiclly scripts that contains javascript classes.
i'm loading the class script using the following code:</p>

<pre><code>var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "myscript.js";
head.appendChild(script);
</code></pre>

<p>i'm then trying to create the new class using eval:</p>

<pre><code>var classObj = eval(" new MyClass()" );
</code></pre>

<p>the problem is that the code of the eval is being executed bofre the script has been loaded into memory and i get an error that the <code>MyClass is undefined.</code> </p>

<p>Is there a way to synch these events? i need to make sure the script is fully being loaded into memory before i can start allocating classes from it.</p>
