View comments | RSS feed

MovieClip.onRelease

Availability

Flash Player 6.

Usage

my_mc.onRelease = function() {
   // your statements here
}

Parameters

None.

Returns

Nothing.

Description

Event handler; invoked the mouse button is released over a movie clip. You must define a function that executes when the event handler is invoked. You can define the function on the Timeline or in a class file that extends the MovieClip class or is linked to a symbol in the library. For more information, see "Assigning a class to a movie clip symbol" in Using ActionScript in Flash.

Example

The following example defines a function for the onPress method that sends a trace() action to the Output panel:

logo_mc.onRelease = function() {
   trace("onRelease called");
};

Comments


No screen name said on Sep 13, 2004 at 6:33 AM :
Minor edits: Shoulds say "invoked WHEN the mouse button". Also,
under Example it says "onPress" when it should say "onRelease"
jamvt said on Sep 14, 2004 at 8:29 AM :
The following code works if it is inside a movie clip instance:
this.onRelease=function(){
trace("movie was clicked");
}

But if you place it on the _root timeline, it doesn't work. I am just curious as to why this is. Other event handlers work on the _root timeline, for example: onEnterFrame.

var x:Number=0;
this.onEnterFrame=function(){
x++;
trace("test "+x);
}
No screen name said on Nov 1, 2004 at 5:35 PM :
Hi guys!

I'm using this method to pass variables in mouse functions such as
onPress and onRelease.

var myMovie = _root.attacheMovie (...

myMovie["Data"] = this;

muMovie.onrelease = myOnReleaseFunction;

function myOnReleaseFunction () {

var localThis = this["Data"]["myMovie"]["Data"];

// In this case, localThis is the same as _root.this and it works fine and
classes

}
No screen name said on Nov 1, 2004 at 5:39 PM :
Hi guys!

I'm using this method to pass variables in mouse functions such as
onPress and onRelease.

var myMovie = _root.attacheMovie (...

myMovie["Data"] = this;

myMovie.onrelease = myOnReleaseFunction;

function myOnReleaseFunction () {

var localThis = this["Data"]["myMovie"]["Data"];

// In this case, localThis is the same as _root.this and it works fine and
classes

}

Kemper
helmutkemper@yahoo.com
No screen name said on Jun 23, 2005 at 1:08 PM :
I have a class that creates a movieclip on the main timeline. Id like the class to deal with the onRelease event but cant get it to call the function inside the class like i can with components.

myMovieClip.onRelease = dosomething;

i know its trying to make the call to the function on the _root, how can i get it to make the class functions

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001539.html