Packageorg.ffilmation.engine.core
Classpublic class fEngine
InheritancefEngine Inheritance flash.events.EventDispatcher

The fEngine class is the main class in the game engine.

Use the fEngine class to create and attach game scenes to your game.

You can also use it to load external swfs containing media you want to add to you scenes.

Once the scenes are created you can go from one to another using the methods in the fEngine class. The class handles all the drawing and screen refreshing.


Example
The following code sets a basic isometric application with one scene
  // Create container
  var filmationTest:Sprite = new Sprite()
  addChild(filmationTest)
  filmationTest.x = 0
  filmationTest.y = 100
  
  // Create engine
  var film = new fEngine(filmationTest)
  
  // Create scene and listen to load events
  var scenel = film.createScene(new fSceneLoader("western.xml"),800,400)
  scenel.addEventListener(fScene.CHANGESTAT, actionHandler)
  scenel.addEventListener(fScene.LOAD, loadHandler)

  function actionHandler(evt:Event) {
    trace("EVENT "+evt.target.stat)
  }
    function loadHandler(evt:Event) {
   // Scene is loaded and ready
  
   // Create a camera and make it active
   var cam = scenel.createCamera()
   scenel.setCamera(cam)
  
   // Render
   scenel.render()
   film.showScene(scenel)
  }  
    



Public Properties
 PropertyDefined by
  bumpMapping : Boolean
[static] This property enables/disables bumpmapping globally.
fEngine
  characterShadows : Boolean
[static] This property enables/disables shadow projection of characters
fEngine
  objectShadows : Boolean
[static] This property enables/disables shadow projection of objects
fEngine
Public Methods
 MethodDefined by
  
fEngine(container:Sprite)
Constructor for the fEngine class.
fEngine
  
createScene(retriever:fEngineSceneRetriever, width:Number, height:Number):fScene
This method creates an scene from an XML definition file.
fEngine
  
hideScene(sc:fScene):void
Hides / disables a scene
fEngine
  
loadMedia(src:String):*
This method loads an external media file.
fEngine
  
showScene(sc:fScene):void
Makes active one scene in the Engine.
fEngine
Public Constants
 ConstantDefined by
  MEDIALOADCOMPLETE : String = "enginemedialoadcomplete"
[static] The fEngine.MEDIALOADCOMPLETE constant defines the value of the type property of the event object for a enginemedialoadcomplete event.
fEngine
  MEDIALOADPROGRESS : String = "enginemedialoadprogress"
[static] The fEngine.MEDIALOADPROGRESS constant defines the value of the type property of the event object for a enginemedialoadprogress event.
fEngine
Property detail
bumpMappingproperty
bumpMapping:Boolean  [read-write]

This property enables/disables bumpmapping globally. Please note that for the bumpMapping to work in a given surface and light, the surface will need a bumpMap definition and the light must be defined as bumpmapped. Beware that only fast computers will be able to handle this in realtime

Implementation
    public static function get bumpMapping():Boolean
    public function set bumpMapping(value:Boolean):void
characterShadowsproperty 
characterShadows:Boolean  [read-write]

This property enables/disables shadow projection of characters

Implementation
    public static function get characterShadows():Boolean
    public function set characterShadows(value:Boolean):void
objectShadowsproperty 
objectShadows:Boolean  [read-write]

This property enables/disables shadow projection of objects

Implementation
    public static function get objectShadows():Boolean
    public function set objectShadows(value:Boolean):void
Constructor detail
fEngine()constructor
public function fEngine(container:Sprite)

Constructor for the fEngine class.

Parameters
container:Sprite — An sprite object where the engine will draw your game
Method detail
createScene()method
public function createScene(retriever:fEngineSceneRetriever, width:Number, height:Number):fScene

This method creates an scene from an XML definition file. The scene starts loading and compiling at this moment, but will not be ready to use yet. You should wait for the scene's LOAD event before making it active

Parameters
retriever:fEngineSceneRetriever — Any class that implements the fEngineSceneRetriever interface
 
width:Number — Width of the viewport, in pixels. This avoids the need of masking the whole sprite
 
height:Number — Height of the viewport, in pixels. This avoids the need of masking the whole sprite

Returns
fScene — A fScene Object.
hideScene()method 
public function hideScene(sc:fScene):void

Hides / disables a scene

Parameters
sc:fScene — The fScene you want to hide
loadMedia()method 
public function loadMedia(src:String):*

This method loads an external media file. Once the media file is loaded, the symbols in that file can be used in you scene definitions. Listen to the engine's MEDIALOADPROGRESS and MEDIALOADCOMPLETE to control the process. The class checks if the media is already loaded to avoid duplicate loads.

Parameters
src:String — Path to the swf file you want to load

Returns
*
showScene()method 
public function showScene(sc:fScene):void

Makes active one scene in the Engine. Only one scene can be active ( visible ) at the same time. The current active scene, if any, will me moved to the inactive scene list

Parameters
sc:fScene — The fScene you want to activate
Constant detail
MEDIALOADCOMPLETEconstant
public static const MEDIALOADCOMPLETE:String = "enginemedialoadcomplete"

The fEngine.MEDIALOADCOMPLETE constant defines the value of the type property of the event object for a enginemedialoadcomplete event. The event is dispatched when the external media file finishes loading.

MEDIALOADPROGRESSconstant 
public static const MEDIALOADPROGRESS:String = "enginemedialoadprogress"

The fEngine.MEDIALOADPROGRESS constant defines the value of the type property of the event object for a enginemedialoadprogress event. The event is dispatched when there is a progress in loading an external media file, allowing to update a progress bar, for example.