so a little while back i had the desire to animate .png files rather than .gif, simple enough in javascript, then i decided to take it one step further and add some methods and even events to make my animated image a kin to an actionscript movie clip object. it’s pretty basic so far and needs lots for testing done still, however it’s a pretty handy class even in it’s first beta form.
just the javascript class
my writings about the class, with link to download examples package
http://www.donovanh.com/main.php?page=blog/animated_img_js_intro.txt
shot list of methods;
*init() = Adds the container for the image timeline to the document, the starts the setInterval timer.
This method can only be called once and is called by default when this instantiated. The 6th paramater
in the construtor which is a boolean to toggle auto init() on(true) or off(false).
*play(goto:Number) = Tells the timeline to resume playing. You may pass 1 Number to this method to have the
time line start playing from that frame. This method does not change the direction of the time line, if
it was playing backward it will still paly backward.
*stop(goto:Number) = Stops the timeline. You may pass 1 Number to this method to have the time line stop on
a desired frame.
*reverse() = Changes the direction the timeline is moving.
*nextFrame() = Moves the timeline up one frame.
*prevFrame() = Movew the timeline back one frame.
*setEvent(type:String, f:Function) = Used to call functions when certain events trigger. Pass in the name of
the event type and the function you wish to call. There are currently 8 types of events:
1) mouseClick = applies an onclick event to the container object.
2) mouseOver = applies an onmouseover event to the container object.
3) mouseOut = applies an onmouseout event to the container object.
4) onFirstFrame = triggers a method every time the first frame of the animation is entered.
5) onLastFrame = triggers a method every time the last frame of the animation is entered.
6) onEnterFrame = triggers a method at the begining of every frame. This event type triggers before
both onFirstFrame and onLastFrame events.
on_enter_frame = f;
7) loadComplete = Triggers a method when all frames of an animation have been preloaded.
8) loadError = NOT SET. This event type is still being worked on.
*delete()