# Selectable objects HELP PLEASE

**URL:** <https://forum.kirupa.com/t/selectable-objects-help-please/182622>\
**Category:** flash\
**Created:** [March 20, 2006, 2:56am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622 "2006-03-20T02:56:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_James](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jimmy\_James](https://forum.kirupa.com/u/Jimmy_James)\
**Post date:** [March 20, 2006, 2:56am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/1 "2006-03-20T02:56:41Z")

</div>

Ive figured out how to make an object selectable with this code:

onClipEvent (mouseUp) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
if (this.\_currentFrame == 1) {  
this.gotoAndStop(2);  
} else {  
this.gotoAndStop(1);  
}  
}  
}

Now that ive done that i want to know how to change the color of a selected object when i click a certain button ??  
Can anyone help please thanks Jimmy.

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [March 20, 2006, 3:05am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/2 "2006-03-20T03:05:32Z")

</div>

create a Color object and use setRGB()

read the help file on it its pretty straightforward 🥚

edit: yay! 600 posts!

---

<div class="post-metadata">

**Author:** ![Jimmy\_James](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jimmy\_James](https://forum.kirupa.com/u/Jimmy_James)\
**Post date:** [March 20, 2006, 3:13am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/3 "2006-03-20T03:13:07Z")

</div>

> [@matthewjumps](#):
>
> create a Color object and use setRGB()
> 
> read the help file on it its pretty straightforward 🥚
> 
> edit: yay! 600 posts!

Yer i can change the color but how do i direct the button to change only the selected object??

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [March 20, 2006, 3:36am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/4 "2006-03-20T03:36:07Z")

</div>

make a \_root.selectedObject variable and store in it the current selected object…then target that selectedObject to color it

heres a really basic example…click the first button that makes the \_root.selectedObject reference it, then click the bottom button that uses the \_root.selectedObject to color the other button.

but why not jsut put the color stuff inside your

```auto

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
colorMe = new Color(this);
colorMe.setRGB(0x000000);
if (this._currentFrame == 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
}

```

thats way more logical isnt it?

---

<div class="post-metadata">

**Author:** ![Jimmy\_James](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jimmy\_James](https://forum.kirupa.com/u/Jimmy_James)\
**Post date:** [March 20, 2006, 3:52am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/5 "2006-03-20T03:52:12Z")

</div>

Thanks alot hey youve been a great help to me !

---

<div class="post-metadata">

**Author:** ![Jimmy\_James](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jimmy\_James](https://forum.kirupa.com/u/Jimmy_James)\
**Post date:** [March 20, 2006, 4:14am UTC](https://forum.kirupa.com/t/selectable-objects-help-please/182622/6 "2006-03-20T04:14:22Z")

</div>

Altho the script you gave me works, it only works for one object how do i make it work for multiple objects ?

Cheers
