Author Topic: Javascript in State Machine Simulation  (Read 2524 times)

philchudley

  • EA User
  • **
  • Posts: 743
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Javascript in State Machine Simulation
« on: October 02, 2013, 11:20:29 pm »
Hi All

Below is an extract of JavaScript behaviour in an operation within a state

dialog.TrafficLightSimulation.SecDownLights.Text="RED";
dialog.TrafficLightSimulation.SecUpLights.Text="RED";
Trace("Initial completed");
//sim.Counter=10000;
for (var i=0; i < 5000; i++)
{
}

[highlight]dialog.TrafficLightSimulation.SecDownLights.Text="RED YELLOW";[/highlight]

I wish to crate a simulated delay between the colours of the lights, hence a simple for loop

However, when I run the script all is fine until the highlighted step, where the following is displayed:

[highlight]TypeError: $Root.Get("dialog.TrafficLightSimulation.SecDownLights") is null[/highlight]

How can this be when it has the value "RED" and displayed correctly on the dialog?

Any ideas?
Models are great!
Correct models are even greater!