Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting a rollover on a movieclip 1

Status
Not open for further replies.

carmenMiranda

Programmer
May 22, 2003
47
GB
I have a stage with a variable number of variably-named movieclips (ie: the number and instance names are generated dynamically).

If any one of these movieclips is rolled over, how would I then pass the instance name of the rolled over clip to a function?

I can do it no problem if the instance names are hard-coded in at the start, but that's not the approach I want to take.

Thanks for any advice.
 
Code:
// AS2 main timeline
var someMovieClip:MovieClip = this.attachMovie("mcSomeMC", "mcDynamicallyCreatedMC", 1);
someMovieClip.onRollOver = function():Void  {
	someFunction(this._name);
};
function someFunction(mcName:String):Void {
	trace("mcName: "+mcName);
}
//Output
mcName: mcDynamicallyCreatedMC

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top