hi everyone
i have a movieclip named “mc” and i want to load many images in it and add on press event to those images.
For that, i have a button which is when click adds images to movieclip “mc”.
I created empty movie clip in “mc” and loaded that empty movie clip with images. But i m not able to attach on press event to that empty movie clip.
Here is my code:-
In button :-
on(press)
{
_root.fun();
}
In actions frame :-
_root.i = 1;
/*
var styleListener:Object = new Object();
styleListener.click = function(eventObj:Object) {
trace(“style click”);
};
*/
function fun()
{
if(_root.i < 9)
{
trace("buton clicked = " + _root.i);
for(var ii:Number = 1; ii < _root.i; ii++)
{
trace(_root.mc[“a” + ii]);
}
_root.mc.createEmptyMovieClip("a"+_root.i, _root.mc.getNextHighestDepth());
loadMovie("Images/"+_root.i+".png",_root.mc["a"+_root.i]);
_root.mc["a"+_root.i]._x = 30*_root.i;
_root.mc["a"+_root.i]._y = 30*_root.i;
//_root.mc["a"+_root.i].addEventListener("click", styleListener);
_root.mc["a"+_root.i].onPress = function()
{
trace("on press");
};
_root.i++;
}
}
I even tried to add listener to movie clip (commented portion in above code) but that also didnt work.
Please can somebody tell me where am i doing mistake.
Please…
I m attaching my file if anybody wants more information.
Thank you for helping.