gnash::as_object Class Reference

A generic bag of attributes. Base class for all ActionScript-able objects. More...

#include <as_object.h>

Inheritance diagram for gnash::as_object:

gnash::ref_counted gnash::as_array_object gnash::as_function gnash::character gnash::Fileio gnash::Global gnash::GtkExt gnash::key_as_object gnash::LocalConnection gnash::math_as_object gnash::NetConnection gnash::NetStream gnash::shm_as_object gnash::Sound gnash::Stage gnash::system_as_object gnash::textformat_as_object gnash::xmlattr_as_object gnash::XMLNode

List of all members.

Public Member Functions

VMgetVM () const
 Return a reference to the Virtual Machine that created this object.
void dump_members ()
 Dump all properties using log_debug.
void dump_members (std::map< std::string, as_value > &to)
 Dump all properties into the given map.
 as_object ()
 Construct an ActionScript object with no prototype associated.
 as_object (as_object *proto)
 Construct an ActionScript object based on the given prototype. Adds a reference to the prototype, if any.
 as_object (boost::intrusive_ptr< as_object > proto)
 Construct an ActionScript object based on the given prototype.
 as_object (const as_object &other)
 Copy an as_object.
virtual std::string get_text_value () const
 Return a text representation for this object.
virtual bool useCustomToString () const
virtual double get_numeric_value () const
 Return the numeric value of this object.
virtual as_value get_primitive_value () const
 Return the "primitive" value of this object.
virtual void set_member (string_table::key key, const as_value &val, string_table::key nsname=0)
 Set a member value.
std::pair< bool, boolupdate_member (string_table::key key, const as_value &val, string_table::key nsname=0)
 Update an existing member value.
virtual bool on_event (const event_id &id)
void reserveSlot (string_table::key name, string_table::key nsId, unsigned short slotId)
void init_member (const std::string &name, const as_value &val, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum, string_table::key nsname=0)
 Initialize a member value by string.
void init_member (string_table::key key, const as_value &val, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum, string_table::key nsname=0, int slotId=-1)
 Initialize a member value by key.
void init_property (const std::string &key, as_function &getter, as_function &setter, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum, string_table::key nsname=0)
 Initialize a getter/setter property by name.
void init_property (string_table::key key, as_function &getter, as_function &setter, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum, string_table::key nsname=0)
 Initialize a getter/setter property by key.
bool init_destructive_property (string_table::key key, as_function &getter, as_function &setter, int flags=as_prop_flags::dontEnum, string_table::key nsname=0)
 Initialize a destructive getter/setter property.
void init_readonly_property (const std::string &key, as_function &getter, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum, string_table::key nsname=0)
 Use this method for read-only properties.
virtual bool get_member (string_table::key name, as_value *val, string_table::key nsname=0)
 Get a member as_value by name.
virtual as_objectget_path_element (string_table::key key)
 Resolve the given relative path component.
bool isQName () const
 Chad: Document.
bool isXML () const
bool isDictionary () const
as_objectget_super ()
as_functionget_constructor ()
as_value getMember (string_table::key name, string_table::key nsname=0)
 Get a member as_value by name in an AS-compatible way.
as_value callMethod (string_table::key name)
 Call a method of this object in an AS-compatible way.
as_value callMethod (string_table::key name, const as_value &arg0)
as_value callMethod (string_table::key name, const as_value &arg0, const as_value &arg1)
as_value callMethod (string_table::key name, const as_value &arg0, const as_value &arg1, const as_value &arg2)
as_value callMethod (string_table::key name, const as_value &arg0, const as_value &arg1, const as_value &arg2, const as_value &arg3)
std::pair< bool, booldelProperty (string_table::key name, string_table::key nsname=0)
 Delete a property of this object, unless protected from deletion.
PropertygetOwnProperty (string_table::key name, string_table::key nsname=0)
 Get this object's own named property, if existing.
