Copy link to clipboard
Copied
Hi,
Moving from to NativeDialogs ANE due to a possible bug in the old NativeAlert version.
In the old one, we had to call NativeAlert.dispose(); when closing the app. Now this isn't necessary with NativeDialogs?
NativeAlert.dispose(); or NativeAlertDialog.dispose(); work...
For the simple Alerts created via static function "show" : no dispose required.
_disposeAfterClose is set to true when the (static!) function "show()" is called or if a closeHandler is set.
Dont know about the other types of dialogs.
see:
Copy link to clipboard
Copied
For the simple Alerts created via static function "show" : no dispose required.
_disposeAfterClose is set to true when the (static!) function "show()" is called or if a closeHandler is set.
Dont know about the other types of dialogs.
see:
Copy link to clipboard
Copied
Great! Thanks, verdave.
Copy link to clipboard
Copied
this iOS or for Android. I had success with that ANE for Android but on iOS I would get some crashes that seemed to always link back to this.
Copy link to clipboard
Copied
Hello, about this native component, I have one question :
For my actual project, I find this component on Github that I find very usefull. But I fail to understand why I can't detect the result of the button which is clicked by the user. When I make addEventListener on a button, I don't get any good result ! I think that my function into resultatNativeAlertEventIndex.addEventListener(CollectionEvent.COLLECTION_CHANGE) is not started successfuly ! On the function triggered by one of the two nativeAlertDialog buttons, I modify the content of the arrayCollection variable resultatNativeAlertEventIndex. This function is started after the user have selected a nativeAlertDialog button.
To be clear, I'd like to know if the "bubbling" process of the event, detected after starting of NativeDialogEvent.CLOSED function, could stop or not any others event propagation, as my event listener which is not catched ?
[Bindable]
protected var resultatNativeAlertEventIndex:ArrayCollection;
//This variable is instancied and attribued after CreationComplete of application file :
protected function view_preinitialize(event:Event):void
{
resultatNativeAlertEventIndex = new ArrayCollection;
resultatNativeAlertEventIndex.addItemAt({resultIndex:-1},0);
}
private var dialog:iNativeDialog;
public function nativeAlertAffichageSimple(message:String, title:String="", labelButton:String="OK", othersLabelsButtons:String="", theme:int=0x00000001):void{
dialog = NativeAlertDialog.show(message, title, labelButton, othersLabelsButtons, mess, true,theme);
var m:NativeListDialog = new NativeListDialog();
m.addEventListener(NativeDialogEvent.CLOSED,function(event:NativeDialogEvent):void{
mess("Debug : Old resultatNativeAlertEventIndex[0].resultIndex ="+resultatNativeAlertEventIndex[0].resultIndex);
resultatNativeAlertEventIndex.setItemAt({resultIndex : event.index},0);
mess("Debug : New resultatNativeAlertEventIndex[0].resultIndex ="+resultatNativeAlertEventIndex[0].resultIndex);
});
}
function maFonction(e:MouseEvent):void{
resultatNativeAlertEventIndex.addEventListener(CollectionEvent.COLLECTION_CHANGE,function(event:CollectionEvent):void{
if(Number(resultatNativeAlertEventIndex[0].resultIndex)==0)
{
// My code for good result
}
else{
// My code for bad result
}
});
nativeAlertAffichageSimple("Do you confirm this action to do ?","Question","Yes","No",ANDROID_HOLO_LIGHT_THEME);
}
[/code]
So, this code works perfectly independently :
[code]
resultatNativeAlertEventIndex=new ArrayCollection;
resultatNativeAlertEventIndex.addItemAt({resultIndex:-1},0);
trace("#test 1 resultatNativeAlertEventIndex[0].resultIndex = "+resultatNativeAlertEventIndex[0].resultIndex);
resultatNativeAlertEventIndex.addEventListener(CollectionEvent.COLLECTION_CHANGE, function(event:CollectionEvent):void{
trace("#test2 resultatNativeAlertEventIndex[0].resultIndex = "+resultatNativeAlertEventIndex[0].resultIndex);
});
//resultatNativeAlertEventIndex=new ArrayCollection;
resultatNativeAlertEventIndex.setItemAt({resultIndex:0},0);
Copy link to clipboard
Copied
Hey Youtch.
I noticed two things:
1) in your function nativeAlertAffichageSimple, you create 2 dialogs simultaneously (dialog and m), but the second one (m) is never used. Are you sure this is what you want ? (you never call m.show()).
2) Also: In the version i used some weeks ago, event.index in NativeDialogEvent was a String, not a Number (took me some time to realize it back then).
V.
Copy link to clipboard
Copied
I understood these points recently...
1) There isnt two dialogs in my script, there is two steps : I'm creating a dialog window with the first, and I'm working with its dialoeg event with the second. After reading the documentation it appears that iNativedialog is an Interface, type of class which can't be instanced as classic object... It must be implemented with other class : NativeAlertDialog or NativeListDialog, and to finish I tested to make addEventListener on NativeAlertDialog... it don't work. Don't know why...
2) I must convert the resulting variable, to compare it with 0 (button Yes) or 1 (button 1). So yes, it must really be a numeric value.
Youtch.