# .setRGB

**URL:** <https://forum.kirupa.com/t/setrgb/15448>\
**Category:** flash\
**Created:** [March 14, 2003, 7:03am UTC](https://forum.kirupa.com/t/setrgb/15448 "2003-03-14T07:03:49Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [March 14, 2003, 7:44am UTC](https://forum.kirupa.com/t/setrgb/15448/21 "2003-03-14T07:44:58Z")

</div>

that’s crazy… i just spent so much time doin this

```php
opacityListener = new Object();
opacityListener.onKeyDown = function() {
	if (Key.isDown(49)) {
		shapes._alpha = 10;
	}
	if (Key.isDown(50)) {
		shapes._alpha = 20;
	}
	if (Key.isDown(51)) {
		shapes._alpha = 30;
	}
	if (Key.isDown(52)) {
		shapes._alpha = 40;
	}
	if (Key.isDown(53)) {
		shapes._alpha = 50;
	}
	if (Key.isDown(54)) {
		shapes._alpha = 60;
	}
	if (Key.isDown(55)) {
		shapes._alpha = 70;
	}
	if (Key.isDown(56)) {
		shapes._alpha = 80;
	}
	if (Key.isDown(57)) {
		shapes._alpha = 90;
	}
	if (Key.isDown(58)) {
		shapes._alpha = 100;
	}
};
Key.addListener(opacityListener);

```

I was just followin the tutorial and what you did and stuff… but dang… lol… i have a lot to learn

---

<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:** [March 14, 2003, 7:46am UTC](https://forum.kirupa.com/t/setrgb/15448/22 "2003-03-14T07:46:44Z")

</div>

Well I could get all “obfuscated” and stuff, and in that case, my listener code would be better and probably less lines, but you would need the keyCode to each character unfortunately.

And you could do an if/else instead of if, if, if, if, etc.

---

<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:** [March 14, 2003, 7:48am UTC](https://forum.kirupa.com/t/setrgb/15448/23 "2003-03-14T07:48:54Z")

</div>

ohhh… well i did save your little key code thingie…

thanks a lot for your help lost and cyan… im goin to bed now tho… im glad i got this far

thanks a ton for your help again

I’ll screw with it some more tomorrow… this is fun… night guys

PS: obfuscated?

---

<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:** [March 14, 2003, 7:52am UTC](https://forum.kirupa.com/t/setrgb/15448/24 "2003-03-14T07:52:20Z")

</div>

Obfuscating code is condensing it down. To truly obfuscate though, the code would be unreadable really.

Mine wouldn’t be that obfuscated, just minor stuff.

---

<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:** [March 14, 2003, 8:00am UTC](https://forum.kirupa.com/t/setrgb/15448/25 "2003-03-14T08:00:47Z")

</div>

Some thing like this???

```auto
colorArray = new Array("0x333333", "0x333366", "0x333399", "0x336633",
				   "0x336666", "0x336699", "0x339933", "0x339966",
				   "0x339999", "0x663333", "0x663366", "0x663399",
				   "0x666633", "0x666666", "0x666699", "0x669933",
				   "0x669966", "0x669999", "0x993333", "0x993366",
				   "0x993399", "0x996633", "0x996699", "0x999933",
				   "0x999966", "0x999999");
opacityListener = new Object();
opacityListener.onKeyDown = function()
{
	if ((Key.getCode() >= 48) && (Key.getCode() <= 57))
	{
		if (Key.getCode() == 48)
			shapes._alpha = 100;
		else
			shapes._alpha = (Key.getCode() - 48) * 10;
	}
	else if ((Key.getCode() >= 65) && (Key.getCode() <= 90))
	{
		var colorful = new Color("_root.shapes");
		colorful.setRGB(colorArray[Key.getCode() - 65]);
	}
};
Key.addListener(opacityListener);

```

---

<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:** [March 14, 2003, 8:06am UTC](https://forum.kirupa.com/t/setrgb/15448/26 "2003-03-14T08:06:06Z")

</div>

babling. I can’t test it, but it looks like what I had in my mind to try out 🙂

---

<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:** [March 14, 2003, 8:10am UTC](https://forum.kirupa.com/t/setrgb/15448/27 "2003-03-14T08:10:01Z")

</div>

I know that you cannot check the code out, that’s why I just created bogus code so that xxviii can check it out and get into the swampt… 😛 Kidding… 😉

You still having that RAM problem, lostinbeta??? :hair:

---

<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:** [March 14, 2003, 8:12am UTC](https://forum.kirupa.com/t/setrgb/15448/28 "2003-03-14T08:12:21Z")

</div>

Yep yep, still having that problem ☹ My comp is getting better though, I can actually open Flash now!!! YAY!!! (well at least for a little bit)… and and… the other day I could actually open Photoshop and create a new footer/avatar!!!

Granted it ran like crap, but before I would get a memory usage error. So somehow it improved since then 😛 =)

---

<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:** [March 14, 2003, 8:23am UTC](https://forum.kirupa.com/t/setrgb/15448/29 "2003-03-14T08:23:02Z")

</div>

Hehe… I hope you can figure out how to fix it soon… (I thought that somebody offered you one if I remember correctly…)  
Well… I got bigger problem… My old PII 300 on 56k is lagging like hell when I am in Kirupa due to lots of SWF footers… It’s gotta a little bit better after you guys forced the size restriction and such, but it is bad… Oh, well… What can I do about it??? ☹

---

<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:** [March 14, 2003, 8:25am UTC](https://forum.kirupa.com/t/setrgb/15448/30 "2003-03-14T08:25:39Z")

</div>

Wow, now that is a bad case senario ☹

You could disable the viewing of footers for you. That should help.

Just go to UserCP/Edit Options/

In there will be something that says…

> Show user’s signatures in their posts? Yes No

---

<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:** [March 14, 2003, 8:30am UTC](https://forum.kirupa.com/t/setrgb/15448/31 "2003-03-14T08:30:19Z")

</div>

Yes, I know… I don’t really want to disable it because there are some good ones that my eyes like… 😉 Besides, I did turn that off when I first came here but I didn’t see much difference…

---

<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:** [March 14, 2003, 8:32am UTC](https://forum.kirupa.com/t/setrgb/15448/32 "2003-03-14T08:32:21Z")

</div>

Hrmm, everyone I know that turns them off says the forum runs so much faster.

Alright, I am so off to bed now. I am tired(-:

Goodnight :sleep:

---

<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:** [March 14, 2003, 8:35am UTC](https://forum.kirupa.com/t/setrgb/15448/33 "2003-03-14T08:35:01Z")

</div>

Yup… Good night… I’ll be off soon too… 😉

---

<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:** [March 14, 2003, 2:49pm UTC](https://forum.kirupa.com/t/setrgb/15448/34 "2003-03-14T14:49:11Z")

</div>

cyanblue… i tried that code you said but it didnt seem to work, i was probably doing it wrong tho. im not good with all that loopy stuff… but that probably wasnt even a loop… cuz thats how dumb i am

thanks for the help tho

---

<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:** [March 14, 2003, 3:16pm UTC](https://forum.kirupa.com/t/setrgb/15448/35 "2003-03-14T15:16:05Z")

</div>

Here you go… 😉

---

<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:** [March 14, 2003, 3:36pm UTC](https://forum.kirupa.com/t/setrgb/15448/36 "2003-03-14T15:36:14Z")

</div>

wow, thats pretty cool

thanks man…

once i can understan how u did that ill be a lot happier

thank you:)

---

<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:** [March 14, 2003, 3:50pm UTC](https://forum.kirupa.com/t/setrgb/15448/37 "2003-03-14T15:50:20Z")

</div>

I dont think I saw this mentioned, but you can set alpha with the color object. Consider this function which will let you set RGB and alpha at once

```auto

Color.prototype.setRGBA = function(hex, a){
	this.setRGB(hex);
	this.setTransform({aa:a})
}

```

new Color(shapes).setRGBA(0x336699, 50);

Also, depending on those colors, you might be able to reduce the typing of all those hexes by making them a function of the keycode etc

yada yada yada 😉

---

<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:** [March 14, 2003, 3:59pm UTC](https://forum.kirupa.com/t/setrgb/15448/38 "2003-03-14T15:59:47Z")

</div>

lol im so lost  
i really suck at actionscript… im still just learning it… but thank you…

i think i almost understand what your sayin but i have no idea how i would actually apply it to something… but oh well

thanks

---

<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:** [March 14, 2003, 5:06pm UTC](https://forum.kirupa.com/t/setrgb/15448/39 "2003-03-14T17:06:15Z")

</div>

> \*Originally posted by senocular \*  
> \*\*I dont think I saw this mentioned, but you can set alpha with the color object. Consider this function which will let you set RGB and alpha at once

```auto

Color.prototype.setRGBA = function(hex, a){
	this.setRGB(hex);
	this.setTransform({aa:a})
}

```

new Color(shapes).setRGBA(0x336699, 50);

Also, depending on those colors, you might be able to reduce the typing of all those hexes by making them a function of the keycode etc

yada yada yada 😉 \*\*

I did not know that. Interesting. Thanks 🙂

---

<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:** [March 15, 2003, 9:02am UTC](https://forum.kirupa.com/t/setrgb/15448/40 "2003-03-15T09:02:53Z")

</div>

Yup… That’s a neat one… Thanks senocular… =)

[Previous page](https://forum.kirupa.com/t/setrgb/15448.md?page=1)