PropertygetByIndex (int index)
int nextIndex (int index, as_object **owner=NULL)
bool set_member_flags (string_table::key name, int setTrue, int setFalse=0, string_table::key nsname=0)
 Set member flags (probably used by ASSetPropFlags).
virtual sprite_instanceto_movie ()
 Cast to a sprite, or return NULL.
const sprite_instanceto_movie () const
virtual as_functionto_function ()
 Cast to a as_function, or return NULL.
virtual characterto_character ()
 Cast to a character, or return NULL.
const characterto_character () const
virtual bool isDateObject ()
 Return true if this is a Date object.
void add_interface (as_object *ctor)
bool instanceOf (as_function *ctor)
 Check whether this object is an instance of the given as_function constructor.
bool prototypeOf (as_object &instance)
 Check whether this object is a 'prototype' in the given object's inheritance chain.
void setPropFlags (as_value &props, int set_false, int set_true)
 Set property flags.
void copyProperties (const as_object &o)
 Copy properties from the given object.
void clearProperties ()
 Drop all properties from this object.
void enumerateProperties (as_environment &env) const
 Enumerate all non-hidden properties pushing their value to the given as_environment.
virtual void enumerateNonProperties (as_environment &) const
 Enumerate any non-proper properties.
void enumerateProperties (std::map< std::string, std::string > &to)
 Enumerate all non-hidden properties inserting their name/value pair to the given map.
void getURLEncodedVars (std::string &data)
 Get url-encoded variables.
template<class V>
void visitPropertyValues (V &visitor) const
 Visit the properties of this object by key/as_value pairs.
bool add_property (const std::string &key, as_function &getter, as_function &setter)
 Add a getter/setter property, if no member already has that name (or should we allow override ? TODO: check this).
boost::intrusive_ptr< as_objectget_prototype ()
 Return this object '__proto__' member.
const boost::intrusive_ptr
< as_object
get_prototype () const
void set_prototype (boost::intrusive_ptr< as_object > proto, int flags=as_prop_flags::dontDelete|as_prop_flags::dontEnum)
 Set this object's '__proto__' member.
std::string asPropName (string_table::key name)

Static Public Member Functions

static as_value tostring_method (const fn_call &fn)
static as_value valueof_method (const fn_call &fn)

Protected Member Functions

bool get_member_default (string_table::key name, as_value *val, string_table::key nsname)
 Get a property value by name.
void set_member_default (string_table::key name, const as_value &val, string_table::key nsname)
 Set a member value.

Protected Attributes

VM_vm
 The Virtual Machine used to create this object.

Friends

class asClass
class Machine


Detailed Description

A generic bag of attributes. Base class for all ActionScript-able objects.

Base-class for ActionScript script-defined objects. This would likely be ActionScript's 'Object' class.


Constructor & Destructor Documentation

gnash::as_object::as_object (  ) 

Construct an ActionScript object with no prototype associated.

gnash::as_object::as_object ( as_object proto  ) 

Construct an ActionScript object based on the given prototype. Adds a reference to the prototype, if any.

gnash::as_object::as_object ( boost::intrusive_ptr< as_object proto  ) 

Construct an ActionScript object based on the given prototype.

gnash::as_object::as_object ( const as_object other  ) 

Copy an as_object.

TODO: write more about this, is it allowed ? is it safe ?


Member Function Documentation

VM& gnash::as_object::getVM (  )  const [inline]

Return a reference to the Virtual Machine that created this object.

void gnash::as_object::dump_members (  ) 

Dump all properties using log_debug.

Note that this method is non-const as some properties might be getter/setter ones, thus simple read of them might execute user code actually changing the object itsef.

void gnash::as_object::dump_members ( std::map< std::string, as_value > &  to  ) 

Dump all properties into the given map.

Note that this method is non-const as some properties might be getter/setter ones, thus simple read of them might execute user code actually changing the object itsef.

virtual std::string gnash::as_object::get_text_value (  )  const [inline, virtual]

Return a text representation for this object.

Reimplemented in gnash::as_array_object, gnash::as_function, and gnash::edit_text_character.

