We can't actually share a MultiFrameBitmap across characters since it's a displayobject and can only be in the display tree once. So, let's clone it.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@988 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -88,12 +88,12 @@ public class CompositedActionFrames
|
|||||||
createFrames(orient, function(disp :MultiFrameBitmap) :void {
|
createFrames(orient, function(disp :MultiFrameBitmap) :void {
|
||||||
_frameCache.put(key, disp);
|
_frameCache.put(key, disp);
|
||||||
for each (var func :Function in listeners) {
|
for each (var func :Function in listeners) {
|
||||||
func(disp);
|
func(disp.clone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(disp);
|
callback(disp.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class MultiFrameBitmap extends Sprite
|
|||||||
{
|
{
|
||||||
_frames = frames;
|
_frames = frames;
|
||||||
_bitmap = new Bitmap();
|
_bitmap = new Bitmap();
|
||||||
|
_fps = fps;
|
||||||
_frameRate = fps / 1000.0;
|
_frameRate = fps / 1000.0;
|
||||||
addChild(_bitmap);
|
addChild(_bitmap);
|
||||||
setFrame(0);
|
setFrame(0);
|
||||||
@@ -90,6 +91,11 @@ public class MultiFrameBitmap extends Sprite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clone () :MultiFrameBitmap
|
||||||
|
{
|
||||||
|
return new MultiFrameBitmap(_frames, _fps);
|
||||||
|
}
|
||||||
|
|
||||||
protected var _frames :Array;
|
protected var _frames :Array;
|
||||||
|
|
||||||
protected var _bitmap :Bitmap;
|
protected var _bitmap :Bitmap;
|
||||||
@@ -98,6 +104,8 @@ public class MultiFrameBitmap extends Sprite
|
|||||||
|
|
||||||
protected var _frameRate :Number;
|
protected var _frameRate :Number;
|
||||||
|
|
||||||
|
protected var _fps :Number;
|
||||||
|
|
||||||
protected var _curFrameIndex :int = -1;
|
protected var _curFrameIndex :int = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user