zoukankan      html  css  js  c++  java
  • titanium开发教程0201监听事件

    1

    var win = Titanium.UI.createWindow({
    	title:"监听事件",
    	backgroundColor:"#FFFFFF",
    	exitOnClose:true
    });
    
    var img01 = Titanium.UI.createImageView({
    	image:"images/box01.png",
    	height:75,
    	75,
    	top:24,
    	left:24
    });
    
    var img02 = Titanium.UI.createImageView({
    	image:"images/box02.png",
    	height:75,
    	75,
    	top:24,
    	right:24
    });
    
    var img03 = Titanium.UI.createImageView({
    	image:"images/box03.png",
    	height:75,
    	75,
    	top:110,
    	left:24
    });
    
    var img04 = Titanium.UI.createImageView({
    	image:"images/box04.png",
    	height:75,
    	75,
    	top:110,
    	right:24
    });
    
    var label = Titanium.UI.createLabel({
    	text:"输出结果",
    	bottom:100,
    	textAlign:"center"
    });
    
    img01.addEventListener("click", function(e){
    	label.text = e.source.image;//这将打印出图像的地址
    });
    
    img02.addEventListener("click", function(e){
    	label.text = e.source.image;
    });
    
    img03.addEventListener("click", function(e){
    	label.text = e.source.image;
    });
    
    img04.addEventListener("click", function(e){
    	label.text = e.source.image;
    });
    
    
    win.add(img01);
    win.add(img02);
    win.add(img03);
    win.add(img04);
    win.add(label);
    
    win.open();
  • 相关阅读:
    转:python2.x 和 python3.x的区别
    迭代器
    C++学习笔记-预备知识
    phpstudy扩展mongoDB
    Linux gd库安装步骤说明
    Linux jpeglib库的安装
    github开源项目
    本地文件拖拽到虚拟机里,文件存储位置
    linux php 扩展安装
    CentOS6.10 Nginx无法解析php文件
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2400941.html
Copyright © 2011-2022 走看看