Skip to main content
Known Participant
May 23, 2012
Question

How to add an object on mouse click?

  • May 23, 2012
  • 1 reply
  • 460 views

i am trying to add an object on user's mouse click...but not getting how?

can anyone help me?

This topic has been closed for replies.

1 reply

Inspiring
May 23, 2012

You could create the movieclip object and put it in the library with a linkage name, e.g. mcExample and then on the main _root. timeline add something like:

this.onMouseDown = function(){

mcExample = this.attachMovie("mcExample", "mcExample", 1);

}

This attaches the movieclip from the library onto the stage when the left mouse button is pressed. You can then manipulate the movieclip like any other using its identifier: mcExample. If you want to change the name of the attached movieclip then change the second parameter of attachMovie