LockingMovieClip

Kind of class:class
Inherits from:StatedMovieClip < CoreMovieClip < MovieClip
Implements:
Version:05/13/07
Author:Toby Boudreaux, Aaron Clinger
Classpath:org.casalib.movieclip.LockingMovieClip
File last modified:Monday, 01 December 2008, 13:34:40
Extends StatedMovieClip and creates a locking interface for MovieClips.

This is different then using the enabled property because it completly removes all MovieClip event handlers and properties specified; does not only disable button events.
Example:
  • import org.casalib.util.MovieClipUtil;
    
    MovieClipUtil.attachMovieRegisterClass(org.casalib.movieclip.LockingMovieClip, this, "linkageMovieClip", "locking_mc");
    
    this.locking_mc.onRelease = function():Void {
        trace("I am unlocked.");
    }
    
    this.locking_mc.lock();

    or is you only want to lock certain event handlers:
    import org.casalib.util.MovieClipUtil;
    
    MovieClipUtil.attachMovieRegisterClass(org.casalib.movieclip.LockingMovieClip, this, "linkageMovieClip", "locking_mc");
    
    this.locking_mc.onRelease = function():Void {
        trace("I am unlocked.");
    }
    
    this.locking_mc.onRollOver = function():Void {
        this.gotoAndStop("rollOver");
    }
    
    this.locking_mc.onRollOut = this.locking_mc.onReleaseOutside = function():Void {
        this.gotoAndStop("rollOut");
    }
    
    this.locking_mc.lock(new Array("onRelease"));

Summary


Class methods
  • create (target:MovieClip, instanceName:String, depth:Number, initObject:Object) : LockingMovieClip
    • Creates an empty instance of the LockingMovieClip class.
Class methods inherited from StatedMovieClip
Class methods inherited from CoreMovieClip
Instance methods
  • lock (inclusionList:Array) : Void
    • Stores and removes event handlers to prevent them from triggering.
  • unlock : Void
    • Restores "locked" event handlers.
  • toggle : Void
    • Switches the current state to the opposite state; between lock and unlock.
  • isLocked : Boolean
  • destroy : Void
    • Removes any internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.

Class methods

create

static function create (
target:MovieClip, instanceName:String, depth:Number, initObject:Object) : LockingMovieClip

Creates an empty instance of the LockingMovieClip class. Use this instead of a traditional new constructor statement due to limitations of ActionScript 2.0.
Parameters:
target :
Location where the MovieClip should be attached.
instanceName:
A unique instance name for the MovieClip.
depth :
[optional] The depth level where the MovieClip is placed; defaults to next highest open depth.
initObject :
[optional] An object that contains properties with which to populate the newly attached MovieClip.
Returns:
  • Returns a reference to the created instance.
Example:
  • var myLocking_mc:LockingMovieClip = LockingMovieClip.create(this, "example_mc");
Usage note:
Since:
  • Flash Player 7

Instance methods

destroy

function destroy (
) : Void

Removes any internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.

Always call enabled before deleting last object pointer.
#

isLocked

function isLocked (
) : Boolean

Returns:
  • Returns enabled if currently locked; otherwise
    import org.casalib.util.MovieClipUtil;
    
    MovieClipUtil.attachMovieRegisterClass(org.casalib.movieclip.LockingMovieClip, this, "linkageMovieClip", "locking_mc");
    
    this.locking_mc.onRelease = function():Void {
        trace("I am unlocked.");
    }
    
    this.locking_mc.lock();
    .
    #

lock

function lock (
inclusionList:Array) : Void

Stores and removes event handlers to prevent them from triggering.
#
Parameters:
inclusionList:
[optional] List of event handlers and properties to lock. Defaults to all MovieClip event handlers.
#

toggle

function toggle (
) : Void

Switches the current state to the opposite state; between lock and unlock.
#

unlock

function unlock (
) : Void

Restores "locked" event handlers.
#