守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 3272|回复: 2
打印 上一主题 下一主题

NativeDialogs

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52693
    钢镚
    1422

    开源英雄守望者

    跳转到指定楼层
    楼主
    发表于 2015-1-4 14:15:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    应用下载
    应用名称: NativeDialogs
    支持64位:
    当前版本: 未知
    运行平台: Android IOS 
    开发语言: ActionScript 3 JAVA 其他 
    应用类别: ANE-多平台
    应用简介: Adobe Air Native Extension for mobile native dialogs (IOS,Andoid) - Toast, Text Input dialog, Progress dialog, Alert dialog, multi single choice dialog + DatePicker dialog
    本帖最后由 破晓 于 2015-5-7 10:21 编辑

    建议使用这个

    支持64位,作者一直在更新


    Alert + DatePicker ANE(IOS,Andoid)


    下面这个好久没更新了



    地址:https://github.com/mateuszmackowiak/NativeDialogs
    https://github.com/mateuszmackowiak/NativeAlert

    相关链接:各位用NativeAlert ANE时都怎么测试啊

    使用骨骼工具及制作SWC



    Native Dialogs - Adobe air Native Extension

    Adobe Air Native Extension for mobile native dialogs (IOS,Andoid) - Toast, Text Input dialog, Progress dialog, Alert dialog, multi / single choice dialog, DatePicker dialog , PickerList dialog

    warning

    In iOS7 there have been changes to the api that blocks adding subiews to the alert Dialog. I plan to change it a little. For now user themes for iOS NativeProgressDialog.


    NativePickerDialog (IOS/Andorid)Displays a dialog with a scrollable list. On IOS - the native picker

    Usage


    1. protected function onsPickerButtonClicked(event:MouseEvent):void
    2.         {
    3.             var picker:NativePickerDialog = new NativePickerDialog();
    4.             var pickerlist1:PickerList = new PickerList(["HAHAHA","ATATAT","tatasd"],1);
    5.             pickerlist1.addEventListener(NativeDialogListEvent.LIST_CHANGE,mess);

    6.             var pickerlist2:PickerList = new PickerList(["affasf","sagasdg","ah5we","fdsad"],2);
    7.             pickerlist2.addEventListener(NativeDialogListEvent.LIST_CHANGE,mess);

    8.             picker.dataProvider = Vector.<PickerList>([pickerlist1,pickerlist2]);

    9.             picker.addEventListener(NativeDialogEvent.CLOSED,readAllSelectedValuesFromPickers);

    10.             picker.show();
    11.         }

    12.         private function readSelectedValuesFromPickerList(event:NativeDialogListEvent):void
    13.         {
    14.             var pickerList:PickerList = PickerList(event.target);
    15.             trace(event);
    16.             trace("selectedIndex: "+pickerList.selectedIndex);
    17.             trace("selectedItem: "+pickerList.selectedItem);
    18.         }

    19.         private function readAllSelectedValuesFromPickers(event:NativeDialogEvent):void
    20.         {
    21.             var picker:NativePickerDialog = NativePickerDialog(event.target);
    22.             var v:Vector.<PickerList> = picker.dataProvider;
    23.             var pickerList:PickerList;
    24.             trace(event);
    25.             for (var i:int = 0; i < v.length; i++)
    26.             {
    27.                 pickerList = v[i];
    28.                 trace("pickerlist "+i);
    29.                 trace("selectedIndex: "+pickerList.selectedIndex);
    30.                 trace("selectedItem: "+pickerList.selectedItem);
    31.             }

    32.             picker.dispose();
    33.         }
    复制代码
    NativeDatePickerDialog (IOS/Andorid)Displays a native date-picker dialog. (Now DISPLAY_MODE_DATE_AND_TIME works on Android)
    Usage
    1. protected function showDatePicker():void
    2.     {
    3.         var d:NativeDatePickerDialog = new NativeDatePickerDialog();
    4.         d.addEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    5.         d.addEventListener(NativeDialogEvent.CANCELED,trace);
    6.         d.addEventListener(NativeDialogEvent.OPENED,trace);
    7.         d.addEventListener(Event.CHANGE,function(event:Event):void
    8.         {
    9.             var n:NativeDatePickerDialog = NativeDatePickerDialog(event.target);
    10.             trace(event);
    11.             trace("Date set to:"+String(n.date));
    12.         });
    13.         d.buttons = Vector.<String>(["Cancle","OK"]);
    14.         d.displayMode = NativeDatePickerDialog.DISPLAY_MODE_DATE_AND_TIME;
    15.         d.title = "DatePicker";
    16.         d.message = "Select date:";
    17.         d.show(false);
    18.     }
    19.     private function onCloseDialog(event:NativeDialogEvent):void
    20.     {
    21.         var m:iNativeDialog = iNativeDialog(event.target);
    22.         m.removeEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    23.         trace(event);
    24.         m.dispose();//Must be called if not used again
    25.     }
    复制代码
    NativeAlertDialog (IOS/Android)Displays a native alert dialog.
    Usage:
    1. private function showAlert(){
    2.     NativeAlertDialog.showAlert( "some message" , "title" ,  Vector.<String>(["OK","Cancle"]) ,
    3.         function someAnswerFunction(event:NativeDialogEvent):void{
    4.             //event.preventDefault();
    5.             var buttonPressed:String = event.index;// the index of the pressed button
    6.             // IMPORTANT:
    7.             //default behavior is to remove the default listener "someAnswerFunction()" and to call the dispose()
    8.             //
    9.             trace(event);
    10.         });

    11. /*
    12.     var a:NativeAlertDialog = new NativeAlertDialog();
    13.     a.addEventListener(NativeDialogEvent.OPENED,trace);


    14.      // This solution (a.closeHandler) is added only in NativeAlertDialog class to create a default handler.
    15.      // By default the dialog will be desposed using this method
    16.     a.closeHandler = function(e:NativeDialogEvent):void{
    17.         trace(e);
    18.     };

    19.     a.title = "Title";
    20.     a.message = "Some message.";
    21.     a.closeLabel = "OK";
    22.     a.show();

    23. */
    复制代码
    NativeProgressDialog (Android / IOS)Displays a progress dialog.
    Some help provided by memeller
    Available themes for IOS:
    • IOS_SVHUD_BLACK_BACKGROUND_THEME - uses SVProgressHUD
    • IOS_SVHUD_NON_BACKGROUND_THEME - uses SVProgressHUD
    • IOS_SVHUD_GRADIENT_BACKGROUND_THEME - uses SVProgressHUD
    • DEFAULT_THEME (cancleble is ignored)
    Usage:
    1. private var progressPopup:NativeProgressDialog;
    2. private var myTimer:Timer = new Timer(100);

    3. protected function showProgressDialog():void
    4. {
    5.     var p:NativeProgressDialog= new NativeProgressDialog();
    6.     p.addEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    7.     p.addEventListener(NativeDialogEvent.CANCELED,trace);
    8.     p.addEventListener(NativeDialogEvent.OPENED,trace);
    9.     p.secondaryProgress = 45;
    10.     p.max = 50;
    11.     p.title = "Title";
    12.     p.message ="Message";
    13.     p.showProgressbar();

    14.     progressPopup = p;

    15.     myTimer.addEventListener(TimerEvent.TIMER, updateProgress);
    16.     myTimer.start();
    17. }

    18. private function onCloseDialog(event:NativeDialogEvent):void
    19. {
    20.     var m:iNativeDialog = iNativeDialog(event.target);
    21.     m.removeEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    22.     trace(event);
    23.     m.dispose();
    24. }



    25. private function updateProgress(event:TimerEvent):void
    26. {
    27.     var p:int = progressPopup.progress;
    28.     p++;
    29.     if(p>=50){
    30.         p = 0;
    31.         progressPopup.hide(1);
    32.         myTimer.removeEventListener(TimerEvent.TIMER,updateProgress);
    33.         (event.target as Timer).stop();
    34.     }
    35.     else{
    36.         if(p==25){
    37.             progressPopup.shake();
    38.             //progressPopup.setMessage("some message changed in between");
    39.             //progressPopup.setTitle("some title changed in between");
    40.         }
    41.         try{
    42.             progressPopup.setProgress(p);
    43.         }catch(e:Error){
    44.             trace(e);
    45.         }
    46.     }
    47. }
    复制代码
    NativeListDialog(Android / IOS)Displays a native popup dialog with a multi-choice or single-choice list.IOS uses: SBTableAlertUsage:
    1. private function showMultiChoiceDialog():void{
    2.         var m:NativeListDialog = new NativeListDialog();

    3.         m.addEventListener(NativeDialogEvent.CANCELED,trace);
    4.         m.addEventListener(NativeDialogEvent.OPENED,trace);
    5.         m.addEventListener(NativeDialogEvent.CLOSED,readSelected);
    6.         m.addEventListener(NativeDialogListEvent.LIST_CHANGE,function(event:NativeDialogListEvent):void
    7.         {
    8.             trace(event);
    9.             var m:iNativeDialog = iNativeDialog(event.target);
    10.             m.shake();
    11.         });

    12.         m.buttons = Vector.<String> (["OK","Cancle"]);
    13.         m.title = "Title";
    14.         m.message = "Message";
    15.         m.dataProvider = Vector.<Object>(["one","two","three"]);
    16.         m.displayMode = NativeListDialog.DISPLAY_MODE_MULTIPLE;
    17.         m.show();
    18.     }


    19.     protected function showSingleChoiceDialog(event:MouseEvent):void
    20.     {
    21.         var m:NativeListDialog = new NativeListDialog();

    22.         m.addEventListener(NativeDialogEvent.CANCELED,trace);
    23.         m.addEventListener(NativeDialogEvent.OPENED,trace);
    24.         m.addEventListener(NativeDialogEvent.CLOSED,readSelected);
    25.         m.addEventListener(NativeDialogListEvent.LIST_CHANGE,trace);

    26.         m.buttons = Vector.<String> (["OK","Cancle"]);
    27.         m.title = "Title";
    28.         m.message = "Message";
    29.         m.dataProvider = Vector.<Object>(["one","two","three"]);
    30.         m.displayMode = NativeListDialog.DISPLAY_MODE_SINGLE;
    31.         m.show();
    32.     }



    33.     private function readSelected(event:NativeDialogEvent):void
    34.     {
    35.         var m:NativeListDialog = NativeListDialog(event.target);

    36.         trace(event);
    37.         trace("selectedIndex: "+m.selectedIndex);
    38.         trace("selectedIndexes: "+m.selectedIndexes);
    39.         trace("selectedItem: "+m.selectedItem);
    40.         trace("selectedItems: "+m.selectedItems);

    41.         m.dispose();
    42.     }
    43.     private function onCloseDialog(event:NativeDialogEvent):void
    44.     {
    45.         var m:iNativeDialog = iNativeDialog(event.target);
    46.         m.removeEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    47.         trace(event);
    48.         m.dispose();
    49.     }
    复制代码
    Text input Dialog (Android /IOS)Displays a dialog with defined text-fields..(on IOS 5 uses default dialog) - on ios 4 don't know if Apple will not refusesImportant:IOS limitations - There can be only 2 buttons and 2 text inputs.To display message specyfie for the first NativeTextField editable == falseUsage:
    1. protected function showTextInput():void
    2. {
    3.     var t:NativeTextInputDialog = new NativeTextInputDialog();
    4.     t.addEventListener(NativeDialogEvent.CANCELED,trace);
    5.     t.addEventListener(NativeDialogEvent.CLOSED,onCloseDialog);

    6.     var v:Vector.<NativeTextField> = new Vector.<NativeTextField>();

    7.     //creates a message text-field  
    8.     var message:NativeTextField = new NativeTextField(null);
    9.     message.text = "Message";
    10.     message.editable = false;
    11.     v.push(message);

    12.     // create text-input
    13.     var serverAdressTextInput:NativeTextField = new NativeTextField("serverAdress");
    14.     serverAdressTextInput.displayAsPassword = true;
    15.     serverAdressTextInput.prompText = "prompt";
    16.     serverAdressTextInput.softKeyboardType = SoftKeyboardType.URL;
    17.     serverAdressTextInput.addEventListener(Event.CHANGE,function(event:Event):void{
    18.         var tf:NativeTextField = NativeTextField(event.target);
    19.         tf.nativeTextInputDialog.shake();
    20.     });
    21.     // on return click
    22.     serverAdressTextInput.addEventListener(TextEvent.TEXT_INPUT,function(event:Event):void{
    23.         var tf:NativeTextField = NativeTextField(event.target);
    24.         tf.nativeTextInputDialog.hide(0);
    25.     });
    26.     v.push(serverAdressTextInput);

    27.     t.textInputs = v;
    28.     t.title = "Title";
    29.     t.show();

    30. }

    31. private function onCloseDialog(event:NativeDialogEvent):void
    32. {
    33.     var m:iNativeDialog = iNativeDialog(event.target);
    34.     m.removeEventListener(NativeDialogEvent.CLOSED,onCloseDialog);
    35.     trace(event);
    36.     m.dispose();
    37. }
    复制代码
    Toast (Android / IOS)For IOS uses : WToastUsage:
    1. Toast.show("some message",Toast.LENGTH_LONG);
    复制代码
    If You like what I make please donate:
    Before creating an Issue. Please:
    • Please make sure that Your code is not the reason of the error.
    • On Android: Try downloading the Android sdk and use "androidSDK/platform-tools/adb logcat" to pin to the android logs of the device. If something goes wrong there should be some output.
    • On IOS: To see the answers of the console with the terminal (IOS Simulator) type: "tail -f /var/log/system.log" in the console. To see it on the device download form the app store a free app "Console" and if the app crashes go to the app.
    • Please send part of Your code that causes the problem.
    LicenseThis project made available under the MIT License.Copyright (C) 2013 Mateusz MaćkowiakPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏 分享分享 支持支持 反对反对 微信
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52693
    钢镚
    1422

    开源英雄守望者

    来自 3#
     楼主| 发表于 2015-5-7 10:17:25 | 只看该作者
    建议使用这个

    支持64位,作者一直在更新


    Alert + DatePicker ANE(IOS,Andoid)
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52693
    钢镚
    1422

    开源英雄守望者

    沙发
     楼主| 发表于 2015-1-22 10:27:00 | 只看该作者
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-4-19 18:03 , Processed in 0.059536 second(s), 33 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表