actionscript 3 - ENTER_FRAME event idle occurrence or was gotoAndPlay called? -
i have mc frame labels jumped through. currently, can detect when starts new label, want able restart actions should current label called gotoandplay() without enter_frame calling 30 times per second. idea how filter out?
private function onnewframe(e:event) { if(e.target.currentlabel != _currentlabel) { // started new label (working) trace("new label: "+ e.target.currentlabel); }else if(e.target.currentframe == _currentframe && e.target.isplaying) { // repeated frame (doesn't work) trace("repeated label: "+ e.target.currentframe); } _currentframe = e.target.currentframe; _currentlabel = e.target.currentlabel; }
as far understand, need know next 2 things: 1). when movieclip advances next frame new frame label; 2). when next frame has same label previous.
first of movieclip doesn't has "isplaying" property. sounds unrealistic, there no built-in method check whether mc playing. e.target.isplaying return false; therefore second "if" statement return false.
also don't need "isplaying" check @ because movieclip dispatches event.enter_frame when plays.
so work:
var testmc:testmc = new testmc(); testmc.addeventlistener(event.enter_frame, onnewframe); testmc.play(); private function onnewframe(e:event):void { if (e.target.currentlabel != _currentlabel) { // started new label (working) trace("new label: " + e.target.currentlabel); } else if (e.target.currentframe !== _currentframe) { // started frame same label trace("new frame same label: " + e.target.currentframe); } _currentframe = e.target.currentframe; _currentlabel = e.target.currentlabel; }
but maybe didn't understand question?
Comments
Post a Comment