| Package | widgetfactory.communication |
| Class | public class BaseRoomProxy |
| Inheritance | BaseRoomProxy Object |
| Implements | IRoom |
| Subclasses | BaseSlideRoomProxy |
Like this, you can't do this:
var room:BaseRoom = WidgetRooms.joinRoom("nameOfRoom", widgetSlide, memberObject, "Steve", BaseRoom);
If there is only one instance of the widget on stage then this code won't cause an error,
because that one widget isn't sharing classes with anyone. However, when another widget tries to joining the room
and assign the room object to the BaseRoom class, then Captivate will view that as an error.
It would be like trying to assign a Sprite object to a Number variable.
The easiest way to get around this is to not give the 'room' variable any type. However this will break the strong typing of the application and is not best practise.
By using a proxy object, you can keep the strong typing between widgets and room objects.
Both BaseRoom and BaseRoomProxy implement the IRoom interface,
this ensures that they have the same methods and properties. Here's how you can set up a BaseRoomProxy
var unTypedRoom = WidgetRooms.joinRoom("nameOfRoom", widgetSlide, memberObject, "Steve", BaseRoom);
var room:BaseRoomProxy = new BaseRoomProxy(unTypedRoom);
For the rest of the program, use the BaseRoomProxy object held in the 'room' variable to
interact with the room.
There is also a BaseSlideRoomProxy class to use with BaseSlideRoom objects.
If you have created your own custom room by extending either of the base room classes, then you can also extend the appropriate proxy class to create your own strongly typed proxy for your custom room.
| Property | Defined By | ||
|---|---|---|---|
| isRoom : Boolean [read-only]
A property that WidgetRooms looks for when it is trying to locate a room object. | BaseRoomProxy | ||
| location : MovieClip [read-only]
The location where the room has been created. | BaseRoomProxy | ||
| name : String [read-only]
The name given to the room when it was created. | BaseRoomProxy | ||
| numMembers : int [read-only]
The number of members that are registered with the room. | BaseRoomProxy | ||
| room : Object
The loosely typed room object. | BaseRoomProxy | ||
| Method | Defined By | ||
|---|---|---|---|
BaseRoomProxy(room:Object)
Creates a new instance of the BaseRoomProxy class. | BaseRoomProxy | ||
deregister(member:Object):void
Removes a member from the member list so that it can no longer be found with getMemberByName or getMembersByRole. | BaseRoomProxy | ||
getMemberByName(memberName:String, role:String):Object
Returns the member object that matches the name and role that are passed in. | BaseRoomProxy | ||
getMemberRole(member:Object):String
Takes the member object and finds what role it belongs it. | BaseRoomProxy | ||
getMembersByRole(role:String):Array
Returns a list of all members that belong to a particular role. | BaseRoomProxy | ||
register(member:Object, memberName:String, role:String):void
Registers a member with the room's member list. | BaseRoomProxy | ||
| isRoom | property |
isRoom:Boolean [read-only]
A property that WidgetRooms looks for when it is trying to locate a room object.
public function get isRoom():Boolean| location | property |
location:MovieClip [read-only] The location where the room has been created. Normally this would be the Captivate Main Timeline (cpVariables). However, for Slide Rooms this should be the slide the room is attached to.
public function get location():MovieClip| name | property |
name:String [read-only] The name given to the room when it was created.
public function get name():String| numMembers | property |
numMembers:int [read-only] The number of members that are registered with the room.
public function get numMembers():int| room | property |
room:ObjectThe loosely typed room object.
public function get room():Object public function set room(value:Object):void| BaseRoomProxy | () | Constructor |
public function BaseRoomProxy(room:Object)
Creates a new instance of the BaseRoomProxy class.
room:Object — The loosely typed room object that we are creating a proxy for.
|
| deregister | () | method |
public function deregister(member:Object):void
Removes a member from the member list so that it can no longer be found with getMemberByName or getMembersByRole.
This does not guarantee that the member will lose all references to the room, or that it will no longer be able to make changes.
Parameters
member:Object — The member object that you wish to remove from the member list.
|
| getMemberByName | () | method |
public function getMemberByName(memberName:String, role:String):ObjectReturns the member object that matches the name and role that are passed in.
Parameters
memberName:String — The name of the member
| |
role:String — The role that the member has (Will default to the common role)
|
Object — The member object
|
| getMemberRole | () | method |
public function getMemberRole(member:Object):StringTakes the member object and finds what role it belongs it.
Parameters
member:Object — The member object.
|
String — The role the member belongs to.
|
| getMembersByRole | () | method |
public function getMembersByRole(role:String):ArrayReturns a list of all members that belong to a particular role. By default, it will return a list of all members under the Common Role.
Parameters
role:String — The role that you wish to create the list from.
|
Array — An array of all members that belong to that role.
|
| register | () | method |
public function register(member:Object, memberName:String, role:String):voidRegisters a member with the room's member list. The member is categorized by its name and role. If no role is provided, it is categorized under the default common role.
Parameters
member:Object — The literal member object
| |
memberName:String — The name that identifies the member object
| |
role:String — The role that the member object will be categorized under
|