virtual bool gnash::as_object::useCustomToString (  )  const [inline, virtual]

Return true if instances of this ActionScript class should use a custom toString method, when available, for converting the object to a string.

virtual double gnash::as_object::get_numeric_value (  )  const [inline, virtual]

Return the numeric value of this object.

The default implementation converts the text value to a number, override for a more performant implementation

virtual as_value gnash::as_object::get_primitive_value (  )  const [inline, virtual]

Return the "primitive" value of this object.

The default implementation returns an Object value, other objects can override this function to provide another "preferred" primitive. Primitive values are: undefined, null, boolean, string, number, object.

See ECMA-2.6.2 (section 4.3.2).

virtual void gnash::as_object::set_member ( string_table::key  key,
const as_value val,
string_table::key  nsname = 0 
) [inline, virtual]

Set a member value.

The default behaviour is to call set_member_default, but this function is kept virtual to allow special handling of property assignment in derivate class. NOTE: This might change in the near future trough use of getter/setter properties instead..

Parameters:
key Id of the property.
val Value to assign to the named property.
nsname Id of the namespace.

Reimplemented in gnash::as_array_object, gnash::XML, gnash::edit_text_character, and gnash::sprite_instance.

std::pair< bool, bool > gnash::as_object::update_member ( string_table::key  key,
const as_value val,
string_table::key  nsname = 0 
)

Update an existing member value.

NOTE that getter-setter in the inheritance chaing are considered as existing members. See with.as and Object.as testcases under actionscript.all. Also be aware that 'special' (non-proper) properties are considered non-existing, this is surely true for childs of MovieClips, also tested in with.as.

