Skip to main content
Known Participant
April 11, 2011
Answered

TypeError: Error #1009: Cannot access a property or method of a null object reference.

  • April 11, 2011
  • 1 reply
  • 823 views

I'm having some real difficulty here. 

I've been trying to push a random number into an array, but have slammed into this absolute weird error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at memory_v02_fla::MainTimeline/light()[file_fla.MainTimeline::frame1:15]

at memory_v02_fla::MainTimeline/startGame()[file_fla.MainTimeline::frame1:21]

at memory_v02_fla::MainTimeline/memory_v02_fla::frame1()[file_fla.MainTimeline::frame1:24]

I have no idea what this is, and what I can do to solve it.  Does anybody have any idea?  Here's my proceeding code.

Code:

// Import Tweener

import caurina.transitions.Tweener;

import caurina.transitions.properties.ColorShortcuts;

ColorShortcuts.init();

var aPieces:Array = [m1,m2,m3,m4];

var aMoveList:Array;

function light(num){

Tweener.addTween(aPieces[num], {_brightness:2, time:1});

Tweener.addTween(aPieces[num], {_brightness:0, time:1, delay:1});

//This next line is responsible for the error

aMoveList.push(num);

}

function startGame(){

var first:Number = Math.floor(Math.random()*4);

light(first);

}

startGame();

This topic has been closed for replies.
Correct answer Ned Murphy

Your array is still null when you try to push anything into it... try:

var aMoveList:Array = new Array();

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 11, 2011

Your array is still null when you try to push anything into it... try:

var aMoveList:Array = new Array();

patachAuthor
Known Participant
April 11, 2011

That seemed to have done it, thank you very much!

Ned Murphy
Legend
April 11, 2011

You're welcome