Flash Front End

From SRASWiki

Jump to: navigation, search


Flash Implementation


The Front End has been designed using Creative Studio 5 and has been written in Action Script 3, it is completely stateless and separate from the engine. At the end of each turn data is POSTED to the engine through an XML file, after being processed the engine sends a new XML to the Flash which then redraws the ward with the new parameters. Having the Front End separate from the engine means it can be adapted to fit any need such as construction site management or fire department resources.

User Interface

The user interface has been designed to provide the user with key information without trying to clutter the screen, the NurseStatus bar and the Patient Listing provide information on patients well-being and available resources. Glowing beds show new events while further information can be found by clicking on the bed, and by clicking a NurseStatus a brief Nurse biography is available.


Key Classes

Actions Layer


  • placeCarePlan()
  • placeBedCarePlan() This function is used as both the bed and the bedchart will place a CarePlan on the ward
  • removeCarePlan()
  • placeNurseProfile()
  • removeNurseProfileBox()
  • nurseStatusGlow()
  • removeNurseStatusGlow()
Array Administrator

This class contains arrays which hold all the possible co-ordinates for the following objects:

  • Nurses
  • Nurse Status Bar
  • Beds (with patients)
  • Hotspots
  • Labels

Each array holds an x and y co-ordinate value and if the array is for CoordPlus it will include a flipper value, this is used to flip a movie clip along its x axis. The class also contains a get functions to return each of the arrays.


Each Nurse is passed five parameters;

  • NurseID, this is passed by the XML and is used by the engine to identify which nurse object is allocated to each event.
  • Name is also passed by the XML and is provided for the used so they can identify each Nurse.
  • An interger value is passed to represent a Nurse's rank which is used to define if a Nurse completes an event competently or incompetently.
  • Initial Coordinates are taken from Array Administrator which give a return position when a nurse is not allocated to an event.
  • Nurse Status, the nurse status is an EventID which tells the Front End and Engine to what event a Nurse is allocated to.

Name, rank and status are used by the NurseStatus bar to display real time information about the Nurses on the ward. Rank and Status are converted to suitable strings to represent the values.

The Nurse class represents a nurse of rank one (Health Care Support Worker) extension classes named NurseRankTwo through to NurseRankFour are used to represent the other ranks.


Each Patient is passed three parameters;

  • Name, similar to the Nurse Name this is passed by the XML and is used as a Front End user identification of the Patient.
  • PatientID, this is used by the engine to identify which patient and event is applied to.
  • PatientDisplayText is a string which is presented in a Patients Careplan and explains a brief history of the Patient to the user.

It is worth noting that a patient does not receive coordinates, this is because a bed is given a location and then passed a Patient which is linked to that bed.

The Patient's name is also used in the PatientListing, similar to the NurseStatus bar this provides a real time display of the Patient's well being for the user.

SRAS Event

Each SRAS Event is passed four parameters;

  • EventID, similar to the other ID's this is used to link Front End actions concerning events with the engine.
  • isNewEvent is a Boolean value to represent if the Event is new, and is used to make the beds glow when a new patient is applied.
  • Stations, this integer value represents how many hotspots are needed for the event and therefore how many staff are needed to fulfil it.
  • EventDisplayText is a string which is displayed along side the PatientDisplayText on the CarePlan and is used to explain the event to the user.

The isNewEvent will remain true until a nurse is applied to the event, this means the bed will continue to glow until the patient is cared for.

Extended Classes


This class uses the following parameters in creating a bed instance;

  • coordp:CoordPlus
  • pat:Patient
  • labelCoord:Coordinate
  • chartCoord:CoordPlus
  • carePlanCoord:Coordinate

An extension of the BedInstance, simply creates another bed instance using the same parameters however using the empty bed movie clip


Parameters used in constructor;

  • coordp:CoordPlus
  • p:Patient
  • carePlanCoord:Coordinate

This creates the charts displayed at the end of each patients bed, empty beds will not display a chart. Functions include;

  • getCarePlan() this returns the corresponding CarePlan to match the bed and patient.

Parameters used;

  • coord:Coordinate
  • p:Patient

This class creates an instance of the care plan. scrollTextUp() and scrollTextDown()are used to deal with text overflow on the clipboard.


Parameters used in constructor;

  • xc:Number
  • xy:Number

Functions include;

  • getX() this fucntion returns a number which is taken as an x coordinate for an object's location
  • getY() this function returns a number which is taken as a y coordinate for an object's location

This class is an extension of the Coordinate class and contains the added parameter of a flipper coordinate, the flipper coordinate if -1 will flip the image about its x axis


The DebugText class simply declares the location that the debug box will appear, to implement the debug box first drag a debug button onto the ward and then uncomment lines 43 and 44 of the actions layer.


This class contains a number predefined glow filters used throughout the code, the functions within the class are used to add this glow effect to a MovieClip or Object.



  • c:Coordinate

The Hotspot class contains two important functions; the first, setOccupied() assigns a nurse to a hotspot therefore fulfilling the requirements of an event. The second getOccupied() is used when redrawing the ward at the start of each turn so that a nurse is drawn in a hotspot if previously assigned to it instead of placing them at their default location.



  • coordp:Coordinate
  • p:Patient

Using the getLabel() function a label instance containing a patients name is returned and added to the stage above the patients bed.



  • nom:String
  • r:int
  • n:Nurse

The nurse label follows the same principals as the label instance however this form of label displays a nurses name and rank in the top left corner.


Parameters used within the constructor;

  • c:Coordinate
  • p:String

This class sets up the NurseStatus boxes which represent each of the nurses on stage, the actual text is taken from the XML in the actions layer. It converts the integer rank to a suitable string representation, while also displaying the nurses name and status.


This class simply sets the location at which the NurseProfileBox (a brief biography of each nurse) appears on the stage.


This class extends the Nurse class and uses the same parameters, however uses the movieclip used to represent a nurse of rank two (1st Year Student Nurse)


This class extends the Nurse class and uses the same parameters, however uses the movieclip used to represent a nurse of rank three (3rd Year Student Nurse)


This class extends the Nurse class and uses the same parameters, however uses the movieclip used to represent a nurse of rank four (Staff Nurse)


Parameters used in constructor;

  • pata:Array (This is an array which contains the patients on the ward)

A key variable worth noting is var arrPatientList[] this contains the six patient list text boxes, by putting them in an array each text box is matched with a corresponding patient. The for loop in this class uses an arbitrary variable called counter to cycle through both the arrays and set the text for the patient listing.


Key variables;

  • arrStaffRoomOccupants[]:Array (this array holds the nurses which have been applied to the staffroom hotspots as part of a "break" event)

There are three functions in this class, addToStaffRoom(), getStaffRoomOccupants() and removeFromStaffRoom(), these functions add nurses to the above array, return the array and remove nurses from the array respectively.


Parameters used in constructor;

  • arrBedsOnStage:Array
  • a (this represents the actions layer)
  • currentTurn:Number

This class is used to gather all the actions taken by the player such as allocations and create an Xml which is then posted to the engine to be processed.

Known Issues

The Nurse Biography very rarely appears while clicking the text of Nurse Status, to guarantee it appears the icon of the nurse in Nurse Status must be clicked. If the text is clicked and the biography does not appear an output error is generated in the flash.

Personal tools