用as3纯代码制作人教版四年级上数学计算题题库.docx
- 文档编号:29927046
- 上传时间:2023-08-03
- 格式:DOCX
- 页数:11
- 大小:16.44KB
用as3纯代码制作人教版四年级上数学计算题题库.docx
《用as3纯代码制作人教版四年级上数学计算题题库.docx》由会员分享,可在线阅读,更多相关《用as3纯代码制作人教版四年级上数学计算题题库.docx(11页珍藏版)》请在冰豆网上搜索。
用as3纯代码制作人教版四年级上数学计算题题库
用as3纯代码制作人教版四年级上数学计算题题库
本人正在学习AS3,为了解决当前练习题来源问题,就试着用AS3制作了四年级上数学计算题题库,由于对AS3不太精通,代码不太精简,不过总体效果还可以。
用AS3制作计算题题库,方法比较简单。
首先用flash新建AS3文件,舞台大小设置为1024-768像素,然后把Slider组件、Label组件、ColorPicker组件、Button组件拖入舞台,然后再全部删除,这时库里就有了这四个组件,然后把AS3代码粘贴到主场景第一帧,发布即可生成四年级上数学计算题题库。
代码如下:
stop();
stage.displayState=StageDisplayState.FULL_SCREEN;
importfl.events.ColorPickerEvent;
importfl.controls.ColorPicker;
importflash.events.MouseEvent;
importfl.controls.Label;
importfl.controls.Button;
importflash.display.*;
importflash.text.TextFormat;
importfl.controls.Label;
importfl.controls.Slider;
importfl.events.SliderEvent;
varct1_txt:
Label=newLabel();
varct2_txt:
Label=newLabel();
varct3_txt:
Label=newLabel();
varct4_txt:
Label=newLabel();
varct5_txt:
Label=newLabel();
varct6_txt:
Label=newLabel();
varct7_txt:
Label=newLabel();
varct8_txt:
Label=newLabel();
varct9_txt:
Label=newLabel();
varct10_txt:
Label=newLabel();
varct11_txt:
Label=newLabel();
varct12_txt:
Label=newLabel();
varct13_txt:
Label=newLabel();
varct14_txt:
Label=newLabel();
varct15_txt:
Label=newLabel();
varct16_txt:
Label=newLabel();
varct17_txt:
Label=newLabel();
varct18_txt:
Label=newLabel();
varct19_txt:
Label=newLabel();
varct20_txt:
Label=newLabel();
varhy1_txt:
Label=newLabel();
varhy2_txt:
Label=newLabel();
varcfjs_btn:
Button=newButton();
varcfjs2_btn:
Button=newButton();
varcfhh_btn:
Button=newButton();
vartc_btn:
Button=newButton();
varwbys:
TextFormat=newTextFormat();
varwbys1:
TextFormat=newTextFormat();
varys:
ColorPicker=newColorPicker();
vartdt:
Slider=newSlider();
addChild(ct1_txt);
addChild(ct2_txt);
addChild(ct3_txt);
addChild(ct4_txt);
addChild(ct5_txt);
addChild(ct6_txt);
addChild(ct7_txt);
addChild(ct8_txt);
addChild(ct9_txt);
addChild(ct10_txt);
addChild(ct11_txt);
addChild(ct12_txt);
addChild(ct13_txt);
addChild(ct14_txt);
addChild(ct15_txt);
addChild(ct16_txt);
addChild(ct17_txt);
addChild(ct18_txt);
addChild(ct19_txt);
addChild(ct20_txt);
addChild(hy1_txt);
addChild(hy2_txt);
addChild(cfjs_btn);
addChild(cfjs2_btn);
addChild(cfhh_btn);
addChild(tc_btn);
addChild(ys);
addChild(tdt);
tdt.visible=false;
ct1_txt.move(50,20);
ct2_txt.move(50,ct1_txt.y+ct1_txt.height+45);
ct3_txt.move(50,ct2_txt.y+ct2_txt.height+45);
ct4_txt.move(50,ct3_txt.y+ct3_txt.height+45);
ct5_txt.move(50,ct4_txt.y+ct4_txt.height+45);
ct6_txt.move(50,ct5_txt.y+ct5_txt.height+45);
ct7_txt.move(50,ct6_txt.y+ct6_txt.height+45);
ct8_txt.move(50,ct7_txt.y+ct7_txt.height+45);
ct9_txt.move(50,ct8_txt.y+ct8_txt.height+45);
ct10_txt.move(50,ct9_txt.y+ct9_txt.height+45);
ct11_txt.move(600,20);
ct12_txt.move(600,ct1_txt.y+ct1_txt.height+45);
ct13_txt.move(600,ct2_txt.y+ct2_txt.height+45);
ct14_txt.move(600,ct3_txt.y+ct3_txt.height+45);
ct15_txt.move(600,ct4_txt.y+ct4_txt.height+45);
ct16_txt.move(600,ct5_txt.y+ct5_txt.height+45);
ct17_txt.move(600,ct6_txt.y+ct6_txt.height+45);
ct18_txt.move(600,ct7_txt.y+ct7_txt.height+45);
ct19_txt.move(600,ct8_txt.y+ct8_txt.height+45);
ct20_txt.move(600,ct9_txt.y+ct9_txt.height+45);
cfjs_btn.move(650,700);
cfjs2_btn.move(450,700);
cfhh_btn.move(250,700);
tc_btn.move(900,700);
ys.move(850,700);
hy1_txt.move(50,200);
hy2_txt.move(350,500);
tdt.move(20,700);
wbys.color=0x0000ff;
wbys.size=40;
wbys1.color=0xff72f5;
wbys1.size=65;
/*ct1_txt.setTextFormat(wbys);
*/
cfjs_btn.label="点击随机出20道除法计算题";
cfjs2_btn.label="点击随机出20道乘法计算题";
cfhh_btn.label="点击随机出乘法与除法计算题";
hy1_txt.text="人教版四年级上数学计算题题库";
hy2_txt.text="请点击下面的按钮进入题库";
tc_btn.label="退出";
/*ys.addEventListener(ColorPickerEvent.CHANGE,ysxz);
functionysxz(event)
{
wbys.color=ys.selectedColor;
ct1_txt.setTextFormat(wbys);
}*/
ct1_txt.setStyle("textFormat",wbys);
ct2_txt.setStyle("textFormat",wbys);
ct3_txt.setStyle("textFormat",wbys);
ct4_txt.setStyle("textFormat",wbys);
ct5_txt.setStyle("textFormat",wbys);
ct6_txt.setStyle("textFormat",wbys);
ct7_txt.setStyle("textFormat",wbys);
ct8_txt.setStyle("textFormat",wbys);
ct9_txt.setStyle("textFormat",wbys);
ct10_txt.setStyle("textFormat",wbys);
ct11_txt.setStyle("textFormat",wbys);
ct12_txt.setStyle("textFormat",wbys);
ct13_txt.setStyle("textFormat",wbys);
ct14_txt.setStyle("textFormat",wbys);
ct15_txt.setStyle("textFormat",wbys);
ct16_txt.setStyle("textFormat",wbys);
ct17_txt.setStyle("textFormat",wbys);
ct18_txt.setStyle("textFormat",wbys);
ct19_txt.setStyle("textFormat",wbys);
ct20_txt.setStyle("textFormat",wbys);
hy1_txt.setStyle("textFormat",wbys1);
hy2_txt.setStyle("textFormat",wbys);
ct1_txt.text="";
ct2_txt.text="";
ct3_txt.text="";
ct4_txt.text="";
ct5_txt.text="";
ct6_txt.text="";
ct7_txt.text="";
ct8_txt.text="";
ct9_txt.text="";
ct10_txt.text="";
ct11_txt.text="";
ct12_txt.text="";
ct1_txt.text="";
ct13_txt.text="";
ct1_txt.text="";
ct14_txt.text="";
ct15_txt.text="";
ct16_txt.text="";
ct17_txt.text="";
ct18_txt.text="";
ct19_txt.text="";
ct20_txt.text="";
ct1_txt.autoSize="left";
ct2_txt.autoSize="left";
ct3_txt.autoSize="left";
ct4_txt.autoSize="left";
ct5_txt.autoSize="left";
ct6_txt.autoSize="left";
ct7_txt.autoSize="left";
ct8_txt.autoSize="left";
ct9_txt.autoSize="left";
ct10_txt.autoSize="left";
ct11_txt.autoSize="left";
ct12_txt.autoSize="left";
ct13_txt.autoSize="left";
ct14_txt.autoSize="left";
ct15_txt.autoSize="left";
ct16_txt.autoSize="left";
ct17_txt.autoSize="left";
ct18_txt.autoSize="left";
ct19_txt.autoSize="left";
ct20_txt.autoSize="left";
hy1_txt.autoSize="left";
hy2_txt.autoSize="left";
cfjs_btn.width=160;
cfjs_btn.height=30;
cfjs2_btn.width=160;
cfjs2_btn.height=30;
cfhh_btn.width=160;
cfhh_btn.height=30;
cfjs_btn.addEventListener(MouseEvent.CLICK,cfjs);
functioncfjs(Event:
MouseEvent)
{
tdt.visible=true;
hy1_txt.text="";
hy2_txt.text="";
ct1_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct2_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct3_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct4_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct5_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct6_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct7_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct8_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct9_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct10_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct11_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct12_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct13_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct14_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct15_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct16_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct17_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct18_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct19_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
ct20_txt.text=""+Math.round(Math.random()*899+100)+"÷"+Math.round(Math.random()*89+10)+"=";
}
cfjs2_btn.addEventListener(MouseEvent.CLICK,cfjs2);
functioncfjs2(Event:
MouseEvent)
{
tdt.visible=true;
hy1_txt.text="";
hy2_txt.text="";
ct1_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct2_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct3_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct4_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct5_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct6_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct7_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct8_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct9_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct10_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct11_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct12_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct13_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct14_txt.text=""+Math.round(Math.random()*899+100)+"×"+Math.round(Math.random()*89+10)+"=";
ct15_txt.text=""+Math.round(Mat
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- as3 代码 制作人 四年级 数学 算题 题库