4 Replies - 1509 Views - Last Post: 15 June 2016 - 11:27 AM

#1 rebeccah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-June 16

Getting error #1009 HELP!

Posted 15 June 2016 - 10:31 AM

Hey! I cant figure out why i get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.controls::ComboBox/get value()
at ingrideksamen1_fla::MainTimeline/neste()

This is my code in frame 1:
stop();
BTNStatistikk.addEventListener(MouseEvent.CLICK, neste);

var Undersøking:Array = new Array("Kjønn","Alder","Nøygd?","Anbefaling");//unødvendig arrayer inni her. Men det skaper system å se hva som er hva
Undersøking[0] = new Array(1, 2);//da som står i sjølve rolldowngreia
Undersøking[1] = new Array (1, 2);//osv
Undersøking[2] = new Array(1, 2);//osv

var Antall:Array = new Array();

function neste(e:MouseEvent) //gå til neste side for å vise tabellen
{
	Antall[0] = NS0.value; //setter inn hvor mange av hver matvare vi har
	Antall[1] = NS2.value;
	Antall[2] = NS3.value;
	nextFrame(); // går til neste side
}
:code:

--------

and then the code in frame 2 (this is when the error comes in):

BTNTilbake.addEventListener(MouseEvent.CLICK, tilbake); //eventlistener for å komme seg tilbake til første side


stolpe1.scaleX=(Undersøking[0][0]*Antall[0])/2; //scaler opp hvor søylene mine. Deler på 2 slik at man kan få mer mat inn i diagrammet
stolpe3.scaleX=(Undersøking[1][0]*Antall[1])/2;
stolpe4.scaleX=(Undersøking[2][0]*Antall[2])/2;


var kjønn:Number = 0; //Variablene som blir outputta
var fornøyd:Number = 0;
var anb:Number = 0;


for (var i:int=0; i<Undersøking.length; i++) // for løkke for å telle sammen alle næringsstoffene
{
	kjønn +=  Undersøking[i][0] * Antall[i];
	fornøyd +=  Undersøking[i][1] * Antall[i];
	anb +=  Undersøking[i][2] * Antall[i];
}

TotKjønn.text = "" + kjønn;//setter inn verdiene i output boxene mine
TotNøygd.text = "" + fornøyd.toFixed(1);
TotAnbefaling.text = "" + anb.toFixed(1);

function tilbake(e:MouseEvent) //går tilbake til forrige frame, om man vil gjøre det på nytt
{
	prevFrame();
}
:code:

--

thanks for all help!

This post has been edited by modi123_1: 15 June 2016 - 10:35 AM
Reason for edit:: please use the '[code]' tag button in the editor


Is This A Good Question/Topic? 0
  • +

Replies To: Getting error #1009 HELP!

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15172
  • View blog
  • Posts: 60,735
  • Joined: 12-June 08

Re: Getting error #1009 HELP!

Posted 15 June 2016 - 10:35 AM

In the future, please use the '[code ]' tag button in the editor.

Quote

Cannot access a property or method of a null object

FYI - it seems pretty straight forward. Find out your control and see why it is 'null' or has not be instantiated.
Was This Post Helpful? 0
  • +
  • -

#3 rebeccah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-June 16

Re: Getting error #1009 HELP!

Posted 15 June 2016 - 10:38 AM

View Postmodi123_1, on 15 June 2016 - 10:35 AM, said:

In the future, please use the '[code ]' tag button in the editor.

Quote

Cannot access a property or method of a null object

FYI - it seems pretty straight forward. Find out your control and see why it is 'null' or has not be instantiated.



I dont quite understand?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15172
  • View blog
  • Posts: 60,735
  • Joined: 12-June 08

Re: Getting error #1009 HELP!

Posted 15 June 2016 - 10:42 AM

Also you really don't need to quote the post right above yours.

Which part do you not understand? The use of code tags, or the straight forward error message?
Was This Post Helpful? 0
  • +
  • -

#5 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2355
  • View blog
  • Posts: 7,192
  • Joined: 15-January 14

Re: Getting error #1009 HELP!

Posted 15 June 2016 - 11:27 AM

According to the error message, it looks like the error is from the neste function. Since it's telling you that you're trying to get a property of a non-object, I would assume that NS0, NS2, and/or NS3 is not an object. Those are the only things in that function where you're trying to access a property of an object.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1