# Binding vars to Flex component

**URL:** <https://forum.kirupa.com/t/binding-vars-to-flex-component/246005>\
**Category:** flash\
**Created:** [December 6, 2007, 7:21am UTC](https://forum.kirupa.com/t/binding-vars-to-flex-component/246005 "2007-12-06T07:21:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MDiddy](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@MDiddy](https://forum.kirupa.com/u/MDiddy)\
**Post date:** [December 6, 2007, 7:21am UTC](https://forum.kirupa.com/t/binding-vars-to-flex-component/246005/1 "2007-12-06T07:21:10Z")

</div>

This might be a simple request, but I’m having problems finding a solution. I have states setup for my text color, and I need have the color values change based on an event. I thought I could just make a bindable var for the number associated with the color value but I get an error #1119.

“1119: Access of possibly undefined property selectedColor through a reference with static type module3\_inlineComponent1.”

I’m assuming this is a scoping issue - that that my states are not in the same scope as the actioncript code where I define the var, thought its in the same MXML file. Here’s the pertient code:

```auto

[Bindable] public var selectedColor:uint;

private function loadLayout(index:Number):void {
      this.selectedColor = moduleXML.getSelectedTextColorAt(index);
      trace("color", this.selectedColor);
}

//States
<qs:states>
	<mx:State id="navState" name="selected">
		<SetProperty name="filters">
			<value><Array>
				<f:GlowFilter color="#FFFFFF"/>
			</Array></value>
		</SetProperty>
		<SetStyle id="sColor" name="color" value="[COLOR="Red"]{this.selectedColor}[/COLOR]" />
	</mx:State>
	<mx:State name="hilighted">
		<SetProperty name="filters">
			<value>
			<Array>
				<f:GlowFilter color="#BBBBBB"/>
			</Array>
			</value>
		</SetProperty>
	</mx:State>
</qs:states>

```
