游戏类网站备案需要前置审批吗seo1现在怎么看不了
目录
一、链接:
一、目的
1、因为很多都有倒计时图片切换,所以我封装一个倒计时的资源,以后直接从flash赋复制,交换一下资源就可以了
二、参考
1、AS3自定义事件以及发送事件(1)——发送事件
三、操作:写在自定义类中:版本3.1
1、其余设置和版本3.1等类似
1、代码:自定义类:My_countDown
1、关键帧中调用
三、操作:写在自定义类中:版本3.1
1、项目设置
2、My_countDown 代码
3、关键帧代码:调用倒计时
三、操作:写在自定义类中:版本2.0
1、项目设置
1、关键帧代码:调用倒计时
1、 自定义类:My_countDown
三、操作:写在关键帧中
1、项目设置
1、元件:数字:
1、元件: mc_time_task
1、配置文件:config-flash.xml
1、配置文件:关键帧代码
1、倒计时:关键帧代码
一、链接:
https://download.csdn.net/download/qq_40544338/12921178
一、目的
1、因为很多都有倒计时图片切换,所以我封装一个倒计时的资源,以后直接从flash赋复制,交换一下资源就可以了
二、参考
1、AS3自定义事件以及发送事件(1)——发送事件
https://blog.csdn.net/qq_40544338/article/details/108992347
- 总结:知道自定义类发送消息给舞台
三、操作:写在自定义类中:版本3.1
1、其余设置和版本3.1等类似
1、代码:自定义类:My_countDown
/**********************/
// 作者:xzy
//功能:自定义类,让舞台添加物体,有开始、停止、重置定时器,最多实现3位倒计时
//日期:20201010
//版本:3.1
/**********************//*
完善:
版本3.2和3.1相比:添加了Clear函数,对象移除添加的监听事件
版本3.1和3.0相比:添加初始化函数Init,不通过构造函数进行创建定时器,而是通过初始化函数Init
版本3.0和2.0相比:创建时候数字元件跳到传递来的数字。
*/package MyLibrary
{import flash.display.MovieClip;import flash.utils.Timer;import flash.events.TimerEvent;import flash.events.Event;public class My_countDown extends MovieClip{//发送监听事件static public const START:String = "START";static public const OVER:String = "OVER";//任务总时长,单位:秒public var timer_task_total:int = 0;//任务当前时间public var timer_task_current:int = 0;//定时器:任务public var timer_task:Timer = null;/*构造函数:My_countDown*/public function My_countDown(){}public function Init(_total:int){timer_task_total = _total;Set_changeTime();//定时器:任务倒计时;if (timer_task==null){timer_task = new Timer(1000,timer_task_total);if (! timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.addEventListener(TimerEvent.TIMER,TIMER_timer_task);}}}public function Clear(){//定时器:任务倒计时;if (timer_task!=null){timer_task.stop();if (timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.removeEventListener(TimerEvent.TIMER,TIMER_timer_task);}timer_task = null;}}//定时器:任务倒计时public function TIMER_timer_task(e:TimerEvent){timer_task_current++;//trace("timer_task_current:"+timer_task_current);Set_changeTime();//倒计时结束:if (timer_task_current>=timer_task_total){timer_task.stop();//分发OVER事件;dispatchEvent(new Event(OVER));//新建事件传入String参数}}//开始定时器public function Set_start(){timer_task.start();//分发START事件;dispatchEvent(new Event(START));//新建事件传入String参数}//重置定时器public function Set_reset(){timer_task.reset();}//结束定时器public function Set_stop(){timer_task.stop();}/*功能:设置更换时间元件参数:_showKind:显示的种类,0:只显示个位 1:显示个位和十位 2:显示个位、十位、百位*/public function Set_changeTime(){var currentTime:int = timer_task_total - timer_task_current;//百位var currentTime_baiWei:int = currentTime / 100;//十位var currentTime_shiWei:int = (currentTime - currentTime_baiWei * 100) / 10;//个位var currentTime_geWei:int = currentTime - currentTime_baiWei * 100 - currentTime_shiWei * 10;if (currentTime_baiWei==0){currentTime_baiWei = 10;}if (currentTime_shiWei==0){currentTime_shiWei = 10;}if (currentTime_geWei==0){currentTime_geWei = 10;}//this.mc_time_bai.gotoAndStop(currentTime_baiWei);this.mc_time_shi.gotoAndStop(currentTime_shiWei);this.mc_time_ge.gotoAndStop(currentTime_geWei);}}}
1、关键帧中调用
创建
//任务倒计时
import MyLibrary.My_countDown;//创建:任务倒计时my_countDown.Init(timer_task_total);if (!my_countDown.hasEventListener(My_countDown.OVER)){my_countDown.addEventListener(My_countDown.OVER,OVER_my_countDown);}
清除
//任务倒计时:移除添加的事件my_countDown.Clear();
开启定时器
//任务倒计时开始计时 my_countDown.Set_reset();my_countDown.Set_start();
相应自定义类时间到了
//任务时间到了
function OVER_my_countDown(e:Event)
{trace("任务时间到了!");Destroy_game();gotoAndStop("失败");
}
三、操作:写在自定义类中:版本3.1
1、项目设置
2、My_countDown 代码
/**********************/
// 作者:xzy
//功能:自定义类,让舞台添加物体,有开始、停止、重置定时器,最多实现3位倒计时
//日期:20201010
//版本:3.1
/**********************//*
完善:
版本3.1和3.0相比:添加初始化函数Init,不通过构造函数进行创建定时器,而是通过初始化函数Init
版本3.0和2.0相比:创建时候数字元件跳到传递来的数字。
*/package MyLibrary
{import flash.display.MovieClip;import flash.utils.Timer;import flash.events.TimerEvent;import flash.events.Event;public class My_countDown extends MovieClip{//发送监听事件static public const START:String = "START";static public const OVER:String = "OVER";//任务总时长,单位:秒public var timer_task_total:int = 0;//任务当前时间public var timer_task_current:int = 0;//定时器:任务public var timer_task:Timer = null;/*构造函数:My_countDown*/public function My_countDown(){//timer_task_total = _total;////Set_changeTime();//定时器:任务倒计时;//if (timer_task==null)//{//timer_task = new Timer(1000,timer_task_total);//if (! timer_task.hasEventListener(TimerEvent.TIMER))//{//timer_task.addEventListener(TimerEvent.TIMER,TIMER_timer_task);//}//}}public function Init(_total:int){timer_task_total = _total;Set_changeTime();//定时器:任务倒计时;if (timer_task==null){timer_task = new Timer(1000,timer_task_total);if (! timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.addEventListener(TimerEvent.TIMER,TIMER_timer_task);}}}//定时器:任务倒计时public function TIMER_timer_task(e:TimerEvent){timer_task_current++;//trace("timer_task_current:"+timer_task_current);Set_changeTime();//倒计时结束:if (timer_task_current>=timer_task_total){timer_task.stop();//分发OVER事件;dispatchEvent(new Event(OVER));//新建事件传入String参数}}//开始定时器public function Set_start(){timer_task.start();//分发START事件;dispatchEvent(new Event(START));//新建事件传入String参数}//重置定时器public function Set_reset(){timer_task.reset();}//结束定时器public function Set_stop(){timer_task.stop();}/*功能:设置更换时间元件参数:_showKind:显示的种类,0:只显示个位 1:显示个位和十位 2:显示个位、十位、百位*/public function Set_changeTime(){var currentTime:int = timer_task_total - timer_task_current;//百位var currentTime_baiWei:int = currentTime / 100;//十位var currentTime_shiWei:int = (currentTime - currentTime_baiWei * 100) / 10;//个位var currentTime_geWei:int = currentTime - currentTime_baiWei * 100 - currentTime_shiWei * 10;if (currentTime_baiWei==0){currentTime_baiWei = 10;}if (currentTime_shiWei==0){currentTime_shiWei = 10;}if (currentTime_geWei==0){currentTime_geWei = 10;}//this.mc_time_bai.gotoAndStop(currentTime_baiWei);this.mc_time_shi.gotoAndStop(currentTime_shiWei);this.mc_time_ge.gotoAndStop(currentTime_geWei);}}}
3、关键帧代码:调用倒计时
import MyLibrary.My_countDown;stop();Start_countDown();//功能:初始化
function Start_countDown()
{//创建:任务倒计时 my_countDown.Init(timer_task_total);//任务倒计时开始计时my_countDown.Set_start();}//功能:离开此场景,需要移除的东西;
function Destroy_countDown()
{}
三、操作:写在自定义类中:版本2.0
1、项目设置
1、关键帧代码:调用倒计时
import MyLibrary.My_countDown;var my_countDown:My_countDown = null;stop();Start_countDown();//功能:初始化
function Start_countDown()
{//初始化:倒计时Init_countDown();
}//功能:离开此场景,需要移除的东西;
function Destroy_countDown()
{//移除 :任务倒计时if (my_countDown!=null){if (my_countDown.hasEventListener(My_countDown.START)){my_countDown.removeEventListener(My_countDown.START,START_countDown);}if (my_countDown.hasEventListener(My_countDown.OVER)){my_countDown.removeEventListener(My_countDown.OVER,OVER_countDown);}if (stage.contains(my_countDown)){stage.removeChild(my_countDown);}}
}//初始化:倒计时
function Init_countDown()
{//初始化:任务倒计时if (my_countDown==null){my_countDown = new My_countDown(2);//倒计时几秒//添加监听事件if (! my_countDown.hasEventListener(My_countDown.START)){my_countDown.addEventListener(My_countDown.START,START_countDown);}if (! my_countDown.hasEventListener(My_countDown.OVER)){my_countDown.addEventListener(My_countDown.OVER,OVER_countDown);}if (! stage.contains(my_countDown)){stage.addChild(my_countDown);}}my_countDown.Set_start();
}function START_countDown(e:Event):void
{trace(e);//(2)
}function OVER_countDown(e:Event):void
{trace(e);//(4)
}
1、 自定义类:My_countDown
/**********************/
// 作者:xzy
//功能:自定义类,让舞台添加物体,有开始、停止、重置定时器,最多实现3位倒计时
//日期:20201010
//版本:2.0
/**********************/
package MyLibrary
{import flash.display.MovieClip;import flash.utils.Timer;import flash.events.TimerEvent;import flash.events.Event;public class My_countDown extends MovieClip{//发送监听事件static public const START:String = "START";static public const OVER:String = "OVER";//任务总时长,单位:秒public var timer_task_total:int = 0;//任务当前时间public var timer_task_current:int = 0;//定时器:任务public var timer_task:Timer = null;public function My_countDown(_total:int){timer_task_total = _total;//倒计时原件暂停this.mc_time_bai.gotoAndStop(1);this.mc_time_shi.gotoAndStop(1);this.mc_time_ge.gotoAndStop(1);//定时器:任务倒计时;if (timer_task==null){timer_task = new Timer(1000,timer_task_total);if (! timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.addEventListener(TimerEvent.TIMER,TIMER_timer_task);}}}//定时器:任务倒计时public function TIMER_timer_task(e:TimerEvent){timer_task_current++;trace("timer_task_current:"+timer_task_current);Set_changeTime();//倒计时结束:if (timer_task_current>=timer_task_total){timer_task.stop();//分发OVER事件;dispatchEvent(new Event(OVER));//新建事件传入String参数}}//开始定时器public function Set_start(){timer_task.start();//分发START事件;dispatchEvent(new Event(START));//新建事件传入String参数}//重置定时器public function Set_reset(){timer_task.reset();}//结束定时器public function Set_stop(){timer_task.stop();}//设置更换时间public function Set_changeTime(){var currentTime:int = timer_task_total - timer_task_current;//百位var currentTime_baiWei:int = currentTime / 100;//十位var currentTime_shiWei:int = (currentTime - currentTime_baiWei * 100) / 10;//个位var currentTime_geWei:int = currentTime - currentTime_baiWei * 100 - currentTime_shiWei * 10;if (currentTime_baiWei==0){currentTime_baiWei = 10;}if (currentTime_shiWei==0){currentTime_shiWei = 10;}if (currentTime_geWei==0){currentTime_geWei = 10;}this.mc_time_bai.gotoAndStop(currentTime_baiWei);this.mc_time_shi.gotoAndStop(currentTime_shiWei);this.mc_time_ge.gotoAndStop(currentTime_geWei);}}}
三、操作:写在关键帧中
1、项目设置
1、元件:数字:
1-9帧对应1-9图片,10帧是0图片
1、元件: mc_time_task
1、配置文件:config-flash.xml
<Config><Time><timer_task_total>5</timer_task_total> <!--任务总时长,单位:秒--></Time>
</Config>
1、配置文件:关键帧代码
import flash.net.URLRequest;
import flash.net.URLLoader;fscommand("fullscreen","true");stop();//任务总时长,单位:秒
var timer_task_total:int=0;
var timer_task_current:int = 0;
var timer_task:Timer=null;//获取一个xml文件
var url:URLRequest = null;
//使用URLLoader导入数据
var loadurl:URLLoader = null;Start_config();//功能:初始化
function Start_config()
{if (url==null){url = new URLRequest("config-flash.xml");}if (loadurl==null){loadurl = new URLLoader(url);}//添加事件******,以在XML数据导入完成后处理XML数据;if (! loadurl.hasEventListener(Event.COMPLETE)){loadurl.addEventListener(Event.COMPLETE,Loadxml);}
}//功能:离开此场景,需要移除的东西
function Destroy_config()
{
}//功能:读取配置文件
function Loadxml(event:Event)
{ var xml:XML = XML(loadurl.data);//导入完成后,使用导入的数据创建XML对象timer_task_total = xml.Time.timer_task_total;trace("timer_task_total:"+timer_task_total);Destroy_config();gotoAndStop("倒计时");
}
1、倒计时:关键帧代码
stop();Start_countDown();//功能:初始化
function Start_countDown()
{//初始化:倒计时Init_countDown();
}//功能:离开此场景,需要移除的东西;
function Destroy_countDown()
{//移除:任务倒计时timer_task.stop();if (timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.removeEventListener(TimerEvent.TIMER,TIMER_timer_task);timer_task = null;}
}//初始化:倒计时
function Init_countDown()
{mc_time_task.mc_time_bai.stop();mc_time_task.mc_time_shi.stop();mc_time_task.mc_time_ge.stop();//定时器:任务倒计时if (timer_task==null){timer_task = new Timer(1000,timer_task_total);if (! timer_task.hasEventListener(TimerEvent.TIMER)){timer_task.addEventListener(TimerEvent.TIMER,TIMER_timer_task);}}timer_task.start();
}//定时器:任务倒计时
function TIMER_timer_task(e:TimerEvent)
{timer_task_current++;trace("timer_task_current:"+timer_task_current);ShowTime();if (timer_task_current>=timer_task_total){timer_task.stop();trace("游戏结束");}
}//显示时间
function ShowTime()
{var currentTime:int = timer_task_total - timer_task_current;//百位var currentTime_baiWei:int = currentTime / 100;//十位var currentTime_shiWei:int = (currentTime - currentTime_baiWei * 100) / 10;//个位var currentTime_geWei:int = currentTime - currentTime_baiWei * 100 - currentTime_shiWei * 10;if (currentTime_baiWei==0){currentTime_baiWei = 10;}if (currentTime_shiWei==0){currentTime_shiWei = 10;}if (currentTime_geWei==0){currentTime_geWei = 10;}mc_time_task.mc_time_bai.gotoAndStop(currentTime_baiWei);mc_time_task.mc_time_shi.gotoAndStop(currentTime_shiWei);mc_time_task.mc_time_ge.gotoAndStop(currentTime_geWei);}