Packageorg.papervision3d.utils
Classpublic class InteractiveSceneManager
InheritanceInteractiveSceneManager Inheritance flash.events.EventDispatcher

InteractiveSceneManager handles all the traffic and sub rendering of faces for mouse interactivity within an interactive scene.

When you create an InteractiveScene3D object, it automatically creates the InteractiveSceneManager (ISM for short) for you. From there on, any 3D object using an interactive material will automatically be given mouse events that are dispatched through the ISM OR the DisplayObject3D itself. The event type is InteractiveScene3DEvent.

ISM has 2 modes:

Object level mode is a bit faster in that sprite containers for the objects are created and then all faces are drawn in that container. You're able to receive mouse events based on the objects, but not the contents of the materials used on the objects.

For example, if you created a movieclip, put UI components in it and applied it to a DisplayObject3D (DO3D for short), you would not be able to interact with those elements in your movieclip. But you WOULD be able to have mouse events on the entire DO3D.

Face level mode creates sprite containers for each face of a DO3D that uses an interactive material and gives you the ability to interact with a movieclips objects like UI components.

For example, if you created a movieclip, put UI components in it and applied it to a DO3D, you would be able to interact with those elements in your movieclip and receive their mouse events like you normally would.

There is one other option for faceLevelMode and that's directly on the DO3D's themselves. This is even heavier in terms of speed, but its there if you need face level access to all DO3D's. DisplayObject3D.faceLevelMode is a public static property that when set to true, causes all DO3D's do create their own sprite containers for their faces. The difference between this and what the ISM does is that, the ISM only draws faces for DO3D's that have interactive materials - giving you the control you need to dictate what needs interactivity and what doesn't.



Public Properties
 PropertyDefined by
  buttonMode : Boolean = false
When set to true, the hand cursor is shown over objects that have mouse events assigned to it.
InteractiveSceneManager
  container : Sprite
Main container for ISM to create the sub InteractiveSprite containers for the faces and DO3D objects passed in during the render loop
InteractiveSceneManager
  containerDictionary : Dictionary
A dictionary where the DO3D's and Face3D objects are stored.
InteractiveSceneManager
  debug : Boolean = false
Setting to true will show output via trace window in IDE or Xray's output
InteractiveSceneManager
  DEFAULT_FILL_ALPHA : Number = 1
[static] Alpha value 0-1 of the drawn face
InteractiveSceneManager
  DEFAULT_FILL_COLOR : Number = 0xFFFFFF
[static] Color used to draw the face in the sprite container
InteractiveSceneManager
  DEFAULT_LINE_ALPHA : Number = 1
[static] Alpha value 0-1 of the line drawn around the face
InteractiveSceneManager
  DEFAULT_LINE_COLOR : Number = -1
[static] Color used for the line drawn around the face
InteractiveSceneManager
  DEFAULT_LINE_SIZE : Number = 1
[static] Line size of the line drawn around the face
InteractiveSceneManager
  DEFAULT_SPRITE_ALPHA : Number = 1
[static] Alpha value 0-1 of the sprite container created for DO3D's or Face3D containers in the ISM
InteractiveSceneManager
  enableMouse : Boolean
Boolean value that sets Mouse3D.enabled = true
InteractiveSceneManager
  faceDictionary : Dictionary
A dictionary where the InteractiveContainerData objects are stored for DO3D's or Face3D objects.
InteractiveSceneManager
  faceLevelMode : Boolean = false
This allows objects faces to have their own containers.
InteractiveSceneManager
  mouse3D : Mouse3D
Mouse3D gives you a pointer in 3D space that orients itself to a face your mouse is currently over.
InteractiveSceneManager
  mouseInteractionMode : Boolean
If the user sets this to true, then we monitor the allowDraw flag via mouse interaction and we only draw the faces if there's mouse interaction with the scene.
InteractiveSceneManager
  MOUSE_IS_DOWN : Boolean = false
[static] MOUSE_IS_DOWN is a quick static property to check and is maintained by the ISM
InteractiveSceneManager
  scene : SceneObject3D
InteractiveScene3D instance, usually passed in by the constructor
InteractiveSceneManager
  SHOW_DRAWN_FACES : Boolean = false
