Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > MovieClip > attachMovie (MovieClip.attachMovie method) | |||
public attachMovie(id:String, name:String, depth:Number, [initObject:Object]) : MovieClip
Takes a symbol from the library and attaches it to the movie clip. Use MovieClip.removeMovieClip() or MovieClip.unloadMovie() to remove a SWF file attached with attachMovie() method.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Availability: ActionScript 1.0; Flash Player 5
id:String - The linkage name of the movie clip symbol in the library to attach to a movie clip on the Stage. This is the name that you enter in the Identifier field in the Linkage Properties dialog box.
name:String - A unique instance name for the movie clip being attached to the movie clip.
depth:Number - An integer specifying the depth level where the SWF file is placed.
initObject:Object [optional] - (Supported for Flash Player 6 and later) An object that contains properties with which to populate the newly attached movie clip. This parameter allows dynamically created movie clips to receive clip parameters. If initObject is not an object, it is ignored. All properties of initObject are copied into the new instance. The properties specified with initObject are available to the constructor function.
MovieClip - A reference to the newly created instance.
The following example attaches the symbol with the linkage identifier circle to the movie clip instance, which is on the Stage in the SWF file:
this.attachMovie("circle", "circle1_mc", this.getNextHighestDepth());
this.attachMovie("circle", "circle2_mc", this.getNextHighestDepth(), {_x:100, _y:100});
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method.
removeMovieClip (MovieClip.removeMovieClip method), unloadMovie (MovieClip.unloadMovie method), removeMovieClip function
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00002440.html
Comments
McUsher said on Nov 23, 2005 at 9:48 AM : No screen name said on Nov 23, 2005 at 7:58 PM : Sim-Enzo said on Jan 1, 2006 at 3:09 PM : No screen name said on Feb 18, 2006 at 4:33 PM : No screen name said on Mar 30, 2006 at 6:37 PM : rob.snider said on Apr 5, 2006 at 11:36 AM : reinier77 said on Apr 11, 2006 at 6:58 AM : No screen name said on Oct 17, 2006 at 6:29 AM : No screen name said on Nov 19, 2006 at 5:06 PM : No screen name said on Dec 12, 2006 at 5:56 AM : No screen name said on Jan 3, 2007 at 12:38 AM : bcraigie said on Feb 8, 2007 at 5:42 AM : nads said on Feb 15, 2007 at 5:57 AM : No screen name said on Apr 3, 2007 at 12:33 PM : maestudios said on Apr 16, 2007 at 11:13 AM : No screen name said on Apr 17, 2007 at 8:32 PM : Max Damage said on Apr 19, 2007 at 2:17 PM : Asianeklipse said on Apr 23, 2007 at 5:06 PM : Max Damage said on Apr 26, 2007 at 11:56 PM : No screen name said on Apr 29, 2007 at 12:08 PM : Bhupi_99000 said on Jun 13, 2008 at 4:32 AM :