Sometime we need to access the protected properties of the class. e.g. the TextField of a TextInput control.
You can access the such properties by subclassing the class.
package com
{
import mx.controls.TextInput;
import mx.core.IUITextField;
public class MyTextInput extends TextInput
{
public function MyTextInput()
{
super();
}
public function get myTextField():IUITextField
{
return this.textField;
}
}
}
The same property can be accessed without extending the class, using the internal namespace. ;)
import mx.core.mx_internal;
use namespace mx_internal;
private function getMyTextFild():void
{
var tf:IUITextField = ti.mx_internal::getTextField();
// ti is textinput control
}
Thursday, May 21, 2009
Flex: Accessing protected properties and internal namespace
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment