错误#1069:在字符串上找不到属性Pertanyaan0且没有默认值

时间:2016-06-28 14:40:19

标签: flash-cs5

我卡在这里请帮忙,我是flash的新手,使用adobe flash cs5.5 这是代码:

 import flash.net.URLLoaderDataFormat;
 import flash.events.DataEvent;

 stop();

 alert_mc.visible = false;
 alert_mc.ok_btn.visible = false;

 var score:Number = 0;
 var jawaban;
 var nextQst:Number = 0;
 var i:Number = 0;


    a_btn.addEventListener(MouseEvent.CLICK,btna);
    function btna(ev:MouseEvent):void
    {
        cekJawaban("a");
    }
    b_btn.addEventListener(MouseEvent.CLICK,btnb);
    function btnb(ev:MouseEvent):void
    {
        cekJawaban("b");
    }
    c_btn.addEventListener(MouseEvent.CLICK,btnc);
    function btnc(ev:MouseEvent):void
    {
        cekJawaban("c");
    }
    d_btn.addEventListener(MouseEvent.CLICK,btnd);
    function btnd(ev:MouseEvent):void
    {
        cekJawaban("d");
    }




 var qvar_lv:URLLoader = new URLLoader();
 qvar_lv.dataFormat = URLLoaderDataFormat.TEXT;// Step 1
    qvar_lv.load(new URLRequest("DaftarSoal.txt")); // Step 2
    qvar_lv.addEventListener(Event.COMPLETE, onComplete); // Step 3
    function onComplete (event:Event):void // Step 4
    {
        var faq:String = event.target.data; // Step 5

        trace("Success"+faq);

        if (faq["Pertanyaan"+i] != undefined) {
            no_txt.text = "PERTANYAAN KE-"+i;
            soal_txt.text = faq["Pertanyaan"+i];                ja_txt.text = faq["a"+i];
            jb_txt.text = faq["b"+i];
            jc_txt.text = faq["c"+i];
            jd_txt.text = faq["d"+i];
            jawaban =faq["benar"+i];
        } else {
            gotoAndStop(3);
            skor_txt.text = score+"";
            teks_txt.text = "Score akhir kamu :";
        }

    }

 function cekJawaban(val) {
    alert_mc.visible = true;
    if (val != jawaban) {
        alert_mc.alert_txt.text = "jawaban kamu salah, score anda berkurang 50 points";
        score = score-50;
        alert_mc.ok_btn.addEventListener(MouseEvent.CLICK,btnok);
        function btnok(ev:MouseEvent):void
        {
            nextQst = i+1;
            alert_mc.visible = false;
        }
    } else {
        score = score+100;
        alert_mc.alert_txt.text = "jawaban kamu benar, score anda bertambah 100 points";
        alert_mc.ok_btn.addEventListener(MouseEvent.CLICK,btnok2);
        function btnok2(ev:MouseEvent):void
        {
            nextQst = i+1;
            alert_mc.visible = false;
        }
    trace(score);
    }
 }

错误#1069:

Property Pertanyaan0 not found on String and there is no default value.
    at revisi_fla::Symbol5_68/onComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

0 个答案:

没有答案