|
All, I
am trying to create a component that has two list with a couple of buttons
between the two list to allow the user to move items between the two
list. Pretty standard type of control. The problem that I am having
is that I want to be able to have a base control that handles the moving of the
items between the two lists. But I want the child instances to be able to
control the labelFunction for each list in the component. But whenever I
assign anything to that function the compiler says only functions in document
are allowed. I am not sure how to expose a function reference to child
objects. I tried over riding the function in a child and that didn’t
seem to work. I am trying to do this in mxml instead of action script. Here
is the source for the control. Thanks Jeff <?xml version="1.0" encoding="utf-8"?> <!-- selector.mxml --> <mx:HBox xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%" height="100%" horizontalAlign="center" vScrollPolicy="off"
hScrollPolicy="off" marginBottom="0" marginRight="0" marginTop="0"
marginLeft="0" x="0" y="-5" > <mx:Script> <![CDATA[ public
var SelectedValues:Array; public
var SourceValues:Array; public
function SourceLabelFunction ( item:Object ) :String { return
""; } ]]> </mx:Script> <mx:VBox
height="100%" verticalAlign="middle"> <mx:List
id="currentSecurityKeys" > <mx:dataProvider>
{SelectedValues} </mx:dataProvider> </mx:List> </mx:VBox> <mx:VBox
height="100%" verticalAlign="middle"> <mx:Button
id="allToLeft" label="<<"/> <mx:Button
id="toLeft" label="<"/> <mx:Button
id="toRight" label=">"/> <mx:Button
id="allToRight" label=">>"/> </mx:VBox> <mx:VBox
height="100%" verticalAlign="middle"> <mx:List
id="allSecurityKeys"
labelFunction="SourceLabelFunction"> <mx:dataProvider>
{SourceValues} </mx:dataProvider> </mx:List> </mx:VBox> </mx:HBox> <<<<<<<<<<<<<<<<<<<<<Child
source>>>>>>>>>>>>>>>>>>>>>>>>>>>> <?xml version="1.0" encoding="utf-8"?> <!-- SecuritySelector.mxml --> <component:Selector xmlns:component="net.flex.component.core.*" xmlns:mx="http://www.macromedia.com/2003/mxml"
> <mx:Script> <![CDATA[ import
net.flex.vo.security.*; import
net.flex.vo.user.UserVO; public
function selectorInit() { } public
function SourceLabelFunction ( item:Object ) :String { var
user:UserSecurityVO = UserSecurityVO(item); return
item.securityRole.roleName; } ]]> </mx:Script> </component:Selector> Yahoo! Groups Links
|

