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:
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?