2

I have customized textinput control with a property of x. In my program I instantiate the control as vtiA. My program has a bindable variable called _y.

I would like everytime that _y is changed by my program that the property x of the control vtiA reflects the new values.

What I have done that does not work is

[Bindable] private var _y;

private function whocares():void
{
var vtiA:MyTextInput = new MyTextInput;
vtiA.x = _y
}

If this were mxml I would just say;

<xx:MyTextInput id="vtiA" x="{_y}"/>

What is the equivalent in as3?

Paul

1 Answer 1

1

[Bindable] only works on public properties. So you need:

[Bindable] public var _y;
Sign up to request clarification or add additional context in comments.

3 Comments

It is my understanding, (and I use it extensively) that it can be used with private variables as well. It is documented as such; "Before a public, protected, or private property defined as a variable to make that specific property support binding." Found in livedocs.adobe.com/flex/3/html/…
I just did a test using mxml, and it works fine. As you might imagine my program is rather complex with the textinput component having over 2,200 lines of code, and the module that accesses the textinput component has about 2,400 lines of code. Posting all the code would be inpractical. I see how to get more complex objects to bind using BindingUtils, but not a simple object like a string.
BTW I did try BindingUtils.bindProperty(vtiA,"x",this,"_y"); and it did not seem to work for me. It recognized _y as it required that I change it to a public variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.