# Changing the color with if \>

**URL:** <https://forum.kirupa.com/t/changing-the-color-with-if/171558>\
**Category:** flash\
**Created:** [December 6, 2005, 3:39pm UTC](https://forum.kirupa.com/t/changing-the-color-with-if/171558 "2005-12-06T15:39:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takashy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/takashy/32/1985_2.png) [@Takashy](https://forum.kirupa.com/u/Takashy)\
**Post date:** [December 6, 2005, 3:39pm UTC](https://forum.kirupa.com/t/changing-the-color-with-if/171558/1 "2005-12-06T15:39:25Z")

</div>

Hi all~!

Im new to Flash and i have a question.  
I want to make something like this. I have a box and i want that it changes the color if a variable is lover than 50 or so… so here is the variable:

HP = 100;

There the code that i made… but it does not work… i added it to the same frame as the box

if (HP\<50) {  
red = new Color(DGMHPBAR);  
red.setRGB(0xCC3300);  
}

The problem is that it does not change the color when the Var HP is lover than 50… i made a button which takes 10 from hp.

on (release) {  
HP = HP-10;  
}

Anyway i can make the HP var -999999 and it wont change the color.  
But i know that the thing with the changing color works. I made a button so that when i press it it changes the color of the box and that thing works.

I think i made a mistake in the if… HP\<50 and so~

Anyway, can some one please help me?

Ps: Sorry for my mad english… :s
