Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

error in action 3

Guest
Apr 07, 2014 Apr 07, 2014

error in action 3

what this  massage

TypeError: Error #1010: A term is undefined and has no properties.

    at Untitled_fla::MainTimeline/frame1()

the code

import flash.events.MouseEvent;

var questions:Array = new Array();

questions[0] = ["one",1];

questions[1] = ["two",2];

questions[2] = ["three",3];

questions[3] = ["four",4];

questions[4] = ["five",5];

var newArray:Array = new Array();

var randompos:int = 0;

for (var k: int =0; k<questions.length; k++)

{

    randompos = int(math.random() * questions.length);

    while (newArray[randompos] !=null)

    {

        randompos = int(math.random() * questions.length);

    }

    newArray[randompos] = questions;

}

var current:uint = 0;

var scr:uint = 0;

t_text.text = newArray[current][0];

score.text = String(scr) + "/" + String(newArray.length);

pre.text = String(scr) + "%";

right.buttonMode = true;

wrong.buttonMode = true;

right.addEventListener(MouseEvent.CLICK, res);

wrong.addEventListener(MouseEvent.CLICK, res);

function res(e:MouseEvent):void

{

    var id:uint = newArray[current][1];

    switch (e.currentTarget.name)

    {

        case "right":

            if (id==1 || id==2 || id==3)

            {

                scr++;

                score.text = String(scr) + "/" + String(newArray.length);

                pre.text = String(Math.round(scr/ newArray.length*100))+ "%";

                if (current <  newArray.length-1)

                {

                    current++;

                    t_text.text = newArray[current][0];

                }

                else

                {

                    right.removeEventListener(MouseEvent.CLICK, res);

                }

            }

            break;

        case "wrong":

            if (id==4 || id==5)

            {

                scr++;

                score.text = String(scr) + "/" + String(newArray.length);

                pre.text = String(Math.round(scr/ newArray.length*100))+ "%";

                if (current <  newArray.length-1)

                {

                    current++;

                    t_text.text = newArray[current][0];

            }

            else

            {

                wrong.removeEventListener(MouseEvent.CLICK, res);

            }

    }

    break;

}

}

TOPICS
ActionScript
491
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 08, 2014 Apr 08, 2014

That indicates that the problem lies on line 26.  If line 26 is....

     t_text.text = newArray[current][0];

then the problem might be that you are treating newArray as if it is a multi-dimensional array when it is not.  Trying changing that to be...

     t_text.text = newArray[current];

If that doesn't fix the error then chances are the issue is with the textfield not being named t_text.

If neither of those is the issue then chances are I missed counting to line 26 and you should help by indicating

...
Translate
LEGEND ,
Apr 07, 2014 Apr 07, 2014

Go into the Flash Publish Settings and select the option to Permit Debugging.  Doing that will add the line number where the problem lies right after the frame number.

While it could be a number of reasons, it is essentially saying that whatever object you are targeting in the line doesn't exist as far as the code sees it.  You might have missed naming it or misnamed it or something.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 08, 2014 Apr 08, 2014

i,m Carried out these steps shown [test6_fla.MainTimeline::frame1:26]


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 08, 2014 Apr 08, 2014

That indicates that the problem lies on line 26.  If line 26 is....

     t_text.text = newArray[current][0];

then the problem might be that you are treating newArray as if it is a multi-dimensional array when it is not.  Trying changing that to be...

     t_text.text = newArray[current];

If that doesn't fix the error then chances are the issue is with the textfield not being named t_text.

If neither of those is the issue then chances are I missed counting to line 26 and you should help by indicating which one is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 08, 2014 Apr 08, 2014

when edit to t_text.text = newArray[current];

shown this massage

TypeError: Error #2007: Parameter text must be non-null.

    at flash.text::TextField/set text()

    at test6_fla::MainTimeline/frame1()[test6_fla.MainTimeline::frame1:25]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 08, 2014 Apr 08, 2014
LATEST

the problem solved  thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines