csr_1978
08-13-2009, 10:30 PM
Hi,
I have two components and i am trying to display pre-defined component1 state from component2 when a button is clicked.
My Code in Component2 to acheive this:
private function displayComponent1():void
{
var comp1:Component1;
comp1.currentState = 'addState';
}
I get this run time exception:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
so i changed my code to
private function displayComponent1():void
{
var comp1:Component1 = new Component1();
comp1.currentState = 'addState';
}
I dont get any exceptions but its not displaying component1. Can any one please help me out.
Thanks,
csr
I have two components and i am trying to display pre-defined component1 state from component2 when a button is clicked.
My Code in Component2 to acheive this:
private function displayComponent1():void
{
var comp1:Component1;
comp1.currentState = 'addState';
}
I get this run time exception:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
so i changed my code to
private function displayComponent1():void
{
var comp1:Component1 = new Component1();
comp1.currentState = 'addState';
}
I dont get any exceptions but its not displaying component1. Can any one please help me out.
Thanks,
csr