Copy link to clipboard
Copied
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;
}
}
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
...Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i,m Carried out these steps shown [test6_fla.MainTimeline::frame1:26]
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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]
Copy link to clipboard
Copied
the problem solved thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now