robotlegs/robotlegs-framework — Issue #24: Context Class contextView property set twice with binding expression and throws error
Author: mfdj
Created: 2011-10-09 03:57:18+00:00
State: open

I was playing around with this [HelloWorld example](http://www.developria.com/2010/06/an-introduction-to-robotlegs-a.html) and I ran into a problem using Context inside the Declerations tag:

```

```
The probelm was that the `contextView` was getting set twice, which seems to cause Robotlegs 1.5.0 to freak out.

I'm using Flex 4.5.1 and Flash Builder 4.5.

I created some tests and it seems that any class declared in the Declarations tag will get properties with binding expressions set twice. Always, even if the binding is to a property of a basic type, like Number, who's value does not change at any point.

Weirdly, if the class is declared in the root-tag/DispalyList (in my case I created a test that extended UIComponent, so it could exsist outside the Declarations tag) this double setting of the property (via binding expression) does not seem to occur.

I don't know if this is some weird configuration thing with my Flex setup, or if this is a 4.5 only issue… but I thought I'd bring it up as it was very frustrating because I liked the style of declaring the context as a tag, instead of using raw Actionscript.

My workaround is to patch it when extending Context — my AppContext.as has this:

```
override public function set contextView(value:DisplayObjectContainer):void
{
if ( ! contextView ) super.contextView = value;
}
```
Let me know if I'm missing something.