AS3 Multidimensional array maximum 8 error - actionscript-3

Can anyone please help me figure out why I am getting an error when I add a 9th line to this multidimensional array? Thanks!
var ColourArray:Array = new Array();
ColourArray[0] = ["0xdc1d28","0xff404b","0xff8b96"]; //RED
ColourArray[1] = ["0x9bb09a","0xc2dcc1","0xe1eee0"]; //PALE
ColourArray[2] = ["0x7a5e66","0x9d8189","0xC3A7AF"]; //BROWN
ColourArray[3] = ["0xB5B5B5","0xD8D8D8","0xffffff"]; //GREY
ColourArray[4] = ["0xDC3B87","0xFF5EAA","0xFFA9F5"]; //PINK
ColourArray[5] = ["0xDC875A","0xFFAA7D","0xFFCFA3"]; //PEACH
ColourArray[6] = ["0x18988F","0x3BBBB2","0x61DDD7"]; //TEAL
ColourArray[7] = ["0x7884DC","0x9BA7FF","0xC1CDFF"]; //LILAC
ColourArray[8] = ["0x0091dc","0x00b4ff","0x25d9ff"]; //BLUE
The error is TypeError: Error #1010: A term is undefined and has no properties.
It's fine with 8 lines but with 9 it throws up the error. Many thanks! 🙏

Related

Problem implementing function with input as string in octave

I'm trying to implement a function astronomical_constants but its giving me error
'name' undefined near line 2 column 10
function val = astronomical_constants(name)
switch name
case 'gravitational_constant'
val.name = 'gravitational_constant';
val.value = 6.667e-11;
val.uncertainity = 1e-12;
case 'equitorial_radius_earth'
val.name = 'equitorial_radius_earth';
val.value = 6*10^(20);
val.uncertainty = 1e-12;
endswitch
endfunction
a = astronomical_constants('gravitational_constant').value
I'm not able to understand how I can implement it correctly. Pls help

TypeError: 'cv2.face_EigenFaceRecognizer' object is not callable

I ran into an error which i do not know where and what is causing it.
Please i need help.
def train(self,images,lables, recogType=0):
self.images = images
self.lables = np.array(lables)
'arg = recogType:[cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()'
recogs = cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()
self.recognizer = recogs[recogType]()
self.recognizer.train(self.images,self.lables)
The specific problem is with this line:
self.recognizer = recogs[recogType]()
By placing braces () on the end, you are trying to call the recognizer, as the error says. Change this to
self.recognizer = recogs[recogType]
//Disclaimer - there may be other problems.

Syntax error: expecting semicolon before leftbracket

I have the following code at frame one of the top layer:
var level:Array = new Array();
var level[0] = new Object();
I am getting the following error:
Scene 1, Layer 'levels', Frame 1, Line 2
1086: Syntax error: expecting semicolon before leftbracket.
I've looked at many examples which seem to be doing the same thing I'm doing, and I've also tried defining the object separately and then adding it to the array, with the same error. I've also searched for the answer, but all the questions I've found are a little different than this situation.
The syntax/grammar production
var level[0] = new Object();
is invalid.
The var production expects a simple Identifier, not an expression1. The parser was roughly trying to treat the production as var level;[0] = ..; (but failed due to the missing semicolon, and would have failed anyway because [0] = ..; is an invalid production as well).
Try:
var level:Array = new Array();
level[0] = new Object(); // no "var" here so it is a valid grammar production
or, more concisely:
var level:Array = [{}]; // using Array and Object literal notations
1 See AS3.g for that ANTLR production rules. Alternatively, for ECMAScript (from which AS derives), see 12.2 Variable Statement from ES5-Annotated and note that it requires an "Identifier" followed by an optional initializer (=) or another declaration (,) or end of statement (;).
Only is
level[0] = {};
or
level.push({});

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

I have this simple code:
...
for (var w:Number=0; w < MAX_w; w++){
for (var k:Number=0; k < MAX_k; k++){
trace("test01");
if(w != k){
trace("test02");
///do sth...
}
}
}
...
And output is:
...
test01
TypeError: Error #1010: A term is undefined and has no properties.
at NS_fla::MainTimeline/vzdalenosti_bodu()
at NS_fla::MainTimeline/hlaska_zmacknul_sem()
...
Please suspects anybody what cause this problem?
Thx for answer.
If it only traces "test01" once, then the problem would not be from whatever is in the if(w!=k) scope, because the first time w=k=0. If your MAX_w and MAX_k are 0 then the problem would be coming from after the loop. In any case, the problem is not with w or k, and I think more code is needed in order to solve this issue.
BTW: Why Number and not int?
According to Run-time errors reference:
This error can occur if you are trying to access a property of an object that does not exist.
For example:
var obj:Object = new Object();
obj.a = "foo";
trace(obj.b.prop);
You can also see this error because of a mispelling, for example in the following, where mc represents a MovieClip object on the display list, and the stage property is misspelled with a capital S (it should be stage):
trace(mc.Stage.quality);
All errors are here - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/runtimeErrors.html

Error 1010 Actionscript 3

i get Error #1010 when i use this while loop:
while (pos.length>0)
{
coo = pos.splice(Math.floor(Math.random() * pos.length),1)[0];
(pos_array[index]).x = coo.x;
(pos_array[index]).y = coo.y;
index++;
}
The error says: A term is undefined and has no properties.
What is wrong with my loop because I used the same loop for other programms and i got no such error.
Thank you for your attention.
Your while loop is breaking.
pos.length will never change and eventually pos_array[index] will be out of bounds.
When when you are out of bounds it is undefined.
So basically you are doing.
undefined.x = coo.x;
And just like the error says undefined has has no properties.
I can't see how this loop ever worked.
Try this instead much cleaner
var savedX:Number = 0
for each( var obj:Object in pos_array ){
coo = new MovieClip()
coo = pos.splice(Math.floor(Math.random() * pos.length),1)[0];
obj.x = savedX;
obj.y = 0;
savedX += coo.width;
}
Without knowing what the collection contains, I'm assuming it is filled with DisplayObjects or an object that has x and y properties?
Cast the reference so the compiler understands what the collection contains. For example:
DisplayObject(pos_array[index]).x = coo.x;
DisplayObject(pos_array[index]).y = coo.y;
...or whatever type your collection contains.
Perhaps pos.length and pos_array.length are not equal when the loop starts.
Try this:
while (pos.length>0)
{
coo = pos.splice(Math.floor(Math.random() * pos.length),1)[0];
if (pos_array[index])
{
(pos_array[index]).x = coo.x;
(pos_array[index]).y = coo.y;
}
index++;
}