Hey everyone so I am trying to access boolean variables from a separate class called mcPressMachine
using my main class SmashyFoodEngine
. What I want to do is when the score is >= 6 then change the boolean values like so in my Main Engine Class Enter Frame Event:
if (nScore >= 6)
{
for each(var AllPresses:mcPressMachine in aPressMachineArray)
{
AllPresses.level_1 = false;
AllPresses.level_2 = true;
}
}
in my mcPressMachine
class I have the booleans set up to control what frames of that Movie Clip class on the timeline will be played next. So basically if level_1 is true then play randome frames from (1,8) if level_2 is true then frames (9,13) etc... Which is setup like so in the pressMachine Class:
public var level_1:Boolean = true;
public var level_2:Boolean = false;
private function init():void
{
if (level_1)
{
var randomFrameLevel_1:Number = randomNumber(1, 8);
this.gotoAndStop(randomFrameLevel_1);
}
if (level_2)
{
var randomFrameLevel_2:Number = randomNumber(9, 13);
this.gotoAndStop(randomFrameLevel_2);
}
}
so When I trace it and the score is >= 6 the boolean values change perfectly but nothing happens on the screen. The Movie Clips are the exact same and dont change to the level_2 frames (9-13);
Also this is the Movie clip in my Main Class that is added to the stage and im trying to change:
private function addNewPressMachines():void
{
//have array of press machines come out 5 at a time.
for (var i:int = 0; i < 2; i++)
{
//trace(aPressMachineArray.length + "PRESS MACHINES");
pressMachine = new mcPressMachine();
pressMachine.x = startPoint.x + (xSpacing * i);
pressMachine.y = (stage.stageHeight / 2);
stage.addChildAt(pressMachine, 1);
aPressMachineArray.push(pressMachine);
pressMachine.inner.top.visible = false;
pressMachine.inner.top.topText.text = " " + sharedObjectHighScore.data.highScore;
}
}
Can anyone see if I am doing something wrong? I don't get any errors just not working properly. Any advice would be awesome. Thank you!