# Issue with referencing

**URL:** <https://forum.kirupa.com/t/issue-with-referencing/260275>\
**Category:** flash\
**Created:** [May 14, 2008, 2:23am UTC](https://forum.kirupa.com/t/issue-with-referencing/260275 "2008-05-14T02:23:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaunak84](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@shaunak84](https://forum.kirupa.com/u/shaunak84)\
**Post date:** [May 14, 2008, 2:23am UTC](https://forum.kirupa.com/t/issue-with-referencing/260275/1 "2008-05-14T02:23:33Z")

</div>

Hey, I’m trying to make a simple app to learn actionscript, and I’ve used the drawing api to draw 2 movie clip boxes. When I click the box, it displays text in a dynamic text area, and “highlights” (I change the color to orange). When I click the second box, I’m trying to make the first box revert to its original color and highlight the second box, but it doesn’t seem to work. Here’s the AS:

```auto
 
var chosen; 

function select(s:MovieClip) { 
    oldItem = new Color(chosen); 
    oldItem.setRGB(0xFF9900); 
    chosen.lineStyle(1); 
    
    currItem = new Color(s); 
    currItem.setRGB(0xFF9900); 
    s.lineStyle(1); 
    ta.text = s.text; 
    chosen = s; 
}

_root.createEmptyMovieClip("box1",0); 

box1.lineStyle(1, 0x000000);
box1.beginFill(0x0099FF, 100); 
box1.moveTo(50,50); 
box1.lineTo(50,100); 
box1.lineTo(100,100); 
box1.lineTo(100,50); 
box1.lineTo(50,50); 
box1.endFill(); 
box1.text = "Macy's"; 

box1.onRelease = function() { 
    select(this); 
}

_root.createEmptyMovieClip("box2",1); 
box2.lineStyle(1, 0x000000);
box2.beginFill(0x0099FF, 100); 
box2.moveTo(100,50); 
box2.lineTo(150,50); 
box2.lineTo(150,100); 
box2.lineTo(100,100); 
box2.lineTo(100,50); 
box2.endFill(); 
box2.text = "Footlocker"; 

box2.onRelease = function() { 
    select(this); 
}

```

When I click a box, it highlights (so I know that part of the function works). But it doesn’t alter the color of the “previously selected box.” I thought I could use var chosen as a reference, but how would you go about it?
