xames3 wrote:Guys thanks for your help it is working though but the animation doesn't stops on last frame. I want the animation to run once every refresh/loading and the last frame should stay in place.
Also can some please explain the executions of the above code? That would be helpful for me to learn and understand future codes even better.
Thanks in advance!

And just replace the dummy String meter I have with your Bitmap meter, it should work.

What it is doing is:

1) The skins starts with the Loop measure [MeasureCount] "paused". That means it will have its initial value "1", but won't update any further while it is paused. It also has UpdateDivider=-1, which means that even once it is unpaused, it will only update once and stop.

2) Then when the skin is loaded or refreshed, the OnRefreshAction will fire the ActionTimer measure [MeasureAction].

3) That measure will do the following:

a) Unpause the Loop measure.

b) Force an update to the Loop measure, then update the meter and redraw the skin. That will cause the meter to use the value of the Loop measure as the "frame" of the Bitmap. Repeat that 135 times, with a "wait" of 16ms between each time.

c) Pause the Loop measure again, so it will stay at the "last" value it has.

So when the skin is loaded or refreshed, it will count from 1 to 135 at 16ms intervals, and force the frame of the bitmap to that number. Then it will leave that last bitmap frame in place, and just sorta idle at an Update of 1000. I don't know what if anything else you might have the skin doing, but unless you also need them to update faster than once a second, there is no benefit to using resources to drive this one-time animation.

Your problem isn't the measures or the "counting" or any of that, it some fundamental misunderstanding with how a Bitmap meter works, and what kind of BitmapImage is needed.

What the meter does is take the image you provide, and divides it into equal sections based on the value you set in BitmapFrames.

So if you wanted a two-frame bitmap, and wanted it to be 100 pixels in size, you create an image file, .png or whatever, that is exactly 200 pixels wide, and set BitmapFrames to 2.

Then when the value of the measure that is driving the Bitmap meter is "1", it will display the first 1 to 100 pixels of the width of the image. When the value is "2", it will display the width from 101 to 200.