[static] The ISM, by default, uses a BlendMode.ERASE to hide the hit area of the drawn face.
InteractiveSceneManager
  virtualMouse : VirtualMouse
VirtualMouse is used with faceLevelMode of ISM or DO3D's.
InteractiveSceneManager
Public Methods
 MethodDefined by
  
InteractiveSceneManager
  
addInteractiveObject(container3d:Object):void
Adds a DisplayObject3D or Face3D object to the ISM
InteractiveSceneManager
  
drawFace(container3d:DisplayObject3D, face3d:Face3D, x0:Number, x1:Number, x2:Number, y0:Number, y1:Number, y2:Number):void
drawFace is called from each of the interactive materials in the render loop.
InteractiveSceneManager
  
resetFaces():void
When called, all faces are cleared and the isDrawn flag is reset on the InteractiveContainerData objects to ready them for the next loop.
InteractiveSceneManager
  
resizeStage():void
When called, aligns the ISM's container with the scene's container to make sure faces drawn in the ISM are aligned with the scene perfectly
InteractiveSceneManager
  
Convenience method to help set the default parameters of the ISM.
InteractiveSceneManager
  
sortObjects():void
After the render loop is completed, InteractiveScene3D calls this method to sort the interactive scene objects.
InteractiveSceneManager
Protected Methods
 MethodDefined by
  
handleMouseClick(e:MouseEvent):void
Handles the MOUSE_CLICK event on an InteractiveSprite container
InteractiveSceneManager
  
handleMouseMove(e:MouseEvent):void
Handles the MOUSE_MOVE event on an InteractiveSprite container
InteractiveSceneManager
  
handleMouseOut(e:MouseEvent):void
Handles the MOUSE_OUT event on an InteractiveSprite container
InteractiveSceneManager
  
handleMouseOver(e:MouseEvent):void
Handles the MOUSE_OVER event on an InteractiveSprite container
InteractiveSceneManager
  
handleMousePress(e:MouseEvent):void
Handles the MOUSE_DOWN event on an InteractiveSprite container
InteractiveSceneManager
  
handleMouseRelease(e:MouseEvent):void
Handles the MOUSE_UP event on an InteractiveSprite container
InteractiveSceneManager
  
handleReleaseOutside(e:MouseEvent):void
Handles mouse clicks on the stage.
InteractiveSceneManager
  
handleStageMouseMove(e:MouseEvent):void
When ISM is in mouseInteractionMode, we capture mouse move events from the stage to trigger a draw
InteractiveSceneManager
Events
 EventSummaryDefined by
   Dispatched when an InteractiveSprite container in the ISM recieves a MouseEvent.CLICK InteractiveSceneManager
   Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_MOVE event InteractiveSceneManager
   Dispatched when an InteractiveSprite in the ISM receives an MouseEvent.MOUSE_OUT event InteractiveSceneManager
   Dispatched when an InteractiveSprite in the ISM receives an MouseEvent.MOUSE_OVER event InteractiveSceneManager
   Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_PRESS event InteractiveSceneManager
   Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_RELEASE event InteractiveSceneManager
   Dispatched when the main container of the ISM is clicked InteractiveSceneManager
   Dispatched when an InteractiveSprite is created in the ISM for drawing and mouse interaction purposes InteractiveSceneManager
Property detail
buttonModeproperty
public var buttonMode:Boolean = false

When set to true, the hand cursor is shown over objects that have mouse events assigned to it.

containerproperty 
public var container:Sprite

Main container for ISM to create the sub InteractiveSprite containers for the faces and DO3D objects passed in during the render loop

containerDictionaryproperty 
public var containerDictionary:Dictionary

A dictionary where the DO3D's and Face3D objects are stored. You can get to a DO3D or Face3D by supplying the sprite container reference:

var do3d:DisplayObject3D = containerDictionary[spriteInstance]; or var face3d:Face3D = containerDictionary[spriteInstance];

debugproperty 
public var debug:Boolean = false

Setting to true will show output via trace window in IDE or Xray's output

DEFAULT_FILL_ALPHAproperty 
public static var DEFAULT_FILL_ALPHA:Number = 1

Alpha value 0-1 of the drawn face

DEFAULT_FILL_COLORproperty 
public static var DEFAULT_FILL_COLOR:Number = 0xFFFFFF

Color used to draw the face in the sprite container

