Tue 10 Oct 2006 10:47:26 AM UTC, comment #2:
I had a stab at this, but am stuck now. I added this to Color.h:
as_object *target;
And this to color_new() in Color.cpp:
/* The first argument is the object to which we want to apply the
color operations. */
color_obj->obj.target = (as_object*) fn.arg(0).to_object();
I also implemented color_setrgb() like this:
void color_setrgb(const fn_call& fn)
{
color_as_object* color = (color_as_object) (as_object) fn.this_ptr;
/* The first argument is the color in RGB format that we want to
set for the object. */
uint32 arg = (uint32) fn.arg(0).to_number();
rgba color_val ((arg >> 16) & 0xff, (arg >> 8) & 0xff, arg & 0xff, 0xff);
/* FIXME: Check to_movie() result for NULL. */
color->obj.target->to_movie()->set_background_color (color_val);
}
This seems to work, in the sense that the code is correctly executed. But there is no visible color change. I have two doubts about this: First, is this semantically even correct? Ie, is it the background color of the enclosing movie clip that setrgb is supposed to change? And second, is setting the background color of a movie clip at run time currently supported?
At least this exercise made me familiar with how arguments are passed to action script object methods. :)
|