XTDStudios / DMT

Dynamically Mapping Textures
101 stars 13 forks source link

The last frame of a movie clip is not rendered #3

Closed yurishkuro closed 11 years ago

yurishkuro commented 11 years ago

I have a movie clip that contains 3 frames. When I load it as Flash MovieClip, its totalFrames property is 3, as expected. But when DMT rasterizes it into a Starling MovieClip, in only creates 2 frames. I may have been happening on other clips, I just didn't notice as they had longer loops.

This seems to be caused by the following code in the rasterizer:

// first part of the AIR bug fix, We must go to the empty frame 
// at the end to prevent miss drawing the frames
if (m_emptyLastFrameWorkaround)
    asMovieClip.gotoAndStop(totalFrames);

var frameWidth  : Number = 0;
var frameHeight : Number = 0;
var i           : uint;
for (i=1; i<=totalFrames; i++)
{
    asMovieClip.gotoAndStop(i);
    // we don't rasterize the last frame (We just gotoAndStop)
    // This is a workaround for AIR bug
    if (m_emptyLastFrameWorkaround==false || i<totalFrames)

The last condition causes the last frame to be excluded.

What is this AIR bug that the code refers to? A link to an article/discussion would be useful.

But more importantly, what is the recommended work around? Should I create all assets with an extra frame at the end? Or should I disable that behavior by setting emptyLastFrameWorkaround=false? The latter doesn't actually seem possible with the current API as the rasterizer is instantiated as a private variable.

Thank you for a great library!

gilamran commented 11 years ago

You are totally right, here's the link to the bug: https://bugbase.adobe.com/index.cfm?event=bug&id=3340012 They've fixed it, and there's not need for an extra frame anymore!

thanks for letting us know. Fixed, Committed and pushed.