# Conditional colour

**URL:** https://forum.kirupa.com/t/conditional-colour/252926
**Category:** flash
**Created:** [February 25, 2008, 3:29pm UTC](https://forum.kirupa.com/t/conditional-colour/252926 "2008-02-25T15:29:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Kit](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kit/32/405_2.png) [@Kit](https://forum.kirupa.com/u/Kit)
#### Post date: [February 25, 2008, 3:29pm UTC](https://forum.kirupa.com/t/conditional-colour/252926/1 "2008-02-25T15:29:26Z")

</div>

Hi I am only just getting into Flash actionscript and need a little help.

I have a movie clip on my stage that I need to change color dependant on an external txt flie.  
The file has a variable &status which will equal “red”, “green” or “amber” and I want the mc to change accordingly.  
I have read lots of articles about loadVars, conditionals and the color object but just cant get them to work together.

i.e

myColour = new LoadVars();  
myColour.onLoad = function(success) {  
if(success){  
trace(“data has loaded successfully”);  
var changeStatus = myColor.status;  
}else{  
trace(“error: the data did not load”);  
}

if (changeStatus == “red”){  
trace(“test1”);

}else if(changeStatus == “green”){   
trace(“test2”);

}else {  
trace(“test”);  
}

}  
myColour.load(“status.txt”);

I know about,

myColor=new Color();  
myColor.setRGB();

But even just putting trace into the code only returns the initial “data has loaded successfully” and the final trace “test”.

I have searched and searched and played with this code but I cannot get it to work.

I would appreciate any help yo can give