DEFAULT_LINE_ALPHAproperty 
public static var DEFAULT_LINE_ALPHA:Number = 1

Alpha value 0-1 of the line drawn around the face

DEFAULT_LINE_COLORproperty 
public static var DEFAULT_LINE_COLOR:Number = -1

Color used for the line drawn around the face

DEFAULT_LINE_SIZEproperty 
public static var DEFAULT_LINE_SIZE:Number = 1

Line size of the line drawn around the face

DEFAULT_SPRITE_ALPHAproperty 
public static var DEFAULT_SPRITE_ALPHA:Number = 1

Alpha value 0-1 of the sprite container created for DO3D's or Face3D containers in the ISM

enableMouseproperty 
enableMouse:Boolean  [read-write]

Boolean value that sets Mouse3D.enabled = true

Implementation
    public function get enableMouse():Boolean
    public function set enableMouse(value:Boolean):void
faceDictionaryproperty 
public var faceDictionary:Dictionary

A dictionary where the InteractiveContainerData objects are stored for DO3D's or Face3D objects. You can get to a DO3D or Face3D's InteractiveContainerDate object with:

var icd:InteractiveContainerData = faceDictionary[do3dInstance];

faceLevelModeproperty 
public var faceLevelMode:Boolean = false

This allows objects faces to have their own containers. When set to true and the DisplayObject3D.faceLevelMode = false, the faces will be drawn in ISM's layer of containers

mouse3Dproperty 
public var mouse3D:Mouse3D

Mouse3D gives you a pointer in 3D space that orients itself to a face your mouse is currently over. It copy's the transform information of the face giving you the ability to do something in 3D at that same location

mouseInteractionModeproperty 
mouseInteractionMode:Boolean  [read-write]

If the user sets this to true, then we monitor the allowDraw flag via mouse interaction and we only draw the faces if there's mouse interaction with the scene. This is meant to maximize CPU for interactivity If set to true, then leave SHOW_DRAWN_FACES set to false to avoid odd drawings over the 3D scene

Implementation
    public function get mouseInteractionMode():Boolean
    public function set mouseInteractionMode(value:Boolean):void
MOUSE_IS_DOWNproperty 
public static var MOUSE_IS_DOWN:Boolean = false

MOUSE_IS_DOWN is a quick static property to check and is maintained by the ISM

sceneproperty 
public var scene:SceneObject3D

InteractiveScene3D instance, usually passed in by the constructor

SHOW_DRAWN_FACESproperty 
public static var SHOW_DRAWN_FACES:Boolean = false

The ISM, by default, uses a BlendMode.ERASE to hide the hit area of the drawn face. Setting this to true will show the drawn faces and give you the ability to add whatever type effects/filters you want over your scene and 3D objects.

When set to true, you should set DEFAULT_SPRITE_ALPHA, DEFAULT_FILL_ALPHA and DEFAULT_FILL_COLOR as these will dictate how the faces are drawn over the scene.

Setting DEFAULT_SPRITE_ALPHA = 0 will give you the same effect as the blendmode, but only slower. A combination of DEFAULT_SPRITE_ALPHA and DEFAULT_FILL_ALPHA along with filters can really give you some nice visual affects over your scene for your 3D objects.

virtualMouseproperty 
public var virtualMouse:VirtualMouse

VirtualMouse is used with faceLevelMode of ISM or DO3D's. Its a virtual mouse that causes the objects in your materials movieclip containers to fire off their mouse events such as click, over, out, release, press etc

Using these events requires you only to do what you normally do - establish listeners with your objects like you normally would, and you'll receive them!

Constructor detail
InteractiveSceneManager()constructor
public function InteractiveSceneManager(p_scene:SceneObject3D)

Parameters
p_scene:SceneObject3D — The InteractiveScene3D object instance. This is passed in via the constructor of InteractiveScene3D when you create a new one.
Method detail
addInteractiveObject()method
public function addInteractiveObject(container3d:Object):void

Adds a DisplayObject3D or Face3D object to the ISM

Parameters
container3d:Object
drawFace()method 
public function drawFace(container3d:DisplayObject3D, face3d:Face3D, x0:Number, x1:Number, x2:Number, y0:Number, y1:Number, y2:Number):void

