[RESOLVED] Can't set array values inside a class
This is problably a noob question, sorry.
I have this code inside a public class:
Code:
// background
const ww = 480;
const hh = 272;
// data for the target
var targDisp:int = 25;
var targWidth:int = 50;
var targHeight:int = 50;
var targMargin:int = 10;
// Define positions
var targPositions:Array = new Array();
targPositions[0] = [(ww / 2) - (targWidth / 2),targMargin];// upper mid position
targPositions[1] = [(ww / 2) - (targWidth / 2),targHeight - targMargin];// lower mid position
targPositions[2] = [targMargin,(hh / 2) - (targHeight / 2)];// left
targPositions[3] = [targWidth - targMargin,(hh / 2) - (targHeight / 2)];// right
When running the code I get:
Code:
Line 51 1120: Access of undefined property targPositions.
And so on. I get no error for declaring the targPositions aray, however get lots of error when setting values to it.
If I place the code in the main timeline it works fine.