Cocos2d-js's UI with Cocostudio development notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.