Reputation: 113
I am using Flex3.0. in this i am craeting a custom component for an Alert.and for that alert i am applying styles. but when i opening the alert through the application i want to set focus on Alert button.means when i press enter button there are two buttons in alert YES and NO.i need to focus on YES button. any one help me if any reffer url also please provide me
Thanks, Praveen
Upvotes: 2
Views: 1846
Reputation: 332
From the APIDocs:
show(text:String = "", title:String = "", flags:uint = 0x4, parent:Sprite = null, closeHandler:Function = null, iconClass:Class = null, defaultButtonFlag:uint = 0x4):Alert [static] Static method that pops up the Alert control.
In a regular Alert.show call this means you can specify the last argument as Alert.YES to make it the default selection. With a custom component, you can call setFocus() on the particular element within your custom Alert component that you want to select (i.e.: in call setFocus() within the custom Alert component's creationComplete event).
So a sample implementation of a YES/NO Alert box would be (split code over two lines to avoid scroll bars):
Alert.show("sample text","sample title",
Alert.YES|Alert.NO,null,null,null,Alert.YES);
Hope this helps.
Upvotes: 2
Reputation: 1315
you need to set the defaultButtonFlag: (its the last parameter)
Alert.show('alert', 'alert', Alert.NO|Alert.YES, this, null, null, Alert.NO);
Upvotes: 3