forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathremoveFrameScript.as
More file actions
24 lines (20 loc) · 816 Bytes
/
removeFrameScript.as
File metadata and controls
24 lines (20 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package utils.frame
{
import flash.display.MovieClip;
/**
Removes a frame from triggering/calling a function when reached.
@param target: The MovieClip that contains the <code>frame</code>.
@param frame: The frame to remove notification from. Can either be a frame number (<code>uint</code>), or the frame label (<code>String</code>).
@throws ArguementTypeError if you pass a type other than a <code>String</code> or <code>uint</code> to parameter <code>frame</code>.
*/
public function removeFrameScript(target:MovieClip, frame:*):void
{
if (frame is String)
frame = getFrameNumberForLabel(target, frame);
else if (!(frame is uint))
throw new Error('frame');
if (frame == -1 || frame == 0 || frame > target.totalFrames)
return;
target.addFrameScript(frame - 1, null);
}
}