Hi community
I am currently trying to set up a small piece of software in flash mx. Having experience in OOP / javascript, I stumble over some basic problems, but I think it’s not because of actionscript but because of my ignorance. Thus, any help is highly appreciated.
Here’s the simple problem.
Imagine some simple code like this:
// start code
this.createEmptyMovieClip(“firstClip”,1);
with (this.firstClip) {
beginFill(0x000000,100);
moveTo(10,10);
lineTo(10,50);
lineTo(50,50);
lineTo(50,10);
endFill();
}
this.firstClip.createEmptyMovieClip(“secondClip”,2);
with (this.firstClip.secondClip) {
beginFill(0x333333,100);
moveTo(20,20);
lineTo(20,170);
lineTo(170,170);
lineTo(170,20);
endFill();
}
this.firstClip.onPress = function() {
trace(“clicked first”);
}
this.firstClip.secondClip.onPress = function() {
trace(“clicked second”);
}
//end code
I would expect that If I click on the secondClip (in gray), the eventhandler on this clip would react and trace “clicked second”. However, I only get “clicked first”, even though I clicked on the second one.
How can I change this? I want the “clicked first” message to appear only when I clicked on the first clip, and the “clicked second” message only when I click on the second.
Attaching both of the clips on the root is not an option. Later, I want to make the the whole package of attached clips draggable, that’s why I attach one to the other.
Thanks a lot for your help!
sala