# Movie clip as button problem with currentTarget

**URL:** <https://forum.kirupa.com/t/movie-clip-as-button-problem-with-currenttarget/296207>\
**Category:** flash\
**Created:** [September 10, 2009, 8:49pm UTC](https://forum.kirupa.com/t/movie-clip-as-button-problem-with-currenttarget/296207 "2009-09-10T20:49:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theptsman](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@theptsman](https://forum.kirupa.com/u/theptsman)\
**Post date:** [September 10, 2009, 8:49pm UTC](https://forum.kirupa.com/t/movie-clip-as-button-problem-with-currenttarget/296207/1 "2009-09-10T20:49:35Z")

</div>

[SIZE=2]Hi,

Thanks to IqAndreas I have cleaned up and tried this code.

Sadly he has no more input for me I hope someone can take a look at this simplified

version and see why its not playing the MC’s on click like it looks like it should.

Note : Sign1movie and Sign1button are both 2 seperate movie clips that are acting like  
buttons they are only there because the signmovie’s are all overlapping for effect  
and the signbutton’s are on a single seperate layer as transparent hit points.  
So sadly they have to be there…

Below is the code I currently have in my Signs ( scene ) I have 9 other scenes with  
other listners once I solve this riddle I can use this in the other 5 for now 4 are going  
to be much simpler.

Section below labeled “this is where the problem lies” in red.

* * *

import flash.display.MovieClip;  
import flash.events.MouseEvent;

var currentSign:MovieClip = null;

// Sign1movie Button Listeners

sign1movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign1movie.buttonMode = true;  
sign1movie.useHandCursor = true;  
sign1button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign1button.buttonMode = true;  
sign1button.useHandCursor = true;

// Sign2movie Button Listeners

sign2movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign2movie.buttonMode = true;  
sign2movie.useHandCursor = true;  
sign2button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign2button.buttonMode = true;  
sign2button.useHandCursor = true;

// Sign3movie Button Listeners

sign3movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign3movie.buttonMode = true;  
sign3movie.useHandCursor = true;  
sign3button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign3button.buttonMode = true;  
sign3button.useHandCursor = true;

// Sign4movie Button Listeners

sign4movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign4movie.buttonMode = true;  
sign4movie.useHandCursor = true;  
sign4button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign4button.buttonMode = true;  
sign4button.useHandCursor = true;

// Sign5movie Button Listeners

sign5movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign5movie.buttonMode = true;  
sign5movie.useHandCursor = true;  
sign5button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign5button.buttonMode = true;  
sign5button.useHandCursor = true;

// Sign6movie Button Listeners

sign6movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign6movie.buttonMode = true;  
sign6movie.useHandCursor = true;  
sign6button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign6button.buttonMode = true;  
sign6button.useHandCursor = true;

// Sign7movie Button Listeners

sign7movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign7movie.buttonMode = true;  
sign7movie.useHandCursor = true;  
sign7button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign7button.buttonMode = true;  
sign7button.useHandCursor = true;

// Sign8movie Button Listeners

sign8movie.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign8movie.buttonMode = true;  
sign8movie.useHandCursor = true;  
sign8button.addEventListener(MouseEvent.CLICK, onClicksigns);  
sign8button.buttonMode = true;  
sign8button.useHandCursor = true;

// onClicksigns Function [COLOR=red] ( THIS IS WHERE THE PROBLEM LIES )[/COLOR]

function onClicksigns(myEvent:MouseEvent){  
var clickedSign:MovieClip = MovieClip(myEvent.currentTarget);  
if (currentSign == clickedSign) {  
currentSign.play();  
currentSign = null;  
}  
else if (currentSign != null) {  
currentSign.play();  
}  
currentSign = clickedSign;  
currentSign.play();  
}

// BUTTON Listeners

button1b.addEventListener(MouseEvent.CLICK,clickon1b);  
button2b.addEventListener(MouseEvent.CLICK,clickon2b);  
button3b.addEventListener(MouseEvent.CLICK,clickon3b);  
button8b.addEventListener(MouseEvent.CLICK,clickon8b);  
button9b.addEventListener(MouseEvent.CLICK,clickon9b);  
button10b.addEventListener(MouseEvent.CLICK,clickon10b);  
button11b.addEventListener(MouseEvent.CLICK,clickon11b);

function clickon1b(myEvent:MouseEvent):void  
{  
selected = “main”;  
play();  
}

function clickon2b(myEvent:MouseEvent):void  
{  
selected = “pricesheet”;  
play();  
}

function clickon3b(myEvent:MouseEvent):void  
{  
selected = “contact”;  
play();  
}

function clickon8b(myEvent:MouseEvent):void  
{  
selected = “political”;  
play();  
}

function clickon11b(myEvent:MouseEvent):void  
{  
selected = “contact”;  
play();  
}

function clickon9b(myEvent:MouseEvent):void  
{  
var web:URLRequest = new URLRequest(“[http://www.zodiacsignshome.com](http://www.zodiacsignshome.com)”);  
navigateToURL(web, “\_blank”);  
}

function clickon10b(myEvent:MouseEvent):void  
{  
var web:URLRequest = new URLRequest(“[http://www.zodiacsignshome.com](http://www.zodiacsignshome.com)”);  
navigateToURL(web, “\_blank”);  
}

* * *

Again any input will be greatly appreciated…

Thank you,

Patrick  
[/SIZE]
