Skip to content

Commit

Permalink
增加帧事件机制
Browse files Browse the repository at this point in the history
  • Loading branch information
zmLiu committed Sep 3, 2014
1 parent a64bd4e commit 859327d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion StarlingFeathers/src/lzm/starling/swf/Swf.as
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ package lzm.starling.swf
displayObjects[objName] = displayObjectArray;
}

var mc:SwfMovieClip = new SwfMovieClip(movieClipData["frames"],movieClipData["labels"],displayObjects,this);
var mc:SwfMovieClip = new SwfMovieClip(movieClipData["frames"],movieClipData["labels"],displayObjects,this,movieClipData["frameEvents"]);
mc.loop = movieClipData["loop"];

if(data) mc.filter = SwfFilter.createFilter(data[10]);//滤镜
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package lzm.starling.swf.display

private var _frames:Array;
private var _labels:Array;
private var _frameEvents:Object;
private var _labelStrings:Array;
private var _displayObjects:Object;

Expand All @@ -38,12 +39,13 @@ package lzm.starling.swf.display

private var _autoUpdate:Boolean = true;

public function SwfMovieClip(frames:Array,labels:Array,displayObjects:Object,ownerSwf:Swf){
public function SwfMovieClip(frames:Array,labels:Array,displayObjects:Object,ownerSwf:Swf,frameEvents:Object = null){
super();

_frames = frames;
_labels = labels;
_displayObjects = displayObjects;
_frameEvents = frameEvents;

_startFrame = 0;
_endFrame = _frames.length - 1;
Expand Down Expand Up @@ -133,6 +135,10 @@ package lzm.starling.swf.display
}
}
}

if(_frameEvents != null && _frameEvents[_currentFrame] != null){
dispatchEventWith(_frameEvents[_currentFrame]);
}
}

public function get currentFrame():int{
Expand Down

0 comments on commit 859327d

Please sign in to comment.