Lesh
11-25-2009, 08:30 AM
1178: Attempted access of inaccessible property resetValue through a reference with static type Elements:GameIntro.
Within my document class I am trying to access a variable which is in my GameIntro.as but it is throwing up the error above. The variable I am trying to access is called resetValue which is in my gameintro.as file.
I have posted both my document and gameintro.as files below.
**THIS IS MY MAIN DOCUMENT CLASS LINKED TO MY ROBBERY.FLA FILE
package {
import flash.display.MovieClip;
import SetUp;
import Elements.GameIntro;
public class Robbery extends MovieClip {
var _GameIntro:GameIntro=new GameIntro ;
var _SetUp:SetUp=new SetUp ;
public function Robbery() {
// add gameintro to the stage
_GameIntro.name="_GameIntroName";
addChild(_GameIntro);
// ERROR IS BEING THROWN UP HERE
if (_GameIntro.resetValue==1) {
trace("now to add setUp");
//addChild(_SetUp);
}
_SetUp.addInstructions();
}// closes the constructor method
}// closes public class
}// closes package
**THIS IS MY GAMEINTRO CLASS LINKED TO MY DOCUMENT CLASS
package Elements{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class GameIntro extends MovieClip {
// Timer variables
var second=0;
var GameIntroTimer:Timer=new Timer(1000);
var thisParent=root;
var resetValue=0;
// constructor method
public function GameIntro() {
trace("GameIntro");
GameIntroTimer.addEventListener(TimerEvent.TIMER, clock);
GameIntroTimer.start();
}// closes constructor method
public function clock(evt:TimerEvent):void {
// every time this function is checked increment second by one
second+=1;
// if the second is 5 remove the gameintro from the document class
if (second>=5) {
// stop timer
removeEventListener(TimerEvent.TIMER, clock);
GameIntroTimer.stop();
// play function to remove gameintro
removeGameIntro();
}// closes if statement
}// closes function clock
// **************************
public function removeGameIntro() {
trace("removeGameIntro");
this.parent.removeChild(this);
// THIS IS THE VARIABLE BELOW THAT I AM TRYIN TO ACCESS FROM THE ROBBERY DOCUMENT CLASS
resetValue=1;
trace(resetValue);
}// close the function removeGameIntro
}// closes public class
}// closes package
Within my document class I am trying to access a variable which is in my GameIntro.as but it is throwing up the error above. The variable I am trying to access is called resetValue which is in my gameintro.as file.
I have posted both my document and gameintro.as files below.
**THIS IS MY MAIN DOCUMENT CLASS LINKED TO MY ROBBERY.FLA FILE
package {
import flash.display.MovieClip;
import SetUp;
import Elements.GameIntro;
public class Robbery extends MovieClip {
var _GameIntro:GameIntro=new GameIntro ;
var _SetUp:SetUp=new SetUp ;
public function Robbery() {
// add gameintro to the stage
_GameIntro.name="_GameIntroName";
addChild(_GameIntro);
// ERROR IS BEING THROWN UP HERE
if (_GameIntro.resetValue==1) {
trace("now to add setUp");
//addChild(_SetUp);
}
_SetUp.addInstructions();
}// closes the constructor method
}// closes public class
}// closes package
**THIS IS MY GAMEINTRO CLASS LINKED TO MY DOCUMENT CLASS
package Elements{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class GameIntro extends MovieClip {
// Timer variables
var second=0;
var GameIntroTimer:Timer=new Timer(1000);
var thisParent=root;
var resetValue=0;
// constructor method
public function GameIntro() {
trace("GameIntro");
GameIntroTimer.addEventListener(TimerEvent.TIMER, clock);
GameIntroTimer.start();
}// closes constructor method
public function clock(evt:TimerEvent):void {
// every time this function is checked increment second by one
second+=1;
// if the second is 5 remove the gameintro from the document class
if (second>=5) {
// stop timer
removeEventListener(TimerEvent.TIMER, clock);
GameIntroTimer.stop();
// play function to remove gameintro
removeGameIntro();
}// closes if statement
}// closes function clock
// **************************
public function removeGameIntro() {
trace("removeGameIntro");
this.parent.removeChild(this);
// THIS IS THE VARIABLE BELOW THAT I AM TRYIN TO ACCESS FROM THE ROBBERY DOCUMENT CLASS
resetValue=1;
trace(resetValue);
}// close the function removeGameIntro
}// closes public class
}// closes package