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 ...
随机推荐
- HTTP协议-----小白
HTTP是一个属于应用层的面向对象的协议. ***OSI的7层从上到下分别是 7 应用层 6 表示层 5 会话层 4 传输层 3 网络层 2 数据链路层 1 物理层 HTTP协议的主要特点可概括如下: ...
- window下flask开发环境搭建
1.安装python 官网下载https://www.python.org/downloads/,按提示安装就行,记住安装目录,把它添加到系统path中. 2.安装pip 官网下载pip文件:http ...
- css3之景深
perspective属性:(目前仅仅支持-webkit-perspective属性,视点距离) 值:number perspective-origin属性:(视点位置) 值:number% numb ...
- Java 类反射机制分析
Java 类反射机制分析 一.反射的概念及在Java中的类反射 反射主要是指程序可以访问.检测和修改它本身状态或行为的一种能力.在计算机科学领域,反射是一类应用,它们能够自描述和自控制.这类应用通过某 ...
- Max Sum
Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub ...
- php 学习日志- 变量作用域
1.global 函数内访问全局变量 <?php $x=5; $y=10; function myTest() { global $x,$y; $y=$x+$y; } myTest(); ech ...
- html 页面内锚点定位及跳转方法总结
第一种方法,也是最简单的方法是锚点用<a>标签,在href属性中写入DIV的id.如下: <!DOCTYPE html><html><head> < ...
- 怎么实现CSS限制字数,超出部份显示点点点.
如何实现CSS限制字数,超出部份显示点点点... <div style="width:200px; white-space:nowrap;overflow:hidden;text-ov ...
- java:关于继承变量的值问题
1.在java中,如果子类继承父类的静态变量时,当你在子类面前修改这个静态变量的值,其父类的静态变量也会改变. 案例: //父类public class Animal { //静态属性 public ...
- python模块及包的导入
一.模块 通常模块为一个文件,直接使用import来导入就好了.可以作为module的文件类型有".py".".pyo".".pyc".&q ...