|
Action Script 2.0/3.0 随机选举线程插入18个项目到组合框
不想多说UI你们懂得...- on(release)
- {
- // this._x+=80; // 当前对象自身水平添加80px
- // this._x-=80;
- var a:Number = new Number();
- 组合框.rowCount = 18;
- if(组合框.length>0)
- {
- 组合框.removeAll();
- }
- else
- {
- switch(random(2))
- {
- case 0:
- A();
- break;
- case 1:
- B();
- break;
- case 2:
- C();
- break;
- default:
- A();
- }
- }
- function A():Void
- {
- for(a;a<=18;a++)
- {
- if(a>0 and a<>0)
- {
- 组合框.addItem(String(a));
- }
- }
- }
- function B():Void
- {
- while(a<=18)
- {
- if(a>0 and a<>0)
- {
- 组合框.addItem(String(a));
- }
- }
- }
- function C():Void
- {
- do
- {
- if(a>0 and a<>0)
- {
- 组合框.addItem(String(a));
- }
- }
- while(a<=18)
- }
- }
复制代码 EPL代码l:l- .DocVersion 2
- .Module FormModule1
- .Sub _CommandButton1_Click
- .LocalVar a, Integer
- .If (ComboBox1.GetItemCount () > 0)
- ComboBox1.Clear ()
- Return ()
- .else
- .switch_begin (Rnd (0, 2) = 0)
- A ()
- .Case (Rnd (0, 2) = 1)
- B ()
- .Case (Rnd (0, 2) = 2)
- C ()
- .default
- A ()
- .switch_end
- .ife_end
- ComboBox1.SendMessage (335, 1, 0)
- .Sub A
- .LocalVar a, Integer
- .For (1, 18, 1, a)
- .IfTrue (a > 0 And a <> 0)
- ComboBox1.AddItem (CStr (a), )
- .if_end
- .Next ()
- .Sub B
- .LocalVar a, Integer
- .Do ()
- .IfTrue (a > 0 And a <> 0)
- ComboBox1.AddItem (CStr (a), )
- .if_end
- .Loop (a <= 18)
- .Sub C
- .LocalVar a, Integer
- .While (a <= 18)
- .IfTrue (a > 0 And a <> 0)
- ComboBox1.AddItem (CStr (a), )
- .if_end
- ' // Break ()
- .Wend ()
复制代码 |
|