1, first use Ccs.load (). Node to load the JSON file and add the nodes.
Settingscene CCS. Load (res. Setting_json). Node
2, add the node in the current layer.
this. AddChild (settingscene);
3. Get control through Ccui.helper.seekWidgetByName (node,name)
ccui. Helper. Seekwidgetbyname (settingscene"Musicslider");
4, through the Addccseventlistener monitoring event (Sender,type)
Musicslider. Addccseventlistener (this.) Sliderstatechange);
5, different controls when listening to events type different(1) Slider
ccui. Slider. event_percent_changed
The data that can be obtained:
Sender. getpercent ()
(2) button
Switch(type) {
CaseCcui.Widgets.Touch_began:
Break;
CaseCcui.Widgets.touch_moved:
Break;
CaseCcui.Widgets.touch_ended:
Break;
CaseCcui.Widgets.touch_canceled:
Break;
default:
Break;
}(3) TextField to obtain the contents of the input box in the form use the GetString () method
Switch(type) {
CaseCcui.TextField.Event_attach_with_ime:
Break;
CaseCcui.TextField.Event_detach_with_ime:
Break;
CaseCcui.TextField.Event_insert_text:
Break;
CaseCcui.TextField.Event_delete_backward:
Break;
default:
Break;
}(4) CheckBox inference checkbox use check using IsSelected () method
Switch(type) {
CaseCcui.CheckBox.event_selected:
Break;
CaseCcui.CheckBox.event_unselected:
Break;
default:
Break;
}
Cocos2d-js's UI with Cocostudio development notes