[Swfdec] problems to lookup AS object properties using SWFDEC API functions
Bernd Kischnick
kisch at ki.sch-co.de
Wed Jul 8 15:31:32 PDT 2009
Hello list,
I'm scratching my head over mysterious difficulties with variable lookup
on Swfdec AS-objects inside the library. Neither
swfdec_as_object_has_variable() nor swfdec_as_object_get_variable() nor
swfdec_as_object_get_variable_and_flags() are able to find a property
which definitely exists.
In ActionScript, I'm doing this:
var o = new Object ();
o.foo = "bar";
o.observeValueForKeyPath = function () {...}
I can enumerate this object from Actionscript:
for (p in o) { trace("o["+p+"] = "+ o[p]); }
and Swfdec reliably produces the correct trace output:
o[foo] = bar
o[observeValueForKeyPath]=[type Function]
I can repeat this inside the library, given the pointer to the AS object:
gboolean my_foreach (SwfdecAsObject *object,
const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
{
const char* val = swfdec_as_value_to_string (data, value);
SWFDEC_ERROR("object @%p [%s] = @%p ('%s')", object, variable, value, val);
return TRUE;
}
/* SwfdecAsContext *cx, SwfdecAsObject *object */
swfdec_as_object_foreach (object, my_foreach, cx);
This way the properties 'foo' and 'observeValueForKeyPath' are found,
additionally '__proto__' and '__constructor__'.
But when I try to look up 'foo' or 'observeValueForKeyPath' using
swfdec_as_object_has_variable(),
swfdec_as_object_get_variable(), or
swfdec_as_object_get_variable_and_flags()
with parameter 'variable' set to the property name, neither of them succeeds.
What am I doing wrong???
confused,
- kisch
More information about the Swfdec
mailing list