MovieClipUtil

Kind of class:class
Inherits from:none
Version:09/12/08
Author:Aaron Clinger@auther Mike Creighton
Classpath:org.casalib.util.MovieClipUtil
File last modified:Monday, 01 December 2008, 13:34:40
Provides utility functions for attaching and creating MovieClips.
Since:
  • Flash Player 7

Summary


Class methods
  • attachMovieRegisterClass (className:Function, target:MovieClip, linkageId:String, instanceName:String, depth:Number, initObject:Object) : MovieClip
    • Makes it easier to change or assign classes to library MovieClips without having to change the item's linkage AS 2.0 class settings in the Flash IDE environment.
  • createMovieRegisterClass (classPath:String, target:MovieClip, instanceName:String, depth:Number, initObject:Object) : MovieClip
    • Creates an empty subclassed MovieClip extended by a specified class without requiring an empty MovieClip in the Flash IDE library with a linkage identifier and AS 2.0 class specification.
  • createEmptyMovieClip (target:MovieClip, instanceName:String, depth:Number, initObject:Object) : MovieClip
    • Mimics the abilities of attachMovie by providing the option to pass an object that contains properties with which to populate the created MovieClip.
  • attachMovie (target:MovieClip, linkageId:String, instanceName:String, depth:Number, initObject:Object) : MovieClip
    • Mirrors the abilities of the MovieClip.attachMovie but defaults depth to the next highest open depth.

Class methods

attachMovie

static function attachMovie (
target:MovieClip, linkageId:String, instanceName:String, depth:Number, initObject:Object) : MovieClip

Mirrors the abilities of the MovieClip.attachMovie but defaults depth to the next highest open depth.
Parameters:
target :
Location where the MovieClip should be attached.
linkageId :
The linkage name of the MovieClip in the library.
instanceName:
[optional] A unique instance name for the MovieClip; defaults to linkageId.
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 MovieClip instance.
Example:
  • var myMc:MovieClip = MovieClipUtil.attachMovie(this, "libraryIdentifier", "myMovieClip_mc", 100, {_x:100, _alpha:75});

attachMovieRegisterClass

static function attachMovieRegisterClass (
className:Function, target:MovieClip, linkageId:String, instanceName:String, depth:Number, initObject:Object) : MovieClip

Makes it easier to change or assign classes to library MovieClips without having to change the item's linkage AS 2.0 class settings in the Flash IDE environment. An added benefit is that it allows multiple classes to use a single MovieClip in the library.
Parameters:
className :
The fully qualified name of a class you have defined in an external class file to extend the MovieClip instance.
target :
Location where the MovieClip should be attached.
linkageId :
The linkage name of the MovieClip in the library.
instanceName:
[optional] A unique instance name for the MovieClip; defaults to linkageId.
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 MovieClip instance.
Example:
  • import com.example.MyClass;
    
    var myMc:MyClass = MyClass(MovieClipUtil.attachMovieRegisterClass(MyClass, this, "libraryIdentifier", "myMovieClip_mc", 100, {_x:100, _alpha:75}));
Usage note:
  • Be sure to always cast the returned MovieClip reference as the class type to get error notifcation and a valid reference.

createEmptyMovieClip

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

Mimics the abilities of attachMovie by providing the option to pass an object that contains properties with which to populate the created MovieClip.
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 MovieClip instance.
Example:
  • var myMc:MovieClip = MovieClipUtil.createEmptyMovieClip(this, "myMovieClip_mc", 100, {_x:15, _alpha:70});

createMovieRegisterClass

static function createMovieRegisterClass (
classPath:String, target:MovieClip, instanceName:String, depth:Number, initObject:Object) : MovieClip

Creates an empty subclassed MovieClip extended by a specified class without requiring an empty MovieClip in the Flash IDE library with a linkage identifier and AS 2.0 class specification.
Parameters:
classPath :
The fully qualified name of a class you have defined in an external class file to extend the MovieClip instance.
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 within the target MovieClip.
initObject :
[optional] An object that contains properties with which to populate the newly attached MovieClip.
Returns:
  • Returns a reference to the created MovieClip subclass instance.
Example:
  • import com.example.MyClass;
    
    var myMc:MyClass = MyClass(MovieClipUtil.createMovieRegisterClass("com.example.MyClass", this, "myMovieClip_mc", 100, {_x:100, _alpha:75}));
Usage note:
  • Be sure to always cast the returned MovieClip reference as the class type to get error notifcation and a valid reference.