# AS3 movie clip referencing problem

**URL:** <https://forum.kirupa.com/t/as3-movie-clip-referencing-problem/303705>\
**Category:** flash\
**Created:** [January 25, 2010, 3:24pm UTC](https://forum.kirupa.com/t/as3-movie-clip-referencing-problem/303705 "2010-01-25T15:24:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewF](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andrewF](https://forum.kirupa.com/u/andrewF)\
**Post date:** [January 25, 2010, 3:24pm UTC](https://forum.kirupa.com/t/as3-movie-clip-referencing-problem/303705/1 "2010-01-25T15:24:05Z")

</div>

Hi I am new to the forum and to AS3… hope you can help me.

I am building a site in Flash CS3 using AS3.

I have a main.fla with single frame that has some core/ static elements positioned on it.

The AS of the first frame calls a MC called ‘opening\_mc’: code:

import flash.display.Loader;  
import flash.display.MovieClip;

import fl.transitions.Tween;  
import fl.transitions.easing.\*;

var opening\_Mc:MovieClip = new opening\_mc();  
addChildAt(opening\_Mc,0);  
opening\_Mc.x = 900;  
opening\_Mc.y = 150;  
opening\_Mc.visible = true;

Within ‘opening\_mc’ are 7 separate MCs…(open\_1\_mc, open\_2\_mc, open\_3\_mc…etc) butted together to create a long horizontal strip (each is 900px long - using this to get over 2880px limit). Each has been placed on the stage and given an instance the same as the MC name and also a class has been exported for each in the linkage panel(Open1Mc, Open2Mc, Open3Mc…etc).

Within the MC ‘opening\_mc’ there is a second MC called ‘open\_nav\_mc’ again with a single frame. This MC has a group/MC of buttons on the stage in a MC called ‘nav\_btn\_group’ containing 7 buttons (open\_nav\_1\_btn,open\_nav\_2\_btn…etc) and a simple box (select\_box)

The following code is in the first frame of the MC ‘open\_nav\_mc’: code:

import flash.display.Loader;  
import flash.display.MovieClip;  
import fl.transitions.Tween;  
import fl.transitions.easing.\*;

select\_box.x = 386;

nav\_btn\_group.addEventListener(MouseEvent.MOUSE\_OVER, onNav\_btnOver);  
nav\_btn\_group.addEventListener(MouseEvent.MOUSE\_OUT, onNav\_btnOut);  
nav\_btn\_group.addEventListener(MouseEvent.CLICK, onNav\_btnClick);

function onNav\_btnOver(evt:MouseEvent):void{  
evt.target.alpha = 0.5;  
}

function onNav\_btnOut(evt:MouseEvent):void{  
evt.target.alpha = 1;  
}

function onNav\_btnClick(evt:MouseEvent):void{

```
 switch (evt.target.name){
    case "open_nav_1_btn":
        trace("one");
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 0, 1, true);
        var open_1_mcXTween: Tween = new Tween(this.opening_mc.open_1_mc, "x", Regular.easeOut, this.opening_mc.open_1_mc.x, 0, 1, true);
        break;
    case "open_nav_2_btn":
        trace("two");
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 129, 1, true);
        //var open_2_mcXTween: Tween = new Tween(this.open_2_mc, "x", Regular.easeOut, this.open_2_mc.x, 0, 1, true);
        break;
    case "open_nav_3_btn":
        trace("three");
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 258, 1, true);
        //var open_3_mcXTween: Tween = new Tween(this.open_3_mc, "x", Regular.easeOut, this.open_3_mc.x, 0, 1, true);
        trace("hi there");
        break;
     case "open_nav_4_btn":
        trace("four");
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 386, 1, true);
        //var open_4_mcXTween: Tween = new Tween(this.open_4_mc, "x", Regular.easeOut, this.open_4_mc.x, 0, 1, true);
        break;
    case "open_nav_5_btn":
        trace("five"); 
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 514, 1, true);
        //var open_5_mcXTween: Tween = new Tween(this.open_5_mc, "x", Regular.easeOut, this.open_5_mc.x, 0, 1, true);
        break;
    case "open_nav_6_btn":
        trace("six"); 
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 642, 1, true);
        //var open_6_mcXTween: Tween = new Tween(this.open_6_mc, "x", Regular.easeOut, this.open_6_mc.x, 0, 1, true);
        break;
    case "open_nav_7_btn":
         trace("seven");
        var select_boxXTween: Tween = new Tween(select_box, "x", Regular.easeOut, select_box.x, 771, 1, true);
        //var open_7_mcXTween: Tween = new Tween(this.open_7_mc, "x", Regular.easeOut, this.open_7_mc.x, 0, 1, true);
        break;

```

}  
}

The sliding of the ‘select\_box’ works perfectly when one of the buttons is pressed. However, what I want to do is to control the ‘x’ position MCs making up the horizontal strip (open\_1\_mc, open\_2\_mc, open\_3\_mc…etc) using a AS3 tween.

I keep getting a:

'TypeError: Error #1010: A term is undefined and has no properties. at OpenNavMc/onNav\_btnClick()

I suspect this has something to do with the referencing of the specific MC in ‘opening\_mc’. I have checked that all MCs have instances and class definitions… but I cannot seem to sort out the problem.

Any help would be much appreciated.

Thx
