cocostudio——js 3 final控件事件

cocostudio——js 3 final控件事件,第1张

概述http://www.2cto.com/kf/201410/346470.html 最近试用了下cocos ide,然后引擎用的cocos2dx js 3 final,需要build runtime一下,下面是cocos studio相关的一些事件: 添加事件侦听: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2


http://www.2cto.com/kf/201410/346470.HTML

最近试用了下cocos IDe,然后引擎用的cocos2dx Js 3 final,需要build runtime一下,下面是cocos studio相关的一些事件:

添加事件侦听:

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 @H_404_98@ 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 // button var root = ccs.uiReader.WidgetFromJsonfile( "res/UIbutton_Editor/UIbutton_Editor_1.Json" ); this .addChild(root); var back_label = ccui.helper.seekWidgetByname(root, "back" ); back_label.addtouchEventListener( .backEvent, ); var button = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"button_123" ); button.addtouchEventListener( .touchEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); var Title_button = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"button_126" ); Title_button.addtouchEventListener( ); var scale9_button = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"button_129" ); scale9_button.addtouchEventListener( ); // check Box "res/UICheckBox_Editor/ui_checkBox_editor_1.Json" ); .addChild(root); var checkBox = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"CheckBox_540" ); cc.log(checkBox.addEventListener); checkBox.addEventListener( .selectedStateEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); // List vIEw var ListVIEW_RES = [ "res/UIListVIEw_Editor/UIListVIEw_Vertical_Editor/ui_ListvIEw_editor_1.Json" , "res/UIListVIEw_Editor/UIListVIEw_Horizontal_Editor/ui_ListvIEw_horizontal_editor_1.Json" ]; var root = ccs.uiReader.WidgetFromJsonfile(ListVIEW_RES[ 0 ]); .addChild(root); var ListVIEw = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"ListVIEw_1214" ); ListVIEw.addEventListener( .selectedItemEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); // page vIEw "res/UIPageVIEw_Editor/ui_pagevIEw_editor_1.Json" ); .addChild(root); var pageVIEw =ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"PageVIEw_1269" ); pageVIEw.addEventListener( .pageVIEwEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); // RichText var richText = ccui.RichText.create(); richText.ignoreContentAdaptWithSize( false ); richText.setContentSize(cc.size( 120 100 )); var re1 = ccui.RichElementText.create( 1 255 "This color is white. " "Helvetica" 10 ); var re2 = ccui.RichElementText.create( 2 "And this is yellow. " ); var re3 = ccui.RichElementText.create( 3 "This one is blue. " ); var re4 = ccui.RichElementText.create( 4 "And green. " ); var re5 = ccui.RichElementText.create( 5 "Last one is red " ); var re6 = ccui.RichElementText.create( 7 "Have fun!! " ); richText.pushBackElement(re1); @H_790_502@ richText.insertElement(re2,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); richText.pushBackElement(re3); richText.pushBackElement(re4); richText.pushBackElement(re5); richText.pushBackElement(re6); richText.setposition(cc.p( 1280 / 720 )); .addChild(richText); // slIDer "res/UiSlider_Editor/ui_slIDer_editor_1.Json" ); .addChild(root); var slIDer = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"SlIDer_738" ); slIDer.addEventListener( .slIDerEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); var scale9_slIDer = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"SlIDer_740" ); scale9_slIDer.addEventListener( ); // text fIEld "res/UITextFIEld_Editor/ui_textfIEld_editor_1.Json" ); .addChild(root); var textFIEld_normal = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"TextFIEld_1109" ); textFIEld_normal.addEventListener( .textFIEldEvent,monospace!important; Font-size:1em!important; min-height:inherit!important; background:none!important">); var textFIEld_max_character = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"TextFIEld_1110" ); textFIEld_max_character.addEventListener( ); var textFIEld_password = ccui.helper.seekWidgetByname(root,monospace!important; Font-size:1em!important; min-height:inherit!important; color:blue!important; background:none!important">"TextFIEld_1107" ); textFIEld_password.addEventListener( );

各个事件回调:

? @H_404_661@ 86 87 88 89 90 91 92 93 94 95 96 // Widget touchEvent: function (sender,type) { switch (type) { case ccui.Widget.touch_BEGAN: cc.log( "touch Down" ); break ; ccui.Widget.touch_MOVED: "touch Move" ); ; ccui.Widget.touch_ENDED: "touch Up" ); ; ccui.Widget.touch_CANCELED: "touch Cancelled" ); ; default : ; } }, // check Box selectedStateEvent: function (sender,type) { (type) { ccui.CheckBox.EVENT_SELECTED: "Selected" ); ; ccui.CheckBox.EVENT_UNSELECTED: "Unselected" ); ; : ; } // List vIEw selectedItemEvent: function (sender,type) { (type) { ccui.ListVIEw.EVENT_SELECTED_ITEM: var ListVIEwEx = sender; "select child index = " + ListVIEwEx.getCurSelectedindex()); ; : ; } // page vIEw pageVIEwEvent: function (sender,type) { (type) { @H_790_502@ ccui.PageVIEw.EVENT_TURNING: var pageVIEw = sender; "page = " + (pageVIEw.getCurPageIndex() + )); ; : ; } // slIDer slIDerEvent: function (sender,type) { (type) { ccui.SlIDer.EVENT_PERCENT_CHANGED: var slIDer = sender; var percent = slIDer.getPercent(); "Percent " + percent.toFixed( )); ; : ; } // text fIEld textFIEldEvent: function (sender,type) { (type) { ccui.TextFIEld. EVENT_ATTACH_WITH_IME: "attach with IME" ); ; ccui.TextFIEld. EVENT_DETACH_WITH_IME: "detach with IME" ); ; ccui.TextFIEld. EVENT_INSERT_TEXT: "insert words" ); ; ccui.TextFIEld. EVENT_DELETE_BACKWARD: "delete word" ); ; : ; } } 总结

以上是内存溢出为你收集整理的cocostudio——js 3 final控件事件全部内容,希望文章能够帮你解决cocostudio——js 3 final控件事件所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1054869.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存