I’m trying to do a dynamic bar graph like THIS.
I’m trying to conceptualize how I would go about doing this in Flash.
My first thought was to create a MovieClip with exacty 100 frames. The first frame would look like THIS, and the last frame would look like [URL=“http://img409.imageshack.us/img409/1158/frame2eg9.gif”]THIS.
Now, my idea is to do some Actionscript like this:
// Psuedo code (not an Actionscript guy yet...)
// The percentage comes from a value passed in by PHP
var percentage = 56%;
barMovieClip.play();
barMoveClip.stopAtFrame(56);
// Sorry for the horrible code. I hope you get the idea.
So me questions are:
-
How can I easily create this 100 frame movieclip with the bar filling up to the right as each frame goes by? (i.e. frame 56 would show the bar 56% filled in) I’ve tried to do a shape tween with no luck.
-
Once I have the movieclip, how can I tell it to play through and stop at the proper frame according the percentage I receive from the database?
Thanks for any help guys.