# Trying to pass a variable

**URL:** <https://forum.kirupa.com/t/trying-to-pass-a-variable/9455>\
**Category:** Uncategorized\
**Created:** [December 12, 2002, 3:13am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455 "2002-12-12T03:13:18Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![reverendflash](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@reverendflash](https://forum.kirupa.com/u/reverendflash)\
**Post date:** [December 12, 2002, 3:13am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/1 "2002-12-12T03:13:18Z")

</div>

I’m trying to pass the value picked from the color picker to a text field. I am attaching the .fla…

you will see that when you click on the color picker, it sets the color of the mc… I also want it to set the variable fcolor when picked.

the swf can be viewed at [http://www.aulman.com/mxdab/ford0.html](http://www.aulman.com/mxdab/ford0.html)  
if you just want to view the file first… the text down below should change to the hex # when picked…

Any help is appreciated…

Rev ![](http://www.aulman.com/rev.gif)

\<a href =“[http://www.aulman.com/mxdab/ford1.fla](http://www.aulman.com/mxdab/ford1.fla)”\> fla here \</a\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 3:15am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/2 "2002-12-12T03:15:53Z")

</div>

You forgot to post your FLA 🙂

And you know what, that is one thing I never learned in Flash with colors. And that is how to convert RGB into Hex in Flash. I am babbling.

Hey, you edited! No fair!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 3:17am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/3 "2002-12-12T03:17:24Z")

</div>

Oh, I can’t help I guess…

It says Flash MX does not support Generator content.

I will give it a whirl anyways.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 3:19am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/4 "2002-12-12T03:19:10Z")

</div>

lost:

ignore that…

I am trying to convert the current site (yes, I just finished it) to MX, so that he can put it on CD (can’t do that with Gen2)…

thanks for trying…

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 3:23am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/5 "2002-12-12T03:23:11Z")

</div>

Hmm, components… yuk…LOL.

No problem, I ignored it, and am trying still.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 3:53am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/6 "2002-12-12T03:53:55Z")

</div>

thanks lost

If you can think of an easier way to do this, let me know…

as you know, my MX knowledge is growing, but not as fast as my clients wish…

thanks,

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 4:14am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/7 "2002-12-12T04:14:03Z")

</div>

ARGH!!!

This thing is really :beeeeeep:

Well I tried a billion methods, and none worked. There is one method I used that worked great, but will be incredibly tedious to implement.

It requires you change the on(release) of all your buttons inside the component itself.

You must set the var name of your textbox to rcolor (not the instance name… and yes, this is for the rear text box.

Use this on each of the color buttons…

```auto
on (release) {
	setMyBackground = "0x000000";
	myColor.setRGB(setMyBackground);
	_root.rcolor = setMyBackground;
}

```

The problem with this other than the fact that it is a pain in the arse, is that, since you are editing inside the component itself, it effects the one for the front part as well!

Although this really doesn’t help much, I thought I would let you know my progress thus far.

Not sure if I can do this, but I will press on 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 4:33am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/8 "2002-12-12T04:33:49Z")

</div>

Lost:  
I said that too… AAAAArrrggggghhhhh… that’s why I decided to finally ask here :beam:

yeah, I already had come up with the tedious solution. That is how I tested to know what I was trying, was possible at least… trying to avoid doing anything that tedious, if possible…

If it has to be just 1 variable, then I could do this in 2 swfs (that is how I currently do it)… I would rather not, but I would rather do that than use my current beat Flash5 version I built…

thanks again for melting a brain cell or 2 on this…

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 5:41am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/9 "2002-12-12T05:41:07Z")

</div>

Lost:

is there a way to use getRGB to get the color value of frontcolor, and pass it to fcolor via the close button on the component?

that would save having to copy and paste 256 times…

just a thought…

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 5:42am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/10 "2002-12-12T05:42:00Z")

</div>

Oh, believe me, I thought of that. And I couldn’t get it to work at all ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 5:42am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/11 "2002-12-12T05:42:49Z")

</div>

great minds run in the same gutter…

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 5:54am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/12 "2002-12-12T05:54:19Z")

</div>

naturally 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:04am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/13 "2002-12-12T06:04:48Z")

</div>

okay, different tack…

how do I get the hex value of a movie clip?

I mean, I can set it, but how do I find out what that was…

my brain hurts…

[SIZE=1]:: said with a hankerchief on his head, while hitting himself with a brick ::[/SIZE]

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:06am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/14 "2002-12-12T06:06:52Z")

</div>

That would be getRGB, but you can only get it after you set it.

Well you don’t get it from the clip, you get it from the color object, which is inside the component and is called myColor.

I tried using getRGB, but it just would not work ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:10am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/15 "2002-12-12T06:10:42Z")

</div>

A little something to show what I mean…

Create a movie clip on the stage and give it the instance name “ball” (no quotes).

But these actions on a Frame…

```auto
myColor = new Color(_root.ball);
myColor.setRGB(0xFF0000);
trace(myColor.getRGB().toString(16));

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:13am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/16 "2002-12-12T06:13:17Z")

</div>

yeah, I may end up doing the tedious way… or I may just use the one I made up w/ just a few colors…

just a question, if you weren’t using components, and wanted to do this color picker, what would you do?

Rev ![](http://www.aulman.com/rev.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:18am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/17 "2002-12-12T06:18:44Z")

</div>

No clue man. Probably the same way as the component, but less difficult.

Like you press the button and it shows the color picker (through attachMovie?), that clip will contain your pallette.

Then on a frame in the \_root you will declare your new Color() object.

And the buttons inside your clip will use

\_root.myColor.setRGB(0xFF0000)

And hopefully you will be able to change your textbox to read with the getRGB (which I showed how to use in the last post).

In theory…lol.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 12, 2002, 6:22am UTC](https://forum.kirupa.com/t/trying-to-pass-a-variable/9455/18 "2002-12-12T06:22:25Z")

</div>

Okay, same way as me…

I gotta work on something else first anyway… I was just thinking this would be cool, if I could get it to work…

The client knows nothing of this… in case I run out of time…

thanks for the brain fry…

Rev ![](http://www.aulman.com/rev.gif)