Parameters:
key Id of the property.
val Value to assign to the named property.
nsname Id of the namespace.
Returns:
a pair in which first element express wheter the property01apl0mb was found and the second wheter it was set (won't set if read-only).

bool gnash::as_object::on_event ( const event_id id  )  [virtual]

Reimplemented in gnash::button_character_instance, gnash::character, gnash::edit_text_character, and gnash::sprite_instance.

void gnash::as_object::reserveSlot ( string_table::key  name,
string_table::key  nsId,
unsigned short  slotId 
)

Reserve a slot

Reserves a slot for a property to follow.

void gnash::as_object::init_member ( const std::string &  name,
const as_value val,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum,
string_table::key  nsname = 0 
)

Initialize a member value by string.

This is just a wrapper around the other init_member method used as a trampoline to avoid changing all classes to use string_table::key directly.

Parameters:
name Name of the member. Will be converted to lowercase if VM is initialized for SWF6 or lower.
val Value to assign to the member.
flags Flags for the new member. By default dontDelete and dontEnum. See as_prop_flags::Flags.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.

void gnash::as_object::init_member ( string_table::key  key,
const as_value val,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum,
string_table::key  nsname = 0,
int  slotId = -1 
)

Initialize a member value by key.

This method has to be used by built-in classes initialization (VM initialization in general) as will avoid to scan the inheritance chain.

By default, members initialized by calling this function will be protected from deletion and not shown in enumeration. These flags can be explicitly set using the third argument.

Parameters:
key Member key.
val Value to assign to the member.
flags Flags for the new member. By default dontDelete and dontEnum. See as_prop_flags::Flags.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
slotId If this is a non-negative value which will fit in an unsigned short, this is used as the slotId and can be subsequently found with get_slot

void gnash::as_object::init_property ( const std::string &  key,
as_function getter,
as_function setter,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum,
string_table::key  nsname = 0 
)

Initialize a getter/setter property by name.

This is just a wrapper around the other init_property method used as a trampoline to avoid changing all classes to use string_table::key directly.

Parameters:
key Name of the property. Will be converted to lowercase if VM is initialized for SWF6 or lower.
getter A function to invoke when this property value is requested. add_ref will be called on the function.
setter A function to invoke when setting this property's value. add_ref will be called on the function.
flags Flags for the new member. By default dontDelete and dontEnum. See as_prop_flags::Flags.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.

void gnash::as_object::init_property ( string_table::key  key,
as_function getter,
as_function setter,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum,
string_table::key  nsname = 0 
)

Initialize a getter/setter property by key.

This method has to be used by built-in classes initialization (VM initialization in general) as will avoid to scan the inheritance chain.

Parameters:
key Key of the property.
getter A function to invoke when this property value is requested. add_ref will be called on the function.
setter A function to invoke when setting this property's value. add_ref will be called on the function.
flags Flags for the new member. By default dontDelete and dontEnum. See as_prop_flags::Flags.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.

bool gnash::as_object::init_destructive_property ( string_table::key  key,
as_function getter,
as_function setter,
int  flags = as_prop_flags::dontEnum,
string_table::key  nsname = 0 
)

Initialize a destructive getter/setter property.

A destructive getter/setter can be used as a place holder for the real value of a property. As soon as getValue is invoked on the getter, it destroys itself after setting its property to the return value of getValue.

Parameters:
key Name of the property. Will be converted to lowercase if VM is initialized for SWF6 or lower.
getter A function to invoke when this property value is requested. add_ref will be called on the function.
setter A function to invoke when setting this property's value. add_ref will be called on the function.
flags Flags for the new member. By default dontDelete and dontEnum. See as_prop_flags::Flags.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.

void gnash::as_object::init_readonly_property ( const std::string &  key,
as_function getter,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum,
string_table::key  nsname = 0 
)

Use this method for read-only properties.

This method achieves the same as the above init_property method. Additionally, it sets the property as read-only so that a default handler will be triggered when ActionScript attempts to set the property.

The arguments are the same as the above init_property arguments, although the setter argument is omitted.

Parameters:
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.

virtual bool gnash::as_object::get_member ( string_table::key  name,
as_value val,
string_table::key  nsname = 0 
) [inline, virtual]

Get a member as_value by name.

The default behaviour is to call set_member_default, but this function is kept virtual to allow special handling of property fetching in derivate class.

NOTE that this method is non-const becase a property could also be a getter/setter and we can't promise that the 'getter' won't change this object trough use of the 'this' reference.

Parameters:
name Name of the property. Must be all lowercase if the current VM is initialized for a target up to SWF6.
val Variable to assign an existing value to. Will be untouched if no property with the given name was found.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
Returns:
true of the named property was found, false otherwise.

Reimplemented in gnash::as_array_object, gnash::XML, gnash::button_character_instance, gnash::edit_text_character, and gnash::sprite_instance.

as_object * gnash::as_object::get_path_element ( string_table::key  key  )  [virtual]

Resolve the given relative path component.

Path components are only objects, if the given string points to a non-object member, NULL is returned.

Main use if for getvariable and settarget resolution, currently implemented in as_environment.

Reimplemented in gnash::button_character_instance, gnash::character, and gnash::sprite_instance.

bool gnash::as_object::isQName (  )  const [inline]

Chad: Document.

bool gnash::as_object::isXML (  )  const [inline]

bool gnash::as_object::isDictionary (  )  const [inline]

as_object * gnash::as_object::get_super (  ) 

Get the super object of this object.

The super should be __proto__ if this is a prototype object itself, or __proto__.__proto__ if this is not a prototype object. This is only conceptual however, and may be more convoluted to obtain the actual super.

as_function * gnash::as_object::get_constructor (  ) 

Get the constructor for this object.

This is the AS constructor for this object. When invoked, it should initialize the object passed as 'this'

as_value gnash::as_object::getMember ( string_table::key  name,
string_table::key  nsname = 0 
)

Get a member as_value by name in an AS-compatible way.

NOTE that this method is non-const becase a property could also be a getter/setter and we can't promise that the 'getter' won't change this object trough use of the 'this' reference.

Parameters:
name Name of the property. Will be converted to lowercase if the current VM is initialized for a target up to SWF6.
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
Returns:
value of the member (possibly undefined), or undefined if not found. Use get_member if you need to know wheter it was found or not.

as_value gnash::as_object::callMethod ( string_table::key  name  ) 

Call a method of this object in an AS-compatible way.

Parameters:
name Name of the method. Will be converted to lowercase if the current VM is initialized for a target up to SWF6.
env The environment to use for setting up call frame stack
nargs Number of arguments
... nargs as_value references
Returns:
value of the member (possibly undefined), or undefined if not found. Use get_member if you need to know wheter it was found or not.

as_value gnash::as_object::callMethod ( string_table::key  name,
const as_value arg0 
)

as_value gnash::as_object::callMethod ( string_table::key  name,
const as_value arg0,
const as_value arg1 
)

as_value gnash::as_object::callMethod ( string_table::key  name,
const as_value arg0,
const as_value arg1,
const as_value arg2 
)

as_value gnash::as_object::callMethod ( string_table::key  name,
const as_value arg0,
const as_value arg1,
const as_value arg2,
const as_value arg3 
)

std::pair< bool, bool > gnash::as_object::delProperty ( string_table::key  name,
string_table::key  nsname = 0 
)

Delete a property of this object, unless protected from deletion.

This function does *not* recurse in this object's prototype.

name Name of the property. Case insensitive up to SWF6, case *sensitive* from SWF7 up.

Parameters:
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
Returns:
a pair of boolean values expressing whether the property was found (first) and whether it was deleted (second). Of course a pair(false, true) would be invalid (deleted a non-found property!?). Valid returns are:
  • (false, false) : property not found
  • (true, false) : property protected from deletion
  • (true, true) : property successfully deleted

Property * gnash::as_object::getOwnProperty ( string_table::key  name,
string_table::key  nsname = 0 
)

Get this object's own named property, if existing.

This function does *not* recurse in this object's prototype.

name Name of the property. Case insensitive up to SWF6, case *sensitive* from SWF7 up.

Parameters:
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
Returns:
a Property pointer, or NULL if this object doesn't contain the named property.

Property * gnash::as_object::getByIndex ( int  index  ) 

Get a property from this object (or a prototype) by ordering index.

Parameters:
index An index returned by nextIndex
Returns:
The property associated with the order index.

int gnash::as_object::nextIndex ( int  index,
as_object **  owner = NULL 
)

Get the next index after the one whose index was used as a parameter.

Parameters:
index 0 is a starter index -- use it to get the first index. Using the return value in subsequent calls will walk through all enumerable properties in the list.
owner If owner is not NULL, it will be set to the exact object to which the property used for the value of index belongs, if such a property exists, and left untouched otherwise.
Returns:
A value which can be fed to getByIndex, or 0 if there are no more.

bool gnash::as_object::set_member_flags ( string_table::key  name,
int  setTrue,
int  setFalse = 0,
string_table::key  nsname = 0 
)

Set member flags (probably used by ASSetPropFlags).

Parameters:
name Name of the property. Must be all lowercase if the current VM is initialized for a target up to SWF6.
setTrue the set of flags to set
setFalse the set of flags to clear
nsname The id of the namespace to which this member belongs. 0 is a wildcard and will be matched by anything not asking for a specific namespace.
Returns:
true on success, false on failure (non-existent or protected member)

virtual sprite_instance* gnash::as_object::to_movie (  )  [inline, virtual]

Cast to a sprite, or return NULL.

Reimplemented in gnash::sprite_instance.

const sprite_instance* gnash::as_object::to_movie (  )  const [inline]

virtual as_function* gnash::as_object::to_function (  )  [inline, virtual]

Cast to a as_function, or return NULL.

Reimplemented in gnash::as_function.

virtual character* gnash::as_object::to_character (  )  [inline, virtual]

Cast to a character, or return NULL.

Reimplemented in gnash::character.

const character* gnash::as_object::to_character (  )  const [inline]

virtual bool gnash::as_object::isDateObject (  )  [inline, virtual]

Return true if this is a Date object.

This is needed for special handling of Date objects by the as_value::to_primitive method, also described in ECMA-262 "8.6.2.6 [[DefaultValue]] (hint)"

void gnash::as_object::add_interface ( as_object ctor  ) 

Add an interface to the list of interfaces. Used by instanceOf

bool gnash::as_object::instanceOf ( as_function ctor  ) 

Check whether this object is an instance of the given as_function constructor.

NOTE: built-in classes should NOT be C_FUNCTIONS for this to work

bool gnash::as_object::prototypeOf ( as_object instance  ) 

Check whether this object is a 'prototype' in the given object's inheritance chain.

void gnash::as_object::setPropFlags ( as_value props,
int  set_false,
int  set_true 
)

Set property flags.

Parameters:
props A comma-delimited list of property names as a string, a NULL value, or an array? (need to check/test, probably somehting is broken). Property strings are case insensitive up to SWF6, case *sensitive* from SWF7 up.
set_false 
set_true 

void gnash::as_object::copyProperties ( const as_object o  ) 

Copy properties from the given object.

NOTE: the __proto__ member will NOT be copied.

void gnash::as_object::clearProperties (  )  [inline]

Drop all properties from this object.

void gnash::as_object::enumerateProperties ( as_environment env  )  const

Enumerate all non-hidden properties pushing their value to the given as_environment.

The enumeration recurse in prototype. This implementation will keep track of visited object to avoid loops in prototype chain. NOTE: the MM player just chokes in this case (loop)

virtual void gnash::as_object::enumerateNonProperties ( as_environment  )  const [inline, virtual]

Enumerate any non-proper properties.

This function is called by enumerateProperties(as_environment&) to allow for enumeration of properties that are not "proper" (not contained in the as_object PropertyList).

The default implementation adds nothing

Reimplemented in gnash::as_array_object, and gnash::sprite_instance.

void gnash::as_object::enumerateProperties ( std::map< std::string, std::string > &  to  ) 

Enumerate all non-hidden properties inserting their name/value pair to the given map.

The enumeration recurse in prototype. This implementation will keep track of visited object to avoid loops in prototype chain. NOTE: the MM player just chokes in this case (loop)

void gnash::as_object::getURLEncodedVars ( std::string &  data  ) 

Get url-encoded variables.

This method will be used for loadVariables and loadMovie calls, to encode variables for sending over a network. Variables starting with a dollar sign will be skipped, as non-enumerable ones.

Parameters:
data Output parameter, will be set to the url-encoded variables string, w/out any leading delimiter.

template<class V>
void gnash::as_object::visitPropertyValues ( V &  visitor  )  const [inline]

Visit the properties of this object by key/as_value pairs.

The method will invoke the given visitor method passing it two arguments: key of the property and value of it.

Parameters:
visitor The visitor function. Will be invoked for each property of this object with a string_table::key reference as first argument and a const as_value reference as second argument.

bool gnash::as_object::add_property ( const std::string &  key,
as_function getter,
as_function setter 
)

Add a getter/setter property, if no member already has that name (or should we allow override ? TODO: check this).

Parameters:
key Name of the property. Case insensitive up to SWF6, case *sensitive* from SWF7 up.
getter A function to invoke when this property value is requested. add_ref will be called on the function.
setter A function to invoke when setting this property's value. add_ref will be called on the function.
Returns:
true if the property was successfully added, false otherwise (property already existent?)

boost::intrusive_ptr< as_object > gnash::as_object::get_prototype (  ) 

Return this object '__proto__' member.

The __proto__ member is the exported interface ('prototype') of the class this object is an instance of.

NOTE: can return NULL (and it is expected to do for Object.prototype)

const boost::intrusive_ptr<as_object> gnash::as_object::get_prototype (  )  const [inline]

void gnash::as_object::set_prototype ( boost::intrusive_ptr< as_object proto,
int  flags = as_prop_flags::dontDelete|as_prop_flags::dontEnum 
)

Set this object's '__proto__' member.

There is no point to make this function protected or private, as a call to the public: set_member("__proto__", <anyting>) will do just the same

std::string gnash::as_object::asPropName ( string_table::key  name  )