ssc
接了一个ssc的小项目,却因为对方的不作答而半途而废。我写了一天的代码算是废了。
主程序
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"
width="" height="" xmlns:cc="*"> <mx:Script>
<![CDATA[
import com.adobe.serialization.json.JSON;
import mx.controls.Alert;
import mx.formatters.DateFormatter; [Bindable]
public var t1:int;
[Bindable]
public var t2:int;
[Bindable]
public var t3:int;
[Bindable]
public var t4:int; [Bindable]
public var now:Date; [Bindable]
public var balls:Array = []; public static var INTERVAL:int = *; public static var BALL_COUNT:int = ; public var count:int; public function init():void { now = new Date();
var timer:Timer = new Timer();
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start(); var ss:String = JSON.encode(null);
//getBalls(); var obj:Object = {};
obj.a = ;
obj.b = "asdf";
Alert.show(obj+"");
var xx:XML = <asfasf/>
xx.appendChild(obj);
Alert.show(xx.toXMLString()); } public function getBalls():void {
var center:Point = new Point(ballbox.width/, ballbox.height/-);
var radis:Number = ballbox.width/ - ;
trace(radis + " / " + ballbox.width/);
for(var i:int=;i<=BALL_COUNT;i++) {
balls[i] = (int)(Math.random()*);
trace(balls[i]); var btn:Button = new Button();
btn.width = ;
btn.height = ;
btn.setStyle("cornerRadius", );
btn.label = balls[i]+"";
btn.x = radis*Math.sin(*i/(BALL_COUNT-)) + center.x;
btn.y = radis*Math.cos(*i/(BALL_COUNT-)) + center.y;
ballbox.addChild(btn); trace("" + btn.x + " / " + btn.y);
} } public function onTimer(e:TimerEvent):void {
count ++;
if(count == INTERVAL) {
count = ;
t1 = ;
t2 = ;
t1 = ;
t2 = ;
// lottery
Alert.show("开奖了!");
}
var left:int = INTERVAL - count;
var minutes:int = left/;
var seconds:int = left%;
if(minutes>=) {
t1 = ;
t2 = ;
} else {
t1 = ;
t2 = minutes;
}
if(seconds>=) {
t3 = seconds/;
t4 = seconds%;
} else {
t3 = ;
t4 = seconds;
} } ]]>
</mx:Script>
<mx:Panel title="欢迎光临本店" width="100%" height="100%">
<mx:Button color="red" label=""/>
<mx:HBox horizontalAlign="right" width="100%">
<mx:Text text="距离本期销售截止,还有"/>
<mx:Button id="n1" label="{t1}" fontSize="" fontWeight="bold"/>
<mx:Button id="n2" label="{t2}" fontSize="" fontWeight="bold"/>
<mx:Text text="分"/>
<mx:Button id="n3" label="{t3}" fontSize="" fontWeight="bold"/>
<mx:Button id="n4" label="{t4}" fontSize="" fontWeight="bold"/>
<mx:Text text="秒"/>
</mx:HBox> <mx:Canvas id="ballbox" height="100%" width="100%">
</mx:Canvas> </mx:Panel>
<mx:HBox x="" y="" horizontalGap="">
<cc:RollableBall2 cW="" cH=""/>
<cc:RollableBall2 cW="" cH=""/>
<cc:RollableBall2 cW="" cH=""/>
<cc:RollableBall2 cW="" cH=""/>
<cc:RollableBall2 cW="" cH=""/>
</mx:HBox> <mx:HBox x="" y="" horizontalGap="">
<cc:RollableBall3 cW="" cH=""/>
<cc:RollableBall3 cW="" cH=""/>
<cc:RollableBall3 cW="" cH=""/>
<cc:RollableBall3 cW="" cH=""/>
<cc:RollableBall3 cW="" cH=""/>
</mx:HBox>
</mx:Application>
按钮控件
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="{this.cW}" height="{this.cH}" creationComplete="init()"
horizontalScrollPolicy="off" verticalScrollPolicy="off" fontSize="{this.cW/3}" fontWeight="bold" fontThickness="{this.cW/20}"
borderThickness="" borderColor="blue" borderStyle="outset"> <mx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.controls.Button; public var TOTAL_INTERVAL:int = *; public var interval:int = ; public static var ROLL_COUNT:int = ; public var count:int = ; public var ecliipsedTime:int = ; public var y1:int = ;
public var y2:int = -; public var btn1:Button = new Button();
public var btn2:Button = new Button(); [Bindable]
public var cW:int;
[Bindable]
public var cH:int; public function init():void {
btn1.label = (int)(Math.random()*);
btn1.width = cW;
btn1.height = cH;
//btn1.setStyle("fontSize", 20);
btn2.label = (int)(Math.random()*);
btn2.width = cW;
btn2.height = cH;
btn2.y = -cH;
//btn2.setStyle("fontSize", 20);
this.addChild(btn1);
this.addChild(btn2);
start();
} public function start():void {
var delay:int = (int)(Math.random()*);
var t:Timer = new Timer(delay, );
t.addEventListener(TimerEvent.TIMER, doStart);
t.start();
} public function doStart(e:TimerEvent):void { goTimer();
} public function goTimer():void { flash.utils.setTimeout(function():void{
//Alert.show("sleep test ok");
onTimer();
},interval,null);
} public function newBtn():Button {
return null;
} // 开始滚动的时候要慢, 快要停止id时候也要慢!
public function onTimer():void {
ecliipsedTime += interval;
count ++; if(count>=ROLL_COUNT*/) {
interval += Math.random()*;
} // if(count>=ROLL_COUNT*9/10) {
// interval += 100;
// }
// if(count>=ROLL_COUNT*29/30) {
// interval += 200;
// }
// if(count>=ROLL_COUNT*49/50) {
// interval += 500;
// } // if(TOTAL_INTERVAL-ecliipsedTime<=1) {
// interval += 20;
// } if(count>ROLL_COUNT) {
return;
} y1 += ;
if(y1>=cH) {
y1 = -;
btn1.label = (int)(Math.random()*);
}
btn1.y = y1; y2 += ;
if(y2>=cH) {
y2 = -;
btn2.label = (int)(Math.random()*);
}
btn2.y = y2; goTimer();
} ]]>
</mx:Script>
</mx:Canvas>
按钮控件
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="{this.cW}" height="{this.cH*3}" creationComplete="init()"
horizontalScrollPolicy="off" verticalScrollPolicy="off" fontSize="{this.cW/3}" fontWeight="normal" fontThickness="{this.cW/20}"
borderThickness="" borderColor="blue" borderStyle="outset"> <mx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.controls.Button; public var TOTAL_INTERVAL:int = *; public var interval:int = ; public static var ROLL_COUNT:int = ; public var count:int = ; public var ecliipsedTime:int = ; public var y1:int;
public var y2:int;
public var y3:int;
public var y4:int; public var btn1:Button = new Button();
public var btn2:Button = new Button();
public var btn3:Button = new Button();
public var btn4:Button = new Button(); [Bindable]
public var cW:int;// button 宽度
[Bindable]
public var cH:int;// button 高度 public function init():void { y1 = ;
y2 = cH*;
y3 = cH*;
y4 = -cH; btn1.label = (int)(Math.random()*);
btn1.width = cW;
btn1.height = cH;
btn1.y = y1;
//btn1.setStyle("fontSize", 20);
this.addChild(btn1);
btn2.label = (int)(Math.random()*);
btn2.width = cW;
btn2.height = cH;
btn2.y = y2;
this.addChild(btn2);
btn3.label = (int)(Math.random()*);
btn3.width = cW;
btn3.height = cH;
btn3.y = y3;
this.addChild(btn3);
btn4.label = (int)(Math.random()*);
btn4.width = cW;
btn4.height = cH;
btn4.y = y4;
this.addChild(btn4); start();
} public function start():void {
var delay:int = (int)(Math.random()*);
var t:Timer = new Timer(delay, );
t.addEventListener(TimerEvent.TIMER, doStart);
t.start();
} public function doStart(e:TimerEvent):void { goTimer();
} public function goTimer():void { flash.utils.setTimeout(function():void{
//Alert.show("sleep test ok");
onTimer();
},interval,null);
} public function newBtn():Button {
return null;
} public function onTimer():void {
ecliipsedTime += interval;
count ++; // if(count>=ROLL_COUNT*9/10) {
// interval += Math.random()*100;
// } // if(count>=ROLL_COUNT*9/10) {
// interval += 100;
// }
// if(count>=ROLL_COUNT*29/30) {
// interval += 200;
// }
// if(count>=ROLL_COUNT*49/50) {
// interval += 500;
// } // if(TOTAL_INTERVAL-ecliipsedTime<=1) {
// interval += 20;
// } if(count>ROLL_COUNT) {
btn2.setStyle("fontWight", "bold");
btn2.setStyle("fontSize", this.cW/);
btn2.setStyle("color", "red");
btn2.setStyle("fontThickness", this.cW/); btn2.invalidateProperties();
btn2.invalidateSize();
btn2.invalidateDisplayList();
return;
} y1 += ;
if(y1>=cH*) {
y1 = -cH;
btn1.label = (int)(Math.random()*);
}
btn1.y = y1; y2 += ;
if(y2>=cH*) {
y2 = -cH;
btn2.label = (int)(Math.random()*);
}
btn2.y = y2; y3 += ;
if(y3>=cH*) {
y3 = -cH;
btn3.label = (int)(Math.random()*);
}
btn3.y = y3; y4 += ;
if(y4>=cH*) {
y4 = -cH;
btn4.label = (int)(Math.random()*);
}
btn4.y = y4; goTimer();
} ]]>
</mx:Script>
</mx:Canvas>
ssc的更多相关文章
- 【转】一篇文章读懂人力资源三支柱体系(COE・BP・SSC)
通过人力资源转型,提升效率和效能 作者:Sharon Li,翰威特大中华区咨询总监. 杰克韦尔奇曾说过“人力资源负责人在任何企业中都应该是第二号人物”,但在中国,99%的企业都做不到.原因很简单, ...
- “智慧海绵城市”(SSC)监测评价体系整体解决方案
一.方案简介 无论是内涝防治.黑臭水体治理,还是海绵城市规划设计及建设.评估,乃至未来智慧城市的建设,都需要有全面.致密.大量的城市水文监测数据和先进模拟仿真技术作基础支撑,唯有如此,决策才有据可依, ...
- [ssc] 数据库管理工具——SQuirreL SQL Client使用入门
简单介绍: SQuirrel SQL Client是一个用Java写的数据库客户端,用JDBC统一数据库访问接口以后,可以通过一个统一的用户界面来操作MySQL PostgreSQL MSSQL Or ...
- 重庆/北京/江苏KS/快乐时时/七星/福运来菠菜电商开奖修复APP网站SSC网站程序开发php
网站制作是指使用标识语言(markup language),通过一系列设计.建模.和执行的过程将电子格式的信息通过互联网传输,最终以图形用户界面(GUI)的形式被用户所浏览.简单来说,网页设计的目的就 ...
- ssc项目Python爬虫心得
###今日心得 ####time.datetime 1.字符串格式到标准化格式:time.strptime(str, "%Y%m%d") 2.今天的标准化格式:today = da ...
- Spark踩坑记——Spark Streaming+Kafka
[TOC] 前言 在WeTest舆情项目中,需要对每天千万级的游戏评论信息进行词频统计,在生产者一端,我们将数据按照每天的拉取时间存入了Kafka当中,而在消费者一端,我们利用了spark strea ...
- 从netty-example分析Netty组件
分析netty从源码开始 准备工作: 1.下载源代码:https://github.com/netty/netty.git 我下载的版本为4.1 2. eclipse导入maven工程. netty提 ...
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
- Java I/O and NIO [reproduced]
Java I/O and NIO.2---Five ways to maximize Java NIO and NIO.2---Build more responsive Java applicati ...
随机推荐
- Python 第五天 装饰器
装饰器 装饰器是函数,只不过该函数可以具有特殊的含义,装饰器用来装饰函数或类,使用装饰器可以在函数执行前和执行后添加相应操作. def wrapper(func): def result(): pri ...
- 【转】webGL与OpenGL的不同
原链接 http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences WebGL and OpenGL Differences ...
- Android应用第一次安装成功点击“打开”后Home键切出应用后再点击桌面图标返回导致应用重启问题
最近项目中遇到一个问题,用户第一次安装应用在系统的安装器安装完成界面有“完成”和“打开”两个按钮. 当用户点击“打开”按钮进入用户注册页面进行手机号验证码发送和验证码输入等操作界面,若此时用户点击Ho ...
- openjudge2985(数字组合)
描述 有n个正整数,找出其中和为t(t也是正整数)的可能的组合方式.如:n=5,5个数分别为1,2,3,4,5,t=5:那么可能的组合有5=1+4和5=2+3和5=5三种组合方式.输入输入的第一行是两 ...
- 简单的css js控制table隔行变色
(1)用expression 鼠标滑过变色: <style type="text/css"><!-- table { background-color:#0000 ...
- 如何获取URL中的参数
获取URL中的某个参数或者所有参数以便我们后续去修改这个地址,在程序中是非常必要的.网上有很多这样的代码片段,为了以后查阅方便,顺便整理思路,下面使用2种方法来获取URL中的某个参数. 方法一 ,sp ...
- JQuery延时操作
JQuery通过setTimeout函数可以实现延时操作以完成在编程达到某些需要的效果. 使用方法如下: function doSomething() { alert("hello worl ...
- 如何解决SoftekBarcode.dll加载失败的问题
本文转自:慧都控件网 Softek Barcode Reader Toolkit是专门从事于条形码读取技术的软件公司Softek旗下一款著名的条码读取工具包.最近有部分用户反映在运行此工具包时会遇到“ ...
- 转载:JProfiler远程监控LINUX上的Tomcat过程细讲
来源于xuwanbest的博客 所谓"工欲善其事,必先利其器",好的工具确能起到事半工倍的作用.我用到的最多的就两个JConsole 和JProfiler .JConsole监 ...
- BNUOJ 51279[组队活动 Large](cdq分治+FFT)
传送门 大意:ACM校队一共有n名队员,从1到n标号,现在n名队员要组成若干支队伍,每支队伍至多有m名队员,求一共有多少种不同的组队方案.两个组队方案被视为不同的,当且仅当存在至少一名队员在两种方案中 ...