# Issues with currentTarget - Somebody called a function?

**URL:** <https://forum.kirupa.com/t/issues-with-currenttarget-somebody-called-a-function/320120>\
**Category:** flash\
**Created:** [March 14, 2011, 9:13pm UTC](https://forum.kirupa.com/t/issues-with-currenttarget-somebody-called-a-function/320120 "2011-03-14T21:13:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalasnjikov](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kalasnjikov](https://forum.kirupa.com/u/kalasnjikov)\
**Post date:** [March 14, 2011, 9:13pm UTC](https://forum.kirupa.com/t/issues-with-currenttarget-somebody-called-a-function/320120/1 "2011-03-14T21:13:00Z")

</div>

Disclaimer: I am a bit of a hack with coding - I try to follow good practices, but I am ignorant and there are many holes in my knowledge. All are encouraged to point out any glaring stupidities in my approach - I will have certainly missed them. :bucktooth:

Ahem, I’ve got a smallish portfolio site I’m bringing into AS3 from AS2 (I don’t get out much.) By “bringing into AS3”, I mean, re-writing from scratch 11 times. I’m fairly happy with where I’m at, but I’m getting an error now with a group of undefined properties, and I’m wondering how to approach it.

The error lies in how I’m attempting to use currentTarget. I have 5 movieclips attached to a Sprite on the stage that serve as buttons. An eventListener attached to each those movieclips, when clicked, calls the function swingShift.

I’m trying to use e.currentTarget as the swtich statement’s expression, to identify the eventListener target and delineate the cases, as well as using it as the object of an Actuate Transform tween.

Here’s the code where the error lies:

function swingShift():void {

// turn the correct button yellow

Actuate.transform (e.currentTarget, 0.5).color (0xFFFFDD, 1);

// reset the blu function and disable the button calling the larger function

```
	switch (e.currentTarget) {
    case label_ps:
    var blueBeard = 1;
e.currentTarget.mouseEnabled = false;

```

break;  
case label\_ad:  
var blueBeard = 2;  
e.currentTarget.mouseEnabled = false;  
break;  
case label\_sd:  
var blueBeard = 3;  
e.currentTarget.mouseEnabled = false;  
break;  
case label\_co:  
var blueBeard = 4;  
e.currentTarget.mouseEnabled = false;  
break;  
case label\_cl:  
var blueBeard = 5;  
e.currentTarget.mouseEnabled = false;  
break;  
}

// and finally e.currentTarget switches the scrollers and such

switch (e.currentTarget) {  
case label\_ps:  
fadeIn1();

var popEye = 1;  
break;  
case label\_ad:  
fadeIn2();

var popEye = 2;  
break;  
case label\_sd:  
fadeIn3();

var popEye = 3;  
break;  
case label\_co:

var popEye = 4;  
break;  
case label\_cl:  
var popEye = 4;

```
break;
}
}

```

I’m not exactly sure why either of these usages (as the variable in a switch statement, or as the object of a tween) are not working. I’m hoping that it’s a problem more with syntax and less with approach. I’ve attached the entire class file, and the AS from the FLA timeline as well, for clarity.

Thanks.
