Hello,
I'm trying to put an animated PNG dynamically from external .js file. First I found a simple animated png solution, which draws an animation wherever you put the code within <script>
tags, but now it looks like I don't know how to call the function properly from external file.
The script is from AnimatedPNG, and it looks something like this:
<script type="text/javascript" src="animatedpng.js"></script>
<div id="pnganim" align="center">
<script>
fishAnim = new AnimatedPNG('fish', 't01.png', 3, 100);
fishAnim.draw(false);
</script>
</div>
Now, I'm trying to call this from external.js file and jQuery:
function addFish(){
$('#pnganim').html('<script type="text/javascript" src="animatedpng.js" />');
fishAnim = new AnimatedPNG('fish', 'fish01.png', 3, 100);
myFish = fishAnim.draw(false);
$('#pnganim').append(myFish);
}
... and it's not working. After I click a button that calls the addFish function, it opens only the first frame on a blank page.
What am I doing wrong here?
Thanks