Skip to main content
Participating Frequently
June 6, 2012
Answered

How to detect when 2 movie clips have been clicked?

  • June 6, 2012
  • 1 reply
  • 907 views

Hello:

I'd like to know how can I detect when 2 movie clips have been clicked (irregardles of the order).

What I have is this:

In my main timeline I have 2 independent movie clips (mc_him and mc_her) each in it's own layer that, when clicked, play an internal animation without moving my main playhead anywhere. What I need to do is, once they are both clicked (as I said, it doesen't matter in what order), a button that sends me to another section of my movie has to appear. It really doesen't matter if the button shows by enabling it with alpha or by sending me to a specific frame where my button lies. What I need to detect is both clicks so that the button shows up.

How can I achieve this?

Thank you very much.

This topic has been closed for replies.
Correct answer kglad

btn1.onRelease=function(){

// do whatever

this.clicked = true;

checkBothClickedF();

}

btn2.onRelease=function(){

// do whatever

this.clicked = true;

checkBothClickedF();

}

function checkBothClickedF():Void{

if(btn1.clicked&&btn2.clicked){

// do something. both clicked

// reset both clicked properties?

}

}

1 reply

kglad
Community Expert
Community Expert
June 6, 2012

for 2 objects it's easiest to use brute force.  assign each a property that has a boolean value of true when clicked.  when each is clicked call a function that checks if both properties are true.

Participating Frequently
June 6, 2012

Thank you very much for your time kglad. The thing is, although I've been learning some very basic AS, I'm a designer and I don't know how to do what you told me. I understand the logic of your post, but it's the "how" that I don't know. Would it be possible for you to further help me with this of point me to a tutorial?

Thanks again.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 6, 2012

btn1.onRelease=function(){

// do whatever

this.clicked = true;

checkBothClickedF();

}

btn2.onRelease=function(){

// do whatever

this.clicked = true;

checkBothClickedF();

}

function checkBothClickedF():Void{

if(btn1.clicked&&btn2.clicked){

// do something. both clicked

// reset both clicked properties?

}

}