Hi all,
I am trying to do something that I Is there a way to assign a onPress handler to a movieclip which is created dynamically (ie on a buttonpress)?
I have a small mc symbol (let's call it HR - for Heart Rate). When the user clicks on the mc, it creates a new instance (either with duplicateMovieClip or attachMovieClip), and is draggable. The user moves over to the area that they want it to go and click the mouse again. Now it's set.
They repeat the process.
Now, they realize that they really wanted the first one to be somewhere else, so they click on it, it becomes draggable again, they move to where they want it, then click to place it there.
Now... the problem... I can't seem to make this happen. :(
I can dynamically create the new mc's just fine, but can't seem to attach any kind of handler to them. I can't 'pick them up again' to allow modification of their position.
I think that part of the problem is that I can't seem to create a handler for a mc instance that isn't created IMMEDATELY at runtime...
for example:
_root.attachMovie("LinkResp", "newclip_mc", 10);
newclip_mc.onPress = function () {
trace('clicked the newclip');
}
Works just fine...
But i want to be able to control movieclips that I add DURING the movie...
myButton.onPress = function() {
_root.attachMovie("LinkResp", "newclip_mc", 10);
}
newclip_mc.onPress = function () {
trace('clicked the newclip');
}
Doesn't do squat. Any ideas?