0

actionscript と flash を使用してモバイルアプリを作成しています (古いことはわかっています)。このアプリは、ユーザーが回答を選択した時点でクイズです。次の質問を返します。問題は、結果を返すときに、質問 1、質問 2、質問 4、質問 8 でそれらを返すことです。VARIABLE++、++VARIABLE、および VARIABLE = VARIABLE + 1 を試しました。なぜ 1 ずつインクリメントされないのか、何かアイデアはありますか?

import flash.events.Event;

stop();

var TEST:String = "";
txt_ans.text = "";
var SCORE:int = 0;
var Qnumber:Number = 1;

stage.addEventListener(Event.ENTER_FRAME, onFrameEnter);

function onFrameEnter(e:Event):void
{

LoadQuestionVars.call();
}
function LoadQuestionVars():void
{
if (Qnumber > 10)
{

    gotoAndStop(10);
}
else
{

    var formVars:URLVariables = new URLVariables();
    var variableRequest:URLRequest = new URLRequest("requestp");
    variableRequest.method = URLRequestMethod.POST;
    variableRequest.data = formVars;
    var varLoader:URLLoader = new URLLoader();
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


    formVars.question1 = Qnumber;


    varLoader.addEventListener(Event.COMPLETE, showTest);



    varLoader.load(variableRequest);

    function showTest(e:Event):void
    {

        result_text.text = e.target.data.systemResult;
        TESTNAME = result_text.text;


        var formVars:URLVariables = new URLVariables();
        var variableRequest:URLRequest = new URLRequest("hrequest");
        variableRequest.method = URLRequestMethod.POST;
        variableRequest.data = formVars;
        var varLoader:URLLoader = new URLLoader();
        varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


        formVars.question1 = Qnumber;


        varLoader.addEventListener(Event.COMPLETE, showQuestion);



        varLoader.load(variableRequest);

        function showQuestion(e:Event):void
        {
            question_text.text = e.target.data.question;

            var formVars:URLVariables = new URLVariables();
            var variableRequest:URLRequest = new URLRequest("hrequest");
            variableRequest.method = URLRequestMethod.POST;
            variableRequest.data = formVars;
            var varLoader:URLLoader = new URLLoader();
            varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


            formVars.question1 = Qnumber;


            varLoader.addEventListener(Event.COMPLETE, showanswere1);



            varLoader.load(variableRequest);

            function showanswere1(e:Event):void
            {
                Answere1.text = e.target.data.answere1;



                var formVars:URLVariables = new URLVariables();
                var variableRequest:URLRequest = new URLRequest("hrequest");
                variableRequest.method = URLRequestMethod.POST;
                variableRequest.data = formVars;
                var varLoader:URLLoader = new URLLoader();
                varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


                formVars.question1 = Qnumber;


                varLoader.addEventListener(Event.COMPLETE, showanswere2);



                varLoader.load(variableRequest);

                function showanswere2(e:Event):void
                {
                    Answere2.text = e.target.data.answere2;

                    var formVars:URLVariables = new URLVariables();
                    var variableRequest:URLRequest = new URLRequest("requestp");
                    variableRequest.method = URLRequestMethod.POST;
                    variableRequest.data = formVars;
                    var varLoader:URLLoader = new URLLoader();
                    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


                    formVars.question1 = Qnumber;


                    varLoader.addEventListener(Event.COMPLETE, showanswere3);



                    varLoader.load(variableRequest);

                    function showanswere3(e:Event):void
                    {
                        Answere3.text = e.target.data.answere3;

                        var formVars:URLVariables = new URLVariables();
                        var variableRequest:URLRequest = new URLRequest("requestp");
                        variableRequest.method = URLRequestMethod.POST;
                        variableRequest.data = formVars;
                        var varLoader:URLLoader = new URLLoader();
                        varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


                        formVars.question1 = Qnumber;


                        varLoader.addEventListener(Event.COMPLETE, showanswere4);



                        varLoader.load(variableRequest);

                        function showanswere4(e:Event):void
                        {
                            Answere4.text = e.target.data.answere4;

                            var formVars:URLVariables = new URLVariables();
                            var variableRequest:URLRequest = new URLRequest("request");
                            variableRequest.method = URLRequestMethod.POST;
                            variableRequest.data = formVars;
                            var varLoader:URLLoader = new URLLoader();
                            varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;


                            formVars.question1 = Qnumber;


                            varLoader.addEventListener(Event.COMPLETE, ANSWERE);



                            varLoader.load(variableRequest);

                            function ANSWERE(e:Event):void
                            {
                                txt_ans.text = e.target.data.answereshow;



                            }
                        }

                    }
                }
            }
        }

    }
    stage.removeEventListener(Event.ENTER_FRAME,onFrameEnter);




    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    BTN_ANS1.addEventListener(TouchEvent.TOUCH_TAP, Answere1ACC);

    function Answere1ACC(e:TouchEvent):void
    {
        if (txt_ans.text == "ANS1")
        {
            SCORE = SCORE + 1;
        }
        ClearTextFields.call();

    }
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    BTN_ANS2.addEventListener(TouchEvent.TOUCH_TAP, Answere2ACC);

    function Answere2ACC(e:TouchEvent):void
    {
        if (txt_ans.text == "ANS2")
        {
            SCORE = SCORE + 1;
        }
        ClearTextFields.call();

    }
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    BTN_ANS3.addEventListener(TouchEvent.TOUCH_TAP, Answere3ACC);

    function Answere3ACC(e:TouchEvent):void
    {
        if (txt_ans.text == "ANS3")
        {
            SCORE = SCORE + 1;
        }
        ClearTextFields.call();


    }
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    BTN_ANS4.addEventListener(TouchEvent.TOUCH_TAP, Answere4ACC);

    function Answere4ACC(e:TouchEvent):void
    {
        if (txt_ans.text == "ANS4")
        {
            SCORE = SCORE + 1;
        }
        ClearTextFields.call();
    }
    function ClearTextFields():void
    {
        result_text.text = "";
        question_text.text = "";
        Answere1.text = "";
        Answere2.text = "";
        Answere3.text = "";
        Answere4.text = "";
        txt_ans.text = "";
        LoadQuestionVars.call();

    }


}
Qnumber++;
}
4

1 に答える 1