I have a problem in my homework about Slot Machine
may know how can add function if 5 strips @ same position after spin , text change 0 50. hope can me slove problems
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.mouseevent;
import flash.display.movieclip;
import flash.text.*;
var blitmask1:blitmask = new blitmask(strip1,strip1.x,strip1.y,strip1.width,100,true,true,0xffffff,true);
var blitmask2:blitmask = new blitmask(strip2,strip2.x,strip2.y,strip2.width,100,true,true,0xffffff,true);
var blitmask3:blitmask = new blitmask(strip3,strip3.x,strip3.y,strip3.width,100,true,true,0xffffff,true);
var blitmask4:blitmask = new blitmask(strip4,strip4.x,strip4.y,strip4.width,100,true,true,0xffffff,true);
var blitmask5:blitmask = new blitmask(strip5,strip5.x,strip5.y,strip5.width,100,true,true,0xffffff,true);
spin_btn.addeventlistener(mouseevent.click, spin);
function spin(event:mouseevent):void {
var i:int = 1;
var : int = 100;
var b : int = 200;
var c : int = 300;
var d : int = 400;
var e : int = 500;
while (i <= 5)
{
var newnumber:number = 10000;
tweenmax.to(this["strip" +i], 5 + (i*.5), {y:strip1.y + newnumber + a});
i++;
tweenmax.to(this["strip" +i], 5 + (i*.5), {y:strip2.y + newnumber + a});
i++;
tweenmax.to(this["strip" +i], 5 + (i*.5), {y:strip3.y + newnumber + b});
i++;
tweenmax.to(this["strip" +i], 5 + (i*.5), {y:strip4.y + newnumber + d});
i++;
tweenmax.to(this["strip" +i], 5 + (i*.5), {y:strip5.y + newnumber + e});
i++;
spin_btn.mouseenabled = false;
}
}
//i don't know how write following part achieve function want
function checkwin():void {
var txt2:textfield = new textfield();
txt2.text = "0";
addchild(txt2);
txt2.textcolor = 0xff0000;
txt2.x = 520;
txt2.y = 220;
txt2.addeventlistener(event.change, checkwin);
/* current label determine item's value */
if(strip1.y == strip2.y) {
txt2.text = string("100");
}
else if(strip1.y == strip2.y && strip2.y == strip3.y)
{
txt2.text = string("150");
}
else if(strip1.y == strip2.y && strip2.y == strip3.y && strip3.y == strip4.y)
{
txt2.text = string("200");
}
else if(strip1.y == strip2.y && strip2.y == strip3.y && strip3.y == strip4.y && strip4.y == strip5.y)
{
txt2.text = string("250");
}}
i write programme accroding youtube link:
http://www.youtube.com/watch?v=937p69xwtem
you should discuss problem instructor or classmates.
More discussions in ActionScript 3
adobe
Comments
Post a Comment