Hello,
probably another noob-mistake. I want to create a button
on-the-fly with actionscript. The following code works.
I create a movieclip, draw a black rectangle and add an
onPress listener to it.
_root.createEmptyMovieClip( "arrow_up", this.getNextHighestDepth());
arrow_up.beginFill(0x000000, 100);
arrow_up.moveTo(0, 0);
arrow_up.lineTo(70, 0);
arrow_up.lineTo(70, 51);
arrow_up.lineTo(0, 51);
arrow_up.lineTo(0, 0);
arrow_up.endFill();
_root.arrow_up._x = 400;
_root.arrow_up._y = 283;
_root.arrow_up.onPress = function() {
trace ("pressed");
}
What I do not understand is why the following code
does not work. I load a JPG instead of drawing some-
thing - but then the onPress event does not work
anymore.
_root.createEmptyMovieClip( "arrow_up", this.getNextHighestDepth());
_root.arrow_up.loadMovie( "img/wdp_arrow_up.jpg" );
_root.arrow_up._x = 400;
_root.arrow_up._y = 283;
_root.arrow_up.onPress = function() {
trace ("pressed");
}
Anyone any ideas or explanations ???
Cheers,Mr E