drawFace is called from each of the interactive materials in the render loop. It either receives DisplayObject3D or a Face3D object reference. It then creates a container if one doesn't exist. Then, it draws the face into the designated container which is an InteractiveSprite.

Parameters
container3d:DisplayObject3D
 
face3d:Face3D
 
x0:Number
 
x1:Number
 
x2:Number
 
y0:Number
 
y1:Number
 
y2:Number
handleMouseClick()method 
protected function handleMouseClick(e:MouseEvent):void

Handles the MOUSE_CLICK event on an InteractiveSprite container

Parameters
e:MouseEvent
handleMouseMove()method 
protected function handleMouseMove(e:MouseEvent):void

Handles the MOUSE_MOVE event on an InteractiveSprite container

Parameters
e:MouseEvent
handleMouseOut()method 
protected function handleMouseOut(e:MouseEvent):void

Handles the MOUSE_OUT event on an InteractiveSprite container

Parameters
e:MouseEvent
handleMouseOver()method 
protected function handleMouseOver(e:MouseEvent):void

Handles the MOUSE_OVER event on an InteractiveSprite container

Parameters
e:MouseEvent
handleMousePress()method 
protected function handleMousePress(e:MouseEvent):void

Handles the MOUSE_DOWN event on an InteractiveSprite container

Parameters
e:MouseEvent
handleMouseRelease()method 
protected function handleMouseRelease(e:MouseEvent):void

Handles the MOUSE_UP event on an InteractiveSprite container

Parameters
e:MouseEvent
handleReleaseOutside()method 
protected function handleReleaseOutside(e:MouseEvent):void

Handles mouse clicks on the stage. If so, we release a releaseOutside event

Parameters
e:MouseEvent
handleStageMouseMove()method 
protected function handleStageMouseMove(e:MouseEvent):void

When ISM is in mouseInteractionMode, we capture mouse move events from the stage to trigger a draw

Parameters
e:MouseEvent
resetFaces()method 
public function resetFaces():void

When called, all faces are cleared and the isDrawn flag is reset on the InteractiveContainerData objects to ready them for the next loop. This is called via InteractiveScene3D before the render.

resizeStage()method 
public function resizeStage():void

When called, aligns the ISM's container with the scene's container to make sure faces drawn in the ISM are aligned with the scene perfectly

setInteractivityDefaults()method 
public function setInteractivityDefaults():void

Convenience method to help set the default parameters of the ISM. This gives you faceLevelMode and buttonMode interaction on your scene. Setting faceLevelMode = false reverts ISM to Object level mode

sortObjects()method 
public function sortObjects():void

After the render loop is completed, InteractiveScene3D calls this method to sort the interactive scene objects. If nothing was drawn into a container, it's completely ignored at this level as well.

Event detail
mouseClickevent 
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_CLICK

Dispatched when an InteractiveSprite container in the ISM recieves a MouseEvent.CLICK

Dispatched when a container in the ISM recieves a MouseEvent.CLICK event

mouseMoveevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_MOVE

Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_MOVE event

Dispatched when a container in the ISM receives a MouseEvent.MOUSE_MOVE event

mouseOutevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_OUT

Dispatched when an InteractiveSprite in the ISM receives an MouseEvent.MOUSE_OUT event

Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OUT event

mouseOverevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_OVER

Dispatched when an InteractiveSprite in the ISM receives an MouseEvent.MOUSE_OVER event

Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OVER event

mousePressevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_PRESS

Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_PRESS event

Dispatched when a container in the ISM receives a MouseEvent.MOUSE_PRESS event

mouseReleaseevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_RELEASE

Dispatched when an InteractiveSprite in the ISM receives a MouseEvent.MOUSE_RELEASE event

Dispatched when a container in the ISM receives a MouseEvent.MOUSE_RELEASE event

mouseReleaseOutsideevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE

Dispatched when the main container of the ISM is clicked

Dispatched when the main container of the ISM is clicked

objectAddedevent  
Event object type: org.papervision3d.events.InteractiveScene3DEvent
InteractiveScene3DEvent.type property = org.papervision3d.events.InteractiveScene3DEvent.OBJECT_ADDED

Dispatched when an InteractiveSprite is created in the ISM for drawing and mouse interaction purposes

Dispatched when a container is created in the ISM for drawing and mouse interaction purposes