-1

So I currently have an array set up that has nothing in it until the user picks 5 numbers (there are a total of 59 numbers(the numbers are in a chart)). So now I am wondering if there is a way to call the first number picked and place it at a certain point on the screen then the second and so on from there. Here is just a little bit of the code I am using currently.

var pickFive:Array = new Array (5);
var m_iNextElement:int = 0;

Game.board.btn_1.addEventListener(MouseEvent.CLICK, btn1);
Game.board.btn_2.addEventListener(MouseEvent.CLICK, btn2);
Game.board.btn_3.addEventListener(MouseEvent.CLICK, btn3);
Game.board.btn_4.addEventListener(MouseEvent.CLICK, btn4);
Game.board.btn_5.addEventListener(MouseEvent.CLICK, btn5);
Game.board.btn_6.addEventListener(MouseEvent.CLICK, btn6);


function btn1(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_1.gotoAndStop(2);
    pickFive[m_iNextElement] = 1;
    m_iNextElement++;
    }
}

function btn2(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_2.gotoAndStop(2);
    pickFive[m_iNextElement] = 2;
    m_iNextElement++;
    }
}

function btn3(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_3.gotoAndStop(2);
    pickFive[m_iNextElement] = 3;
    m_iNextElement++;
    }
}

function btn4(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_4.gotoAndStop(2);
    pickFive[m_iNextElement] = 4;
    m_iNextElement++;
    }
}

function btn5(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_5.gotoAndStop(2);
    pickFive[m_iNextElement] = 5;
    m_iNextElement++;
    }
}

function btn6(event:MouseEvent):void{
    if(m_iNextElement <= 4){
    Game.board.btn_6.gotoAndStop(2);
    pickFive[m_iNextElement] = 6;
    m_iNextElement++;
    }
}
4

1 回答 1

0
var b1:TextField = new TextField();
var myFont = new Font1();
var myFormat:TextFormat = new TextFormat();
myFormat.size = 45;
myFormat.font = myFont.fontName;
myFormat.align = TextFormatAlign.CENTER;
b1.embedFonts = true;
b1.antiAliasType = AntiAliasType.ADVANCED
    if(pickFive[0] != null){
        trace(Game.NumberBoard_mc.Pick5['btn_' + pickFive[0]].name);
        Game.NumberBoard_mc.Pick5['btn_' + pickFive[0]];
        b1.defaultTextFormat = myFormat;
        b1.text = pickFive[0];
        b1.x = 478;
        b1.y = 103;
        addChild(b1);
    }
于 2014-06-30T14:27:20.130 回答