home wiki.fukuchiharuki.me
Menu
*キーワード [#yb737c53]
- Titanium Mobile
- Alloy

*概要 [#y8ca614d]
コントロールにイベントハンドラを取りつけます。

*方法 [#e1e86c56]
- index.xml
 <Label id="label1">I am Window 1</Label>

- index.js
 $.label1.addEventListener('click', function() {
 	Titanium.UI.createAlertDialog({title:'Click', message:'You clicked it.'}).show();
 });

*解説 [#ue1ca936]
index.xml のタグ中に onclick 属性を書くこともできるようですが、分離の観点から index.js に書くのがよいでしょう。

*参考 [#t17fd539]
- [[Titanium 3.X - Appcelerator Docs>http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Proxy-method-addEventListener]]