Skip to main content
Participating Frequently
September 4, 2007
Question

Movieclip onRelease

  • September 4, 2007
  • 6 replies
  • 414 views
Hi everyone

my problim is:

I change my cursor with othe movielip and i want, when i rollOver to movieclip wich one has function release, my cursors's movieclip make something.
How to catch wich movieclip has onRelease function?

Thanks
This topic has been closed for replies.

6 replies

OS_DesignAuthor
Participating Frequently
September 4, 2007
You don't understand...

I want to change my cursor if the mc has release function.
When i make rollOver on mc i want to read from mc if it has onRelease function.
Tell me if you know how can i get a list of functions assigned on mc?
clbeech
Inspiring
September 5, 2007
OK, got it now. you can use the Object.hasOwnProperty();

in the cursor, run a check like this:

clbeech
Inspiring
September 4, 2007
if you wanted to add this function to all MCs you could do something like that, maybe, not sure if you can prototype an 'on' handler. But doing it with a prototype you would still need to add the prototype call to each MC/button. However, if all the MC/buttons are within another MC you could do something like this (where MC is the name of the 'master' container):

for(var name in MC) {
if(typeof (MC[name]) == 'movieclip') {
MC[name].onRollOver = function() {
//the cursor change code here and other functions
}
}
}

you can use 'this' instead of 'MC' but it would apply to all MCs throughout the doc.
OS_DesignAuthor
Participating Frequently
September 4, 2007
no i don't want like this because maybe i have 200 movieclip, than i must write in each rollOver to change my cursor's movieclip.

one way is to get on rollOver rolled movieclip assegned functions, but i dont know how.
Movieclip.prototype.onRollOver = function(){
here to get this.(function's list)
}
clbeech
Inspiring
September 4, 2007
that's what this file is doing. You'll have to specify in the onRollOver of a button that has an onRelease event, to tell the cursor to change. You'll just need to add the call to the cursor to the buttons you want this to happen on.

PS. I didn't add an onRelease call tot he big red dot on the Stage, but it is a button and could have that handler applied to it.
clbeech
Inspiring
September 4, 2007
It's not quite clear what you want ot have happen, but if you're saying that when you hover over a MC that can be clicked you want to change the MC of the cursor, then you would need to add another handler to the buttons/MCs that have an onRelease function.

use an 'onRollOver' handler to 'tell' the cursor that this is happening. Here's an example: FILE
OS_DesignAuthor
Participating Frequently
September 4, 2007
Thanks clbeech but i don't want this,

In my scene i have f.e. 10 movieclips, some of them has onRollOver and onRollOut functions some of them has onRelease too. when i roll over the movieclip which has onRelease function than i want to cursor's movieclip do somethink.
OS_DesignAuthor
Participating Frequently
September 4, 2007
Can enyone help me