[Swfdec-commits] 4 commits - swfdec/swfdec_actor.c swfdec/swfdec_as_frame.c swfdec/swfdec_as_internal.h swfdec/swfdec_as_interpret.c swfdec/swfdec_as_object.c swfdec/swfdec_as_string.c swfdec/swfdec_bitmap_data.c swfdec/swfdec_event.c swfdec/swfdec_event.h swfdec/swfdec_movie.c swfdec/swfdec_movie.h swfdec/swfdec_player.c swfdec/swfdec_resource.c swfdec/swfdec_selection.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_sprite_movie.h swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_video_movie.c swfdec/swfdec_xml_socket.c

Benjamin Otte company at kemper.freedesktop.org
Wed Nov 5 04:44:22 PST 2008


 swfdec/swfdec_actor.c               |   24 +++++----
 swfdec/swfdec_as_frame.c            |   30 +++++++----
 swfdec/swfdec_as_internal.h         |    6 +-
 swfdec/swfdec_as_interpret.c        |   91 ++++++++++++++++++++----------------
 swfdec/swfdec_as_object.c           |   10 +--
 swfdec/swfdec_as_string.c           |    4 -
 swfdec/swfdec_bitmap_data.c         |   13 +++--
 swfdec/swfdec_event.c               |    3 -
 swfdec/swfdec_event.h               |    1 
 swfdec/swfdec_movie.c               |   43 +++++++++--------
 swfdec/swfdec_movie.h               |   12 ++--
 swfdec/swfdec_player.c              |   16 +++---
 swfdec/swfdec_resource.c            |   10 ++-
 swfdec/swfdec_selection.c           |    4 -
 swfdec/swfdec_sprite_movie.c        |   56 +---------------------
 swfdec/swfdec_sprite_movie.h        |    1 
 swfdec/swfdec_sprite_movie_as.c     |   45 +++++++----------
 swfdec/swfdec_text_field_movie.c    |   49 +++++++++----------
 swfdec/swfdec_text_field_movie_as.c |   13 ++---
 swfdec/swfdec_video_movie.c         |    2 
 swfdec/swfdec_xml_socket.c          |    2 
 21 files changed, 209 insertions(+), 226 deletions(-)

New commits:
commit 8b4b26a96941e171d524eb664073adf77f0995de
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 13:43:53 2008 +0100

    make SwfdecMovie a relay

diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index a35b7bf..cafaa7c 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -68,7 +68,7 @@ swfdec_actor_mouse_events (SwfdecActor *actor)
   if (actor->events && swfdec_event_list_has_mouse_events (actor->events))
     return TRUE;
   /* otherwise, require at least one of the custom script handlers */
-  object = SWFDEC_AS_OBJECT (actor);
+  object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (actor));
   if (swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOver) ||
       swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOut) ||
       swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onDragOver) ||
@@ -190,6 +190,7 @@ swfdec_sprite_movie_set_constructor (SwfdecSpriteMovie *movie)
   SwfdecMovie *mov = SWFDEC_MOVIE (movie);
   SwfdecAsContext *context = swfdec_gc_object_get_context (movie);
   SwfdecAsObject *constructor = NULL;
+  SwfdecAsObject *object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
 
   g_assert (mov->resource != NULL);
 
@@ -206,12 +207,12 @@ swfdec_sprite_movie_set_constructor (SwfdecSpriteMovie *movie)
   }
   if (constructor == NULL) {
     swfdec_sandbox_use (SWFDEC_MOVIE (movie)->resource->sandbox);
-    swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie), 
+    swfdec_as_object_set_constructor_by_name (object,
 	SWFDEC_AS_STR_MovieClip, NULL);
     swfdec_sandbox_unuse (SWFDEC_MOVIE (movie)->resource->sandbox);
     return FALSE;
   } else {
-    swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), constructor);
+    swfdec_as_object_set_constructor (object, constructor);
     return TRUE;
   }
 }
@@ -220,7 +221,7 @@ void
 swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
     guint8 key)
 {
-  SwfdecAsObject *thisp;
+  SwfdecMovie *thisp;
   const char *name;
   guint version;
   gboolean need_constructor = FALSE;
@@ -233,14 +234,14 @@ swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
     /* these conditions don't exist for buttons */
     if (condition == SWFDEC_EVENT_CONSTRUCT || condition < SWFDEC_EVENT_PRESS)
       return;
-    thisp = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (actor)->parent);
+    thisp = SWFDEC_MOVIE (actor)->parent;
     if (version <= 5) {
       while (!SWFDEC_IS_SPRITE_MOVIE (thisp))
-	thisp = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (thisp)->parent);
+	thisp = SWFDEC_MOVIE (thisp)->parent;
     }
     g_assert (thisp);
   } else {
-    thisp = SWFDEC_AS_OBJECT (actor);
+    thisp = SWFDEC_MOVIE (actor);
   }
 
   /* special cases */
@@ -261,7 +262,7 @@ swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
       SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onChanged);
     SWFDEC_AS_VALUE_SET_MOVIE (&argv[1], movie);
     swfdec_sandbox_use (movie->resource->sandbox);
-    swfdec_as_object_call (SWFDEC_AS_OBJECT (actor),
+    swfdec_as_relay_call (SWFDEC_AS_RELAY (actor),
 	SWFDEC_AS_STR_broadcastMessage, 2, argv, NULL);
     swfdec_sandbox_unuse (movie->resource->sandbox);
     return;
@@ -269,16 +270,17 @@ swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
 
   swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
   if (actor->events) {
-    swfdec_event_list_execute (actor->events, thisp, condition, key);
+    swfdec_event_list_execute (actor->events, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (thisp)),
+	condition, key);
   }
   /* FIXME: how do we compute the version correctly here? */
   if (version > 5) {
     name = swfdec_event_type_get_name (condition);
     if (name != NULL) {
-      swfdec_as_object_call (SWFDEC_AS_OBJECT (actor), name, 0, NULL, NULL);
+      swfdec_as_relay_call (SWFDEC_AS_RELAY (actor), name, 0, NULL, NULL);
     }
     if (condition == SWFDEC_EVENT_CONSTRUCT && need_constructor)
-      swfdec_as_object_call (thisp, SWFDEC_AS_STR_constructor, 0, NULL, NULL);
+      swfdec_as_relay_call (SWFDEC_AS_RELAY (thisp), SWFDEC_AS_STR_constructor, 0, NULL, NULL);
   }
   swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
 }
diff --git a/swfdec/swfdec_as_frame.c b/swfdec/swfdec_as_frame.c
index 50ef083..84b3dec 100644
--- a/swfdec/swfdec_as_frame.c
+++ b/swfdec/swfdec_as_frame.c
@@ -368,7 +368,7 @@ SwfdecAsObject *
 swfdec_as_frame_get_variable_and_flags (SwfdecAsContext *cx, SwfdecAsFrame *frame, 
     const char *variable, SwfdecAsValue *value, guint *flags, SwfdecAsObject **pobject)
 {
-  SwfdecAsObject *object;
+  SwfdecMovie *target;
   GSList *walk;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (cx), NULL);
@@ -382,9 +382,12 @@ swfdec_as_frame_get_variable_and_flags (SwfdecAsContext *cx, SwfdecAsFrame *fram
   }
   /* we've walked the scope chain down. Now look in the special objects. */
   /* 1) the current target */
-  object = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (frame));
-  if (object && swfdec_as_object_get_variable_and_flags (object, variable, value, flags, pobject))
-    return object;
+  target = swfdec_as_frame_get_target (frame);
+  if (target) {
+    SwfdecAsObject *object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (target));
+    if (swfdec_as_object_get_variable_and_flags (object, variable, value, flags, pobject))
+      return object;
+  }
   /* 2) the global object */
   if (cx->version > 4 && swfdec_as_object_get_variable_and_flags (cx->global,
 	variable, value, flags, pobject))
@@ -419,7 +422,11 @@ swfdec_as_frame_set_variable_and_flags (SwfdecAsContext *context, SwfdecAsFrame
     if (frame->activation && (local || !frame->original_target)) {
       set = frame->activation;
     } else {
-      set = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (frame));
+      SwfdecMovie *target = swfdec_as_frame_get_target (frame);
+      if (target)
+	set = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (target));
+      else
+	set = NULL;
     }
     if (set == NULL)
       return;
@@ -438,7 +445,7 @@ swfdec_as_frame_delete_variable (SwfdecAsContext *cx, SwfdecAsFrame *frame, cons
 {
   GSList *walk;
   SwfdecAsDeleteReturn ret;
-  SwfdecAsObject *object;
+  SwfdecMovie *target;
 
   g_return_val_if_fail (frame != NULL, FALSE);
   g_return_val_if_fail (variable != NULL, FALSE);
@@ -450,9 +457,10 @@ swfdec_as_frame_delete_variable (SwfdecAsContext *cx, SwfdecAsFrame *frame, cons
   }
   /* we've walked the scope chain down. Now look in the special objects. */
   /* 1) the target set via SetTarget */
-  object = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (frame));
-  if (object) {
-    ret = swfdec_as_object_delete_variable (object, variable);
+
+  target = swfdec_as_frame_get_target (frame);
+  if (target) {
+    ret = swfdec_as_object_delete_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (target)), variable);
     if (ret)
       return ret;
   }
@@ -644,10 +652,10 @@ SwfdecMovie *
 swfdec_as_frame_get_target (SwfdecAsFrame *frame) 
 {
   if (SWFDEC_IS_MOVIE (frame->target) &&
-      SWFDEC_MOVIE(frame->target)->state < SWFDEC_MOVIE_STATE_DESTROYED)
+      SWFDEC_MOVIE (frame->target)->state < SWFDEC_MOVIE_STATE_DESTROYED)
     return SWFDEC_MOVIE (frame->target);
   if (SWFDEC_IS_MOVIE (frame->original_target) &&
-      SWFDEC_MOVIE(frame->original_target)->state < SWFDEC_MOVIE_STATE_DESTROYED)
+      SWFDEC_MOVIE (frame->original_target)->state < SWFDEC_MOVIE_STATE_DESTROYED)
     return SWFDEC_MOVIE (frame->original_target);
   return NULL;
 }
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 6cf0d7a..323d3bf 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -39,12 +39,14 @@ G_BEGIN_DECLS
 /* swfdec_as_types.h */
 #define SWFDEC_AS_VALUE_IS_COMPOSITE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) >= SWFDEC_AS_TYPE_OBJECT)
 #define SWFDEC_AS_VALUE_IS_PRIMITIVE(val) (!SWFDEC_AS_VALUE_IS_COMPOSITE(val))
+/* FIXME: ugly macro */
 #define SWFDEC_AS_VALUE_GET_COMPOSITE(val) (SWFDEC_AS_VALUE_IS_OBJECT (val) ? \
-    SWFDEC_AS_VALUE_GET_OBJECT (val) : SWFDEC_AS_OBJECT (SWFDEC_AS_VALUE_GET_MOVIE (val)))
+    SWFDEC_AS_VALUE_GET_OBJECT (val) : (SWFDEC_AS_VALUE_GET_MOVIE (val) ? \
+      swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (SWFDEC_AS_VALUE_GET_MOVIE (val))) : NULL))
 #define SWFDEC_AS_VALUE_SET_COMPOSITE(val,o) G_STMT_START { \
   SwfdecAsObject *_o = (o); \
   if (_o->movie) { \
-    SWFDEC_AS_VALUE_SET_MOVIE ((val), SWFDEC_MOVIE (_o)); \
+    SWFDEC_AS_VALUE_SET_MOVIE ((val), SWFDEC_MOVIE (_o->relay)); \
   } else { \
     SWFDEC_AS_VALUE_SET_OBJECT ((val), _o); \
   } \
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 2723b1e..ee80921 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -74,7 +74,7 @@ static void
 swfdec_action_play (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
 {
   SwfdecMovie *target = swfdec_as_frame_get_target (cx->frame);
-  if (SWFDEC_IS_SPRITE_MOVIE (target))
+  if (SWFDEC_IS_SPRITE_MOVIE(target))
     SWFDEC_SPRITE_MOVIE (target)->playing = TRUE;
   else
     SWFDEC_ERROR ("no movie to play");
@@ -412,10 +412,10 @@ super_special_movie_lookup_magic (SwfdecAsContext *cx, SwfdecAsObject *o, const
     if (o == NULL)
       return NULL;
   }
-  if (SWFDEC_IS_MOVIE (o)) {
-    SwfdecMovie *ret = swfdec_movie_get_by_name (SWFDEC_MOVIE (o), name, TRUE);
+  if (o->movie) {
+    SwfdecMovie *ret = swfdec_movie_get_by_name (SWFDEC_MOVIE (o->relay), name, TRUE);
     if (ret)
-      return SWFDEC_AS_OBJECT (ret);
+      return swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ret));
   }
   if (!swfdec_as_object_get_variable (o, name, &val))
     return NULL;
@@ -427,15 +427,17 @@ super_special_movie_lookup_magic (SwfdecAsContext *cx, SwfdecAsObject *o, const
 static SwfdecAsObject *
 swfdec_action_get_movie_by_slash_path (SwfdecAsContext *cx, const char *path)
 {
+  SwfdecMovie *movie;
   SwfdecAsObject *o;
 
-  o = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (cx->frame));
-  if (o == NULL)
+  movie = swfdec_as_frame_get_target (cx->frame);
+  if (movie == NULL)
     return NULL;
   if (*path == '/') {
-    o = SWFDEC_AS_OBJECT (swfdec_movie_get_root (SWFDEC_MOVIE (o)));
+    movie = swfdec_movie_get_root (movie);
     path++;
   }
+  o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
   while (*path) {
     char *slash = strchr (path, '/');
     const char *name;
@@ -449,7 +451,7 @@ swfdec_action_get_movie_by_slash_path (SwfdecAsContext *cx, const char *path)
       path += strlen (path);
     }
     o = super_special_movie_lookup_magic (cx, o, name);
-    if (!SWFDEC_IS_MOVIE (o))
+    if (o == NULL || !o->movie)
       return NULL;
   }
   return o;
@@ -462,20 +464,24 @@ swfdec_action_lookup_object (SwfdecAsContext *cx, SwfdecAsObject *o, const char
   const char *start;
 
   if (path == end) {
-    if (o == NULL)
-      o = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (cx->frame));
-    if (o)
-      return o;
-    else
-      return NULL;
+    if (o == NULL) {
+      SwfdecMovie *movie = swfdec_as_frame_get_target (cx->frame);
+      if (movie)
+	o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
+    }
+    return o;
   }
 
   if (path[0] == '/') {
-    if (o == NULL)
-      o = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (cx->frame));
-    if (!SWFDEC_IS_MOVIE (o))
-      return NULL;
-    o = SWFDEC_AS_OBJECT (swfdec_movie_get_root (SWFDEC_MOVIE (o)));
+    if (o == NULL) {
+      SwfdecMovie *movie = swfdec_as_frame_get_target (cx->frame);
+      if (movie) {
+	movie = swfdec_movie_get_root (movie);
+	o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
+      } else {
+	return NULL;
+      }
+    }
     path++;
     dot_allowed = FALSE;
   }
@@ -504,23 +510,28 @@ swfdec_action_lookup_object (SwfdecAsContext *cx, SwfdecAsObject *o, const char
 
     /* parse variable */
     if (start[0] == '.' && start[1] == '.' && start + 2 == path) {
+      SwfdecMovie *movie;
+      /* ".." goes back to parent */
       if (o == NULL) {
 	GSList *walk;
 	for (walk = cx->frame->scope_chain; walk; walk = walk->next) {
-	  if (SWFDEC_IS_MOVIE (walk->data)) {
-	    o = walk->data;
+	  o = walk->data;
+	  if (o->movie)
 	    break;
-	  }
 	}
-	if (o == NULL)
-	  o = SWFDEC_AS_OBJECT (swfdec_as_frame_get_target (cx->frame));
-      }
-      /* ".." goes back to parent */
-      if (!SWFDEC_IS_MOVIE (o))
+	if (walk == NULL)
+	  movie = swfdec_as_frame_get_target (cx->frame);
+	if (movie == NULL)
+	  return NULL;
+      } else if (o->movie) {
+	movie = SWFDEC_MOVIE (o->relay);
+      } else {
 	return NULL;
-      o = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (o)->parent);
-      if (o == NULL)
+      }
+      movie = movie->parent;
+      if (movie == NULL)
 	return NULL;
+      o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
     } else {
       o = super_special_movie_lookup_magic (cx, o, 
 	      swfdec_as_context_give_string (cx, g_strndup (start, path - start)));
@@ -558,11 +569,11 @@ swfdec_player_get_movie_from_string (SwfdecPlayer *player, const char *s)
   g_return_val_if_fail (s != NULL, NULL);
 
   ret = swfdec_action_lookup_object (SWFDEC_AS_CONTEXT (player), NULL, s, s + strlen (s));
-  if (!SWFDEC_IS_MOVIE (ret)) {
+  if (ret == NULL || !ret->movie) {
     SWFDEC_WARNING ("\"%s\" does not reference a movie", s);
     return NULL;
   }
-  return SWFDEC_MOVIE (ret);
+  return SWFDEC_MOVIE (ret->relay);
 }
 
 /**
@@ -644,7 +655,7 @@ swfdec_action_get_variable (SwfdecAsContext *cx, guint action, const guint8 *dat
       if (s) {
 	swfdec_as_object_get_variable (object, swfdec_as_context_get_string (cx, s), val);
       } else {
-	SWFDEC_AS_VALUE_SET_MOVIE (val, SWFDEC_MOVIE (object));
+	SWFDEC_AS_VALUE_SET_MOVIE (val, SWFDEC_MOVIE (object->relay));
       }
     } else {
       swfdec_as_frame_get_variable (cx, cx->frame, swfdec_as_context_get_string (cx, s), val);
@@ -1147,8 +1158,11 @@ swfdec_as_interpret_load_variables_on_finish (SwfdecPlayer *player,
 {
   SwfdecMovie *movie = SWFDEC_AS_VALUE_GET_MOVIE (val);
 
+  if (movie == NULL)
+    return;
+
   if (text != NULL)
-    swfdec_as_object_decode (SWFDEC_AS_OBJECT (movie), text);
+    swfdec_as_object_decode (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie)), text);
 
   // only call onData for sprite movies
   swfdec_actor_queue_script (SWFDEC_ACTOR (movie), SWFDEC_EVENT_DATA);
@@ -1227,7 +1241,7 @@ swfdec_action_get_url2 (SwfdecAsContext *cx, guint action, const guint8 *data, g
       SWFDEC_FIXME ("no target, what do we encode now?");
       return;
     }
-    text = swfdec_as_interpret_encode_variables (SWFDEC_AS_OBJECT (movie));
+    text = swfdec_as_interpret_encode_variables (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie)));
     if (method == 1) {
       url = swfdec_as_context_give_string (cx, g_strjoin (NULL, url,
 	    strchr (url, '?') == NULL ? "?" : "&", text, NULL));
@@ -1607,10 +1621,10 @@ swfdec_action_do_set_target (SwfdecAsContext *cx, const char *target, const char
     SwfdecAsObject *o = swfdec_action_lookup_object (cx, NULL, target, end);
     if (o == NULL) {
       SWFDEC_WARNING ("target \"%s\" is not an object", target);
-    } else if (!SWFDEC_IS_MOVIE (o)) {
+    } else if (!o->movie) {
       SWFDEC_FIXME ("target \"%s\" is not a movie, something weird is supposed to happen now", target);
     } else {
-      swfdec_as_frame_set_target (cx->frame, SWFDEC_MOVIE (o));
+      swfdec_as_frame_set_target (cx->frame, SWFDEC_MOVIE (o->relay));
     }
   }
 }
@@ -1924,7 +1938,8 @@ swfdec_action_define_function (SwfdecAsContext *cx, guint action,
     if (target) {
       name = swfdec_as_context_get_string (cx, function_name);
       SWFDEC_AS_VALUE_SET_OBJECT (&funval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
-      swfdec_as_object_set_variable (SWFDEC_AS_OBJECT (target), name, &funval);
+      swfdec_as_object_set_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (target)),
+	  name, &funval);
     }
   }
 
@@ -2167,7 +2182,7 @@ swfdec_action_type_of (SwfdecAsContext *cx, guint action, const guint8 *data, gu
     case SWFDEC_AS_TYPE_MOVIE:
       {
 	SwfdecMovie *movie = SWFDEC_AS_VALUE_GET_MOVIE (val);
-	if (movie != NULL && SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
+	if (SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
 	    movie->state == SWFDEC_MOVIE_STATE_RUNNING) {
 	  type = SWFDEC_AS_STR_object;
 	} else {
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 460edf7..5e4be39 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -687,7 +687,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
   }
 
   if (object->movie) {
-    SwfdecMovie *movie = SWFDEC_MOVIE (object);
+    SwfdecMovie *movie = SWFDEC_MOVIE (object->relay);
 
     guint prop_id = swfdec_movie_property_lookup (variable);
     if (prop_id != G_MAXUINT) {
@@ -922,7 +922,7 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
       SwfdecMovie *movie, *ret;
       guint prop_id;
   
-      movie = SWFDEC_MOVIE (cur);
+      movie = SWFDEC_MOVIE (cur->relay);
 
       if (context->version > 5 && variable == SWFDEC_AS_STR__global) {
 	/* FIXME: current global or movie's global? */
@@ -1154,7 +1154,7 @@ swfdec_as_object_foreach (SwfdecAsObject *object, SwfdecAsVariableForeach func,
     return FALSE;
 
   if (object->movie) {
-    SwfdecMovie *movie = SWFDEC_MOVIE (object);
+    SwfdecMovie *movie = SWFDEC_MOVIE (object->relay);
     SwfdecAsValue val;
     GList *walk;
 
@@ -1234,7 +1234,7 @@ swfdec_as_object_run (SwfdecAsObject *object, SwfdecScript *script)
   context = swfdec_gc_object_get_context (object);
   swfdec_as_frame_init (&frame, context, script);
   if (object->movie) {
-    frame.target = SWFDEC_MOVIE (object);
+    frame.target = SWFDEC_MOVIE (object->relay);
     frame.original_target = frame.target;
   }
   swfdec_as_frame_set_this (&frame, object);
@@ -1396,7 +1396,7 @@ swfdec_as_object_set_constructor (SwfdecAsObject *object, SwfdecAsObject *constr
   SWFDEC_AS_VALUE_SET_OBJECT (&val, construct);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor, 
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-  if (swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (construct),
+  if (swfdec_as_object_get_variable (construct,
 	  SWFDEC_AS_STR_prototype, &val)) {
     swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__, 
 	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
diff --git a/swfdec/swfdec_as_string.c b/swfdec/swfdec_as_string.c
index 21af2f7..c87d32b 100644
--- a/swfdec/swfdec_as_string.c
+++ b/swfdec/swfdec_as_string.c
@@ -340,7 +340,7 @@ swfdec_as_string_split_5 (SwfdecAsContext *cx, SwfdecAsObject *object,
   SWFDEC_AS_STRING_CHECK (&str, "");
 
   arr = swfdec_as_array_new (cx);
-  SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
+  SWFDEC_AS_VALUE_SET_OBJECT (ret, arr);
   /* hi, i'm the special case */
   if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
     delim = SWFDEC_AS_STR_COMMA;
@@ -392,7 +392,7 @@ swfdec_as_string_split_6 (SwfdecAsContext *cx, SwfdecAsObject *object,
   SWFDEC_AS_STRING_CHECK (&str, "");
 
   arr = swfdec_as_array_new (cx);
-  SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
+  SWFDEC_AS_VALUE_SET_OBJECT (ret, arr);
   /* hi, i'm the special case */
   if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
     SWFDEC_AS_VALUE_SET_STRING (&val, str);
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 2d21725..f520e98 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -140,14 +140,19 @@ swfdec_bitmap_data_loadBitmap (SwfdecAsContext *cx, SwfdecAsObject *object,
 {
   SwfdecBitmapData *bitmap;
   SwfdecImage *image;
+  SwfdecMovie *movie;
   const char *name;
   cairo_surface_t *isurface;
   cairo_t *cr;
 
   SWFDEC_AS_CHECK (0, NULL, "s", &name);
 
-  g_assert (SWFDEC_IS_MOVIE (cx->frame->target));
-  image = swfdec_resource_get_export (SWFDEC_MOVIE (cx->frame->target)->resource, name);
+  movie = swfdec_as_frame_get_target (cx->frame);
+  if (movie == NULL) {
+    SWFDEC_ERROR ("no target to load from");
+    return;
+  }
+  image = swfdec_resource_get_export (movie->resource, name);
   if (!SWFDEC_IS_IMAGE (image)) {
     SWFDEC_ERROR ("loadBitmap cannot find image with name %s", name);
     return;
@@ -522,8 +527,8 @@ swfdec_bitmap_data_draw (SwfdecAsContext *cx, SwfdecAsObject *object,
       cairo_paint (cr);
       cairo_pattern_destroy (pattern);
     }
-  } else if (SWFDEC_IS_MOVIE (o)) {
-    SwfdecMovie *movie = SWFDEC_MOVIE (o);
+  } else if (o->movie) {
+    SwfdecMovie *movie = SWFDEC_MOVIE (o->relay);
     swfdec_movie_update (movie);
     cairo_scale (cr, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR);
     cairo_transform (cr, &movie->inverse_matrix);
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 8337400..206fd23 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -67,13 +67,11 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_ABSTRACT_TYPE (SwfdecMovie, swfdec_movie, SWFDEC_TYPE_AS_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (SwfdecMovie, swfdec_movie, SWFDEC_TYPE_AS_RELAY)
 
 static void
 swfdec_movie_init (SwfdecMovie * movie)
 {
-  SWFDEC_AS_OBJECT (movie)->movie = TRUE;
-
   movie->blend_mode = SWFDEC_BLEND_MODE_NORMAL;
 
   movie->xscale = 100;
@@ -374,7 +372,7 @@ swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
     swfdec_movie_unset_actor (player, actor);
     if ((actor->events && 
 	  swfdec_event_list_has_conditions (actor->events, SWFDEC_EVENT_UNLOAD, 0)) ||
-	swfdec_as_object_has_variable (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_onUnload)) {
+	swfdec_as_object_has_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie)), SWFDEC_AS_STR_onUnload)) {
       swfdec_actor_queue_script (actor, SWFDEC_EVENT_UNLOAD);
       destroy = FALSE;
     }
@@ -450,7 +448,6 @@ swfdec_movie_destroy (SwfdecMovie *movie)
   if (movie->as_value) {
     movie->as_value->movie = NULL;
     movie->as_value = NULL;
-    SWFDEC_AS_OBJECT (movie)->prototype = NULL;
   }
   g_object_unref (movie);
 }
@@ -948,11 +945,8 @@ swfdec_movie_set_property (GObject *object, guint param_id, const GValue *value,
 	/* invalidate the parent, so it gets visible */
 	swfdec_movie_queue_update (movie->parent, SWFDEC_MOVIE_INVALID_CHILDREN);
       } else {
-	SwfdecAsValue val;
 	SwfdecPlayerPrivate *priv = SWFDEC_PLAYER (cx)->priv;
 	priv->roots = g_list_insert_sorted (priv->roots, movie, swfdec_movie_compare_depths);
-	SWFDEC_AS_VALUE_SET_STRING (&val, swfdec_as_context_get_string (cx, priv->system->version));
-	swfdec_as_object_set_variable (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR__version, &val);
       }
       break;
     case PROP_RESOURCE:
@@ -1031,6 +1025,8 @@ swfdec_movie_mark (SwfdecGcObject *object)
 gboolean
 swfdec_movie_is_scriptable (SwfdecMovie *movie)
 {
+  /* FIXME: It would be much easier if we'd just check that there's no as_value 
+   * for non-scriptable movies */
   return (SWFDEC_IS_ACTOR (movie) || SWFDEC_IS_VIDEO_MOVIE (movie)) &&
    (swfdec_movie_get_version (movie) > 5 || !SWFDEC_IS_TEXT_FIELD_MOVIE (movie));
 }
@@ -1291,6 +1287,7 @@ swfdec_movie_constructor (GType type, guint n_construct_properties,
 {
   SwfdecPlayerPrivate *priv;
   SwfdecAsContext *cx;
+  SwfdecAsObject *o;
   SwfdecMovie *movie;
   GObject *object;
   const char *name;
@@ -1320,6 +1317,17 @@ swfdec_movie_constructor (GType type, guint n_construct_properties,
     SWFDEC_AS_VALUE_SET_MOVIE (&movie->resource->movie, movie);
   }
 
+  /* create AsObject */
+  o = swfdec_as_object_new_empty (cx);
+  o->movie = TRUE;
+  swfdec_as_object_set_relay (o, SWFDEC_AS_RELAY (movie));
+
+  /* set $version variable */
+  if (movie->parent == NULL) {
+    SwfdecAsValue val;
+    SWFDEC_AS_VALUE_SET_STRING (&val, swfdec_as_context_get_string (cx, priv->system->version));
+    swfdec_as_object_set_variable (o, SWFDEC_AS_STR__version, &val);
+  }
   return object;
 }
 
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 8ba13b5..7963033 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -119,7 +119,7 @@ typedef struct {
 } SwfdecMovieVariableListener;
 
 struct _SwfdecMovie {
-  SwfdecAsObject	object;
+  SwfdecAsRelay		relay;
 
   SwfdecGraphic *	graphic;		/* graphic represented by this movie or NULL if script-created */
   const char *		name;		/* name of movie - GC'd */
@@ -182,7 +182,7 @@ struct _SwfdecMovie {
 };
 
 struct _SwfdecMovieClass {
-  SwfdecAsObjectClass	object_class;
+  SwfdecAsRelayClass	relay_class;
 
   /* general vfuncs */
   void			(* init_movie)		(SwfdecMovie *		movie);
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index b52f784..b139fe3 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -521,8 +521,9 @@ swfdec_player_do_action (SwfdecPlayer *player)
     if (action) {
       if (action->script) {
 	SwfdecSandbox *sandbox = SWFDEC_MOVIE (action->actor)->resource->sandbox;
+	SwfdecAsObject *object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (action->actor));
 	swfdec_sandbox_use (sandbox);
-	swfdec_as_object_run (SWFDEC_AS_OBJECT (action->actor), action->script);
+	swfdec_as_object_run (object, action->script);
 	swfdec_sandbox_unuse (sandbox);
       } else {
 	swfdec_actor_execute (action->actor, action->event, action->key);
@@ -1205,7 +1206,7 @@ swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecActor *actor)
   }
   if (prev) {
     swfdec_sandbox_use (SWFDEC_MOVIE (prev)->resource->sandbox);
-    swfdec_as_object_call (SWFDEC_AS_OBJECT (prev), SWFDEC_AS_STR_onKillFocus,
+    swfdec_as_relay_call (SWFDEC_AS_RELAY (prev), SWFDEC_AS_STR_onKillFocus,
 	1, &vals[1], NULL);
     swfdec_sandbox_unuse (SWFDEC_MOVIE (prev)->resource->sandbox);
     klass = SWFDEC_ACTOR_GET_CLASS (prev);
@@ -1217,7 +1218,7 @@ swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecActor *actor)
   swfdec_player_invalidate_focusrect (player);
   if (actor) {
     swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
-    swfdec_as_object_call (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_onSetFocus,
+    swfdec_as_relay_call (SWFDEC_AS_RELAY (actor), SWFDEC_AS_STR_onSetFocus,
 	1, &vals[0], NULL);
     swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
     klass = SWFDEC_ACTOR_GET_CLASS (actor);
@@ -1489,6 +1490,7 @@ swfdec_player_focus_sort (gconstpointer ca, gconstpointer cb)
 static GList *
 swfdec_player_get_tab_movies (SwfdecPlayer *player, const GList *current)
 {
+  SwfdecAsObject *object;
   SwfdecAsValue val;
   const GList *walk;
   GList *ret = NULL;
@@ -1499,15 +1501,17 @@ swfdec_player_get_tab_movies (SwfdecPlayer *player, const GList *current)
     if (!SWFDEC_IS_ACTOR (actor))
       continue;
 
+    object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (actor));
     swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
     if (SWFDEC_IS_TEXT_FIELD_MOVIE (actor)) {
       SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
       if (text->editable)
 	ret = g_list_prepend (ret, actor);
     } else if (SWFDEC_MOVIE (actor)->parent != NULL) {
-      swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabEnabled, &val);
+      swfdec_as_object_get_variable (object, SWFDEC_AS_STR_tabEnabled, &val);
       if (swfdec_as_value_to_boolean (SWFDEC_AS_CONTEXT (player), &val)) {
-	swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabEnabled, &val);
+	/* Flash queries again - why not? :/ */
+	swfdec_as_object_get_variable (object, SWFDEC_AS_STR_tabEnabled, &val);
 	ret = g_list_prepend (ret, actor);
       } else if (SWFDEC_AS_VALUE_IS_UNDEFINED (&val) && 
 	  swfdec_actor_get_mouse_events (actor)) {
@@ -1518,7 +1522,7 @@ swfdec_player_get_tab_movies (SwfdecPlayer *player, const GList *current)
     if (SWFDEC_MOVIE (actor)->parent == NULL)
       SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
     else
-      swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabChildren, &val);
+      swfdec_as_object_get_variable (object, SWFDEC_AS_STR_tabChildren, &val);
 
     if (SWFDEC_AS_VALUE_IS_UNDEFINED (&val) ||
 	swfdec_as_value_to_boolean (SWFDEC_AS_CONTEXT (player), &val)) {
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 2faa260..1948e82 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -89,8 +89,8 @@ swfdec_resource_stream_target_image (SwfdecResource *instance)
       movie->n_frames = movie->sprite->n_frames;
       swfdec_movie_invalidate_last (SWFDEC_MOVIE (movie));
       swfdec_sandbox_use (instance->sandbox);
-      swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie), 
-	  SWFDEC_AS_STR_MovieClip, NULL);
+      swfdec_as_object_set_constructor_by_name (swfdec_as_relay_get_as_object (
+	    SWFDEC_AS_RELAY (movie)), SWFDEC_AS_STR_MovieClip, NULL);
       swfdec_sandbox_unuse (instance->sandbox);
       if (swfdec_resource_is_root (instance)) {
 	swfdec_player_start_ticking (player);
@@ -208,20 +208,22 @@ swfdec_resource_stream_target_open (SwfdecStreamTarget *target, SwfdecStream *st
 {
   SwfdecLoader *loader = SWFDEC_LOADER (stream);
   SwfdecResource *instance = SWFDEC_RESOURCE (target);
+  SwfdecAsObject *object;
   SwfdecMovie *movie;
   const char *query;
 
   g_assert (SWFDEC_AS_VALUE_IS_MOVIE (&instance->movie));
   movie = SWFDEC_AS_VALUE_GET_MOVIE (&instance->movie);
   g_assert (movie);
+  object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
   query = swfdec_url_get_query (swfdec_loader_get_url (loader));
   if (query) {
     SWFDEC_INFO ("set url query movie variables: %s", query);
-    swfdec_as_object_decode (SWFDEC_AS_OBJECT (movie), query);
+    swfdec_as_object_decode (object, query);
   }
   if (instance->variables) {
     SWFDEC_INFO ("set manual movie variables: %s", instance->variables);
-    swfdec_as_object_decode (SWFDEC_AS_OBJECT (movie), instance->variables);
+    swfdec_as_object_decode (object, instance->variables);
   }
   swfdec_resource_emit_signal (instance, SWFDEC_AS_STR_onLoadStart, FALSE, NULL, 0);
   instance->state = SWFDEC_RESOURCE_OPENED;
diff --git a/swfdec/swfdec_selection.c b/swfdec/swfdec_selection.c
index c4832f7..2fa2c85 100644
--- a/swfdec/swfdec_selection.c
+++ b/swfdec/swfdec_selection.c
@@ -117,7 +117,7 @@ swfdec_actor_can_grab_focus (SwfdecActor *actor)
       SWFDEC_IS_BUTTON_MOVIE (actor)) {
     if (SWFDEC_MOVIE (actor)->parent == NULL)
       return FALSE;
-    if (!swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor),
+    if (!swfdec_as_object_get_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (actor)),
 	SWFDEC_AS_STR_focusEnabled, &val))
       return swfdec_actor_get_mouse_events (actor);
     return swfdec_as_value_to_boolean (swfdec_gc_object_get_context (actor), &val);
@@ -138,7 +138,7 @@ swfdec_selection_setFocus (SwfdecAsContext *cx, SwfdecAsObject *object,
   SwfdecSandbox *sandbox;
 
   SWFDEC_AS_VALUE_SET_BOOLEAN (ret, FALSE);
-  SWFDEC_AS_CHECK (0, NULL, "O", &actor);
+  SWFDEC_AS_CHECK (0, NULL, "M", &actor);
 
   if (actor != NULL) {
     if (!SWFDEC_IS_ACTOR (actor) ||
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index 780d969..f64dca2 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -712,12 +712,13 @@ swfdec_sprite_movie_constructor (GType type, guint n_construct_properties,
   movie = SWFDEC_MOVIE (object);
   if (movie->resource->sandbox) {
     /* FIXME: This hack is probably wrong */
+    SwfdecAsObject *o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
     if (swfdec_sandbox_try_use (movie->resource->sandbox)) {
-      swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie), 
+      swfdec_as_object_set_constructor_by_name (o,
 	  SWFDEC_AS_STR_MovieClip, NULL);
       swfdec_sandbox_unuse (movie->resource->sandbox);
     } else {
-      swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie), 
+      swfdec_as_object_set_constructor_by_name (o,
 	  SWFDEC_AS_STR_MovieClip, NULL);
     }
   }
@@ -770,20 +771,6 @@ swfdec_sprite_movie_finish_movie (SwfdecMovie *mov)
 }
 
 static void
-swfdec_sprite_movie_mark (SwfdecGcObject *object)
-{
-  GList *walk;
-
-  for (walk = SWFDEC_MOVIE (object)->list; walk; walk = walk->next) {
-    SwfdecAsObject *child = walk->data;
-    g_assert (child->properties != NULL);
-    swfdec_gc_object_mark (child);
-  }
-
-  SWFDEC_GC_OBJECT_CLASS (swfdec_sprite_movie_parent_class)->mark (object);
-}
-
-static void
 swfdec_sprite_movie_property_get (SwfdecMovie *mov, guint prop_id, SwfdecAsValue *val)
 {
   SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
@@ -809,15 +796,12 @@ static void
 swfdec_sprite_movie_class_init (SwfdecSpriteMovieClass * g_class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (g_class);
-  SwfdecGcObjectClass *gc_class = SWFDEC_GC_OBJECT_CLASS (g_class);
   SwfdecMovieClass *movie_class = SWFDEC_MOVIE_CLASS (g_class);
   SwfdecActorClass *actor_class = SWFDEC_ACTOR_CLASS (g_class);
 
   object_class->dispose = swfdec_sprite_movie_dispose;
   object_class->constructor = swfdec_sprite_movie_constructor;
 
-  gc_class->mark = swfdec_sprite_movie_mark;
-
   movie_class->init_movie = swfdec_sprite_movie_init_movie;
   movie_class->finish_movie = swfdec_sprite_movie_finish_movie;
   movie_class->property_get = swfdec_sprite_movie_property_get;
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index faabd06..72db3c8 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -364,9 +364,9 @@ void
 swfdec_sprite_movie_getSWFVersion (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
 {
-  if (object != NULL && SWFDEC_IS_MOVIE (object)) {
+  if (object != NULL && object->movie) {
     swfdec_as_value_set_integer (cx, rval,
-	swfdec_movie_get_version (SWFDEC_MOVIE (object)));
+	swfdec_movie_get_version (SWFDEC_MOVIE (object->relay)));
   } else {
     swfdec_as_value_set_integer (cx, rval, -1);
   }
@@ -709,6 +709,7 @@ swfdec_sprite_movie_createEmptyMovieClip (SwfdecAsContext *cx, SwfdecAsObject *o
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
 {
   SwfdecMovie *movie, *parent;
+  SwfdecSandbox *sandbox;
   int depth;
   const char *name;
 
@@ -719,16 +720,11 @@ swfdec_sprite_movie_createEmptyMovieClip (SwfdecAsContext *cx, SwfdecAsObject *o
     swfdec_movie_remove (movie);
   movie = swfdec_movie_new (SWFDEC_PLAYER (cx), depth, parent, parent->resource, NULL, name);
 
-  if (SWFDEC_IS_SPRITE_MOVIE (movie)) {
-    SwfdecSandbox *sandbox = swfdec_sandbox_get (SWFDEC_PLAYER (cx));
-    SwfdecActor *actor = SWFDEC_ACTOR (movie);
-    swfdec_sandbox_unuse (sandbox);
-    swfdec_movie_initialize (movie);
-    swfdec_actor_execute (actor, SWFDEC_EVENT_CONSTRUCT, 0);
-    swfdec_sandbox_use (sandbox);
-  } else {
-    swfdec_movie_initialize (movie);
-  }
+  sandbox = swfdec_sandbox_get (SWFDEC_PLAYER (cx));
+  swfdec_sandbox_unuse (sandbox);
+  swfdec_movie_initialize (movie);
+  swfdec_actor_execute (SWFDEC_ACTOR (movie), SWFDEC_EVENT_CONSTRUCT, 0);
+  swfdec_sandbox_use (sandbox);
 
   SWFDEC_AS_VALUE_SET_MOVIE (rval, movie);
 }
@@ -751,16 +747,15 @@ static gboolean
 swfdec_sprite_movie_foreach_copy_properties (SwfdecAsObject *object,
     const char *variable, SwfdecAsValue *value, guint flags, gpointer data)
 {
-  SwfdecAsObject *target = data;
-
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (target), FALSE);
+  SwfdecMovie *target = SWFDEC_MOVIE (data);
 
   /* FIXME: We likely need better flag handling here.
    * We might even want to fix swfdec_as_object_foreach() */
   if (flags & SWFDEC_AS_VARIABLE_HIDDEN)
     return TRUE;
 
-  swfdec_as_object_set_variable (target, variable, value);
+  swfdec_as_object_set_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (target)),
+      variable, value);
 
   return TRUE;
 }
@@ -776,12 +771,12 @@ swfdec_sprite_movie_init_from_object (SwfdecMovie *movie,
     SwfdecAsContext *cx = swfdec_gc_object_get_context (movie);
     if (cx->version <= 6) {
       swfdec_as_object_foreach (initObject,
-	  swfdec_sprite_movie_foreach_copy_properties, SWFDEC_AS_OBJECT (movie));
+	  swfdec_sprite_movie_foreach_copy_properties, movie);
       swfdec_movie_initialize (movie);
     } else {
       swfdec_movie_initialize (movie);
       swfdec_as_object_foreach (initObject,
-	  swfdec_sprite_movie_foreach_copy_properties, SWFDEC_AS_OBJECT (movie));
+	  swfdec_sprite_movie_foreach_copy_properties, movie);
     }
   } else {
     swfdec_movie_initialize (movie);
@@ -805,7 +800,7 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
 {
   SwfdecMovie *movie;
   SwfdecMovie *ret;
-  SwfdecAsObject *initObject = NULL, *constructor;
+  SwfdecAsObject *initObject = NULL, *constructor, *o;
   const char *name, *export;
   int depth;
   SwfdecGraphic *sprite;
@@ -832,11 +827,11 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
       ret->name, ret->depth);
   /* run init and construct */
   constructor = swfdec_player_get_export_class (SWFDEC_PLAYER (cx), export);
+  o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ret));
   if (constructor == NULL) {
-    swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (ret),
-	SWFDEC_AS_STR_MovieClip, NULL);
+    swfdec_as_object_set_constructor_by_name (o, SWFDEC_AS_STR_MovieClip, NULL);
   } else {
-    swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (ret), constructor);
+    swfdec_as_object_set_constructor (o, constructor);
   }
 
   swfdec_sprite_movie_init_from_object (ret, initObject);
@@ -949,10 +944,10 @@ swfdec_sprite_movie_setMask (SwfdecAsContext *cx, SwfdecAsObject *object,
   SwfdecMovie *movie, *mask;
 
   /* yes, this works with regular movies */
-  SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "O", &mask);
+  SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "M", &mask);
 
-  if (mask != NULL && !SWFDEC_IS_MOVIE (mask)) {
-    SWFDEC_FIXME ("mask is not a movie, what now?");
+  if (argc > 0 && mask == NULL && !SWFDEC_AS_VALUE_IS_NULL (&argv[0])) {
+    SWFDEC_FIXME ("mask is not a movie and not null, what now?");
     mask = NULL;
   }
   if (movie->masked_by)
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index 6c247cb..eabce5d 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -395,19 +395,22 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
   needs_unuse = swfdec_sandbox_try_use (movie->resource->sandbox);
 
   cx = swfdec_gc_object_get_context (movie);
+  if (movie->resource->version > 5) {
+    SwfdecAsObject *o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
 
-  swfdec_text_field_movie_init_properties (cx);
+    swfdec_text_field_movie_init_properties (cx);
 
-  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie),
-      SWFDEC_AS_STR_TextField, NULL);
+    swfdec_as_object_set_constructor_by_name (o,
+	SWFDEC_AS_STR_TextField, NULL);
 
-  /* create _listeners array containing self */
-  array = swfdec_as_array_new (cx);
-  SWFDEC_AS_VALUE_SET_MOVIE (&val, movie);
-  swfdec_as_array_push (array, &val);
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
-  swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR__listeners, 
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+    /* create _listeners array containing self */
+    array = swfdec_as_array_new (cx);
+    SWFDEC_AS_VALUE_SET_MOVIE (&val, movie);
+    swfdec_as_array_push (array, &val);
+    SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
+    swfdec_as_object_set_variable_and_flags (o, SWFDEC_AS_STR__listeners, 
+	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  }
 
   text->border_color = SWFDEC_COLOR_COMBINE (0, 0, 0, 0);
   text->background_color = SWFDEC_COLOR_COMBINE (255, 255, 255, 0);
@@ -541,9 +544,8 @@ swfdec_text_field_movie_parse_listen_variable (SwfdecTextFieldMovie *text,
   if (SWFDEC_MOVIE (text)->parent == NULL)
     return;
 
-  g_assert (SWFDEC_IS_AS_OBJECT (SWFDEC_MOVIE (text)->parent));
   cx = swfdec_gc_object_get_context (text);
-  parent = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (text)->parent);
+  parent = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (SWFDEC_MOVIE (text)->parent));
 
   p1 = strrchr (variable, '.');
   p2 = strrchr (variable, ':');
@@ -601,7 +603,7 @@ swfdec_text_field_movie_asfunction (SwfdecTextFieldMovie *text,
   } else {
     swfdec_as_object_call (object, name, 0, NULL, NULL);
   }
-  swfdec_sandbox_use (SWFDEC_MOVIE (text)->resource->sandbox);
+  swfdec_sandbox_unuse (SWFDEC_MOVIE (text)->resource->sandbox);
 
   g_strfreev (parts);
 }
@@ -1047,7 +1049,7 @@ swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie *text,
     swfdec_text_field_movie_parse_listen_variable (text, text->variable,
 	&object, &name);
     if (object != NULL && object->movie) {
-      swfdec_movie_remove_variable_listener (SWFDEC_MOVIE (object),
+      swfdec_movie_remove_variable_listener (SWFDEC_MOVIE (object->relay),
 	  text, name, swfdec_text_field_movie_variable_listener_callback);
     }
   }
@@ -1074,7 +1076,7 @@ swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie *text,
       swfdec_text_field_movie_set_text (text, initial, text_field->html);
     }
     if (object != NULL && object->movie) {
-      swfdec_movie_add_variable_listener (SWFDEC_MOVIE (object),
+      swfdec_movie_add_variable_listener (SWFDEC_MOVIE (object->relay),
 	  text, name, swfdec_text_field_movie_variable_listener_callback);
     }
   }
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index 9d556b9..1ccae45 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -875,7 +875,7 @@ swfdec_text_field_movie_get_styleSheet (SwfdecAsContext *cx,
   SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
 
   if (text->style_sheet != NULL) {
-    SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (text->style_sheet));
+    SWFDEC_AS_VALUE_SET_OBJECT (ret, text->style_sheet);
   } else {
     SWFDEC_AS_VALUE_SET_UNDEFINED (ret);
   }
@@ -1339,7 +1339,7 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
   int depth, x, y, width, height;
   const char *name;
   SwfdecAsFunction *fun;
-  SwfdecAsObject *fun_object;
+  SwfdecAsObject *fun_object, *o;
   SwfdecAsValue val;
 
   SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &parent, "siiiii", &name, &depth, &x, &y, &width, &height);
@@ -1399,22 +1399,23 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
   fun = SWFDEC_AS_FUNCTION (fun_object->relay);
 
   /* set initial variables */
+  o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie));
   if (swfdec_as_object_get_variable (fun_object,
 	SWFDEC_AS_STR_prototype, &val)) {
-    swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie),
+    swfdec_as_object_set_variable_and_flags (o,
 	SWFDEC_AS_STR___proto__, &val,
 	SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   }
   SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_object);
   if (cx->version < 7) {
-    swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie),
+    swfdec_as_object_set_variable_and_flags (o,
 	SWFDEC_AS_STR_constructor, &val, SWFDEC_AS_VARIABLE_HIDDEN);
   }
-  swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie),
+  swfdec_as_object_set_variable_and_flags (o,
       SWFDEC_AS_STR___constructor__, &val,
       SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
-  swfdec_as_function_call_full (fun, SWFDEC_AS_OBJECT (movie), TRUE, NULL,
+  swfdec_as_function_call_full (fun, o, TRUE, NULL,
       0, NULL, cx->version > 7 ? rval : &val);
 }
 
diff --git a/swfdec/swfdec_video_movie.c b/swfdec/swfdec_video_movie.c
index 68ec7e4..611bdda 100644
--- a/swfdec/swfdec_video_movie.c
+++ b/swfdec/swfdec_video_movie.c
@@ -130,7 +130,7 @@ swfdec_video_movie_constructor (GType type, guint n_construct_properties,
   movie = SWFDEC_MOVIE (object);
   unuse = swfdec_sandbox_try_use (movie->resource->sandbox);
   swfdec_video_movie_init_properties (swfdec_gc_object_get_context (movie));
-  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie), 
+  swfdec_as_object_set_constructor_by_name (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (movie)), 
       SWFDEC_AS_STR_Video, NULL);
   if (unuse)
     swfdec_sandbox_unuse (movie->resource->sandbox);
diff --git a/swfdec/swfdec_xml_socket.c b/swfdec/swfdec_xml_socket.c
index 54fc626..d2dc998 100644
--- a/swfdec/swfdec_xml_socket.c
+++ b/swfdec/swfdec_xml_socket.c
@@ -283,7 +283,7 @@ swfdec_xml_socket_connect (SwfdecAsContext *cx, SwfdecAsObject *object,
 
   SWFDEC_AS_CHECK (0, NULL, "si", &host, &port);
 
-  if (SWFDEC_IS_MOVIE (object) || object == NULL)
+  if (object == NULL || object->movie)
     return;
 
   swfdec_xml_socket_create (object, swfdec_sandbox_get (SWFDEC_PLAYER (cx)), host, port);
commit b7f52f59b8dc9d8748cbe89839efcd52f9b5d42f
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 10:27:38 2008 +0100

    remove unused object argument from wfdec_event_list_has_condition()

diff --git a/swfdec/swfdec_event.c b/swfdec/swfdec_event.c
index 98ff505..643068c 100644
--- a/swfdec/swfdec_event.c
+++ b/swfdec/swfdec_event.c
@@ -194,13 +194,12 @@ swfdec_event_list_execute (SwfdecEventList *list, SwfdecAsObject *object,
 }
 
 gboolean
-swfdec_event_list_has_conditions (SwfdecEventList *list, SwfdecAsObject *object,
+swfdec_event_list_has_conditions (SwfdecEventList *list,
     guint condition, guint8 key)
 {
   guint i;
 
   g_return_val_if_fail (list != NULL, FALSE);
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
   g_return_val_if_fail (condition < N_CONDITIONS, FALSE);
 
   condition = 1 << condition;
diff --git a/swfdec/swfdec_event.h b/swfdec/swfdec_event.h
index ef69df3..b4f1d95 100644
--- a/swfdec/swfdec_event.h
+++ b/swfdec/swfdec_event.h
@@ -71,7 +71,6 @@ void			swfdec_event_list_execute	(SwfdecEventList *    list,
 							 guint		      condition,
 							 guint8		      key);
 gboolean		swfdec_event_list_has_conditions(SwfdecEventList *    list,
-							 SwfdecAsObject *     object,
 							 guint		      conditions,
 							 guint8		      key);
 gboolean		swfdec_event_list_has_mouse_events(SwfdecEventList *  list);
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index ac93b7a..8337400 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -373,7 +373,7 @@ swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
     SwfdecActor *actor = SWFDEC_ACTOR (movie);
     swfdec_movie_unset_actor (player, actor);
     if ((actor->events && 
-	  swfdec_event_list_has_conditions (actor->events, SWFDEC_AS_OBJECT (movie), SWFDEC_EVENT_UNLOAD, 0)) ||
+	  swfdec_event_list_has_conditions (actor->events, SWFDEC_EVENT_UNLOAD, 0)) ||
 	swfdec_as_object_has_variable (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_onUnload)) {
       swfdec_actor_queue_script (actor, SWFDEC_EVENT_UNLOAD);
       destroy = FALSE;
commit 5203a30f5517c2596d14a1e5e32231d7a73e254d
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 09:53:46 2008 +0100

    remove an unused function
    
    Nostalgia...
    That function is from 0.5.x or earlier

diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index 2dfbc42..780d969 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -832,40 +832,6 @@ swfdec_sprite_movie_init (SwfdecSpriteMovie * movie)
   movie->frame = (guint) -1;
 }
 
-/* cute little hack */
-extern void
-swfdec_sprite_movie_clear (SwfdecAsContext *cx, SwfdecAsObject *object,
-    guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval);
-/**
- * swfdec_sprite_movie_unload:
- * @movie: a #SwfdecMovie
- *
- * Clears all contents from the given movie. This means deleting all
- * variables and removing all children movie clips.
- **/
-void
-swfdec_sprite_movie_unload (SwfdecSpriteMovie *movie)
-{
-  SwfdecMovie *mov;
-  SwfdecAsValue hack;
-
-  g_return_if_fail (SWFDEC_IS_SPRITE_MOVIE (movie));
-
-  mov = SWFDEC_MOVIE (movie);
-  swfdec_sprite_movie_clear (swfdec_gc_object_get_context (movie), 
-      SWFDEC_AS_OBJECT (movie), 0, NULL, &hack);
-  /* FIXME: destroy or unload? */
-  while (mov->list)
-    swfdec_movie_remove (mov->list->data);
-  swfdec_as_object_delete_all_variables (SWFDEC_AS_OBJECT (movie));
-  movie->frame = (guint) -1;
-  movie->n_frames = 0;
-  movie->next_action = 0;
-  movie->max_action = 0;
-  movie->sprite = NULL;
-  swfdec_movie_queue_update (SWFDEC_MOVIE (movie), SWFDEC_MOVIE_INVALID_EXTENTS);
-}
-
 /**
  * swfdec_sprite_movie_get_frames_loaded:
  * @movie: a #SwfdecSpriteMovie
diff --git a/swfdec/swfdec_sprite_movie.h b/swfdec/swfdec_sprite_movie.h
index 6f5a043..a294154 100644
--- a/swfdec/swfdec_sprite_movie.h
+++ b/swfdec/swfdec_sprite_movie.h
@@ -66,7 +66,6 @@ int		swfdec_sprite_movie_get_frames_total	(SwfdecSpriteMovie *	movie);
 
 void		swfdec_sprite_movie_goto		(SwfdecSpriteMovie *	movie,
 							 guint			goto_frame);
-void		swfdec_sprite_movie_unload		(SwfdecSpriteMovie *	movie);
 
 
 G_END_DECLS
commit 6eebecd6a373b74e65ef19ec429cd074886728b1
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 09:46:30 2008 +0100

    make variable listeners not take a SwfdecAsObject but a generic gpointer arg

diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 26b91c4..ac93b7a 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1010,7 +1010,6 @@ swfdec_movie_mark (SwfdecGcObject *object)
 
   for (iter = movie->variable_listeners; iter != NULL; iter = iter->next) {
     SwfdecMovieVariableListener *listener = iter->data;
-    swfdec_gc_object_mark (listener->object);
     swfdec_as_string_mark (listener->name);
   }
   swfdec_gc_object_mark (movie->resource);
@@ -1091,7 +1090,7 @@ swfdec_movie_get_root (SwfdecMovie *movie)
 }
 
 void
-swfdec_movie_add_variable_listener (SwfdecMovie *movie, SwfdecAsObject *object,
+swfdec_movie_add_variable_listener (SwfdecMovie *movie, gpointer data,
     const char *name, const SwfdecMovieVariableListenerFunction function)
 {
   SwfdecMovieVariableListener *listener;
@@ -1100,15 +1099,13 @@ swfdec_movie_add_variable_listener (SwfdecMovie *movie, SwfdecAsObject *object,
   for (iter = movie->variable_listeners; iter != NULL; iter = iter->next) {
     listener = iter->data;
 
-    if (listener->object == object && listener->name == name &&
+    if (listener->data == data && listener->name == name &&
 	listener->function == function)
-      break;
+      return;
   }
-  if (iter != NULL)
-    return;
 
   listener = g_new0 (SwfdecMovieVariableListener, 1);
-  listener->object = object;
+  listener->data = data;
   listener->name = name;
   listener->function = function;
 
@@ -1118,7 +1115,7 @@ swfdec_movie_add_variable_listener (SwfdecMovie *movie, SwfdecAsObject *object,
 
 void
 swfdec_movie_remove_variable_listener (SwfdecMovie *movie,
-    SwfdecAsObject *object, const char *name,
+    gpointer data, const char *name,
     const SwfdecMovieVariableListenerFunction function)
 {
   GSList *iter;
@@ -1126,7 +1123,7 @@ swfdec_movie_remove_variable_listener (SwfdecMovie *movie,
   for (iter = movie->variable_listeners; iter != NULL; iter = iter->next) {
     SwfdecMovieVariableListener *listener = iter->data;
 
-    if (listener->object == object && listener->name == name &&
+    if (listener->data == data && listener->name == name &&
 	listener->function == function)
       break;
   }
@@ -1152,7 +1149,7 @@ swfdec_movie_call_variable_listeners (SwfdecMovie *movie, const char *name,
 	 !swfdec_str_case_equal (listener->name, name)))
       continue;
 
-    listener->function (listener->object, name, val);
+    listener->function (listener->data, name, val);
   }
 }
 
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index dd437db..8ba13b5 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -109,11 +109,11 @@ typedef enum {
   SWFDEC_MOVIE_INVALID_EXTENTS,		/* recalculate extents */
 } SwfdecMovieCacheState;
 
-typedef void (*SwfdecMovieVariableListenerFunction) (SwfdecAsObject *object,
+typedef void (*SwfdecMovieVariableListenerFunction) (gpointer data,
     const char *name, const SwfdecAsValue *val);
 
 typedef struct {
-  SwfdecAsObject *			object;
+  gpointer				data;
   const char *				name;
   SwfdecMovieVariableListenerFunction	function;
 } SwfdecMovieVariableListener;
@@ -310,11 +310,11 @@ void		swfdec_movie_property_do_get	(SwfdecMovie *		movie,
 						 SwfdecAsValue *	val);
 
 void		swfdec_movie_add_variable_listener (SwfdecMovie *	movie,
-						 SwfdecAsObject *	object,
+						 gpointer		data,
 						 const char *		name,
 						 const SwfdecMovieVariableListenerFunction	function);
 void		swfdec_movie_remove_variable_listener (SwfdecMovie *	movie,
-						 SwfdecAsObject *	object,
+						 gpointer		data,
 						 const char *		name,
 						 const SwfdecMovieVariableListenerFunction	function);
 SwfdecResource *swfdec_movie_get_own_resource	(SwfdecMovie *		movie);
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index acd79ba..6c247cb 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1027,14 +1027,11 @@ swfdec_text_field_movie_set_listen_variable_text (SwfdecTextFieldMovie *text,
 }
 
 static void
-swfdec_text_field_movie_variable_listener_callback (SwfdecAsObject *object,
+swfdec_text_field_movie_variable_listener_callback (gpointer data,
     const char *name, const SwfdecAsValue *val)
 {
-  SwfdecTextFieldMovie *text;
-
-  g_return_if_fail (SWFDEC_IS_TEXT_FIELD_MOVIE (object));
+  SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (data);
 
-  text = SWFDEC_TEXT_FIELD_MOVIE (object);
   swfdec_text_field_movie_set_text (text,
       swfdec_as_value_to_string (swfdec_gc_object_get_context (text), val), text->html);
 }
@@ -1049,10 +1046,9 @@ swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie *text,
   if (text->variable != NULL) {
     swfdec_text_field_movie_parse_listen_variable (text, text->variable,
 	&object, &name);
-    if (object != NULL && SWFDEC_IS_MOVIE (object)) {
+    if (object != NULL && object->movie) {
       swfdec_movie_remove_variable_listener (SWFDEC_MOVIE (object),
-	  SWFDEC_AS_OBJECT (text), name,
-	  swfdec_text_field_movie_variable_listener_callback);
+	  text, name, swfdec_text_field_movie_variable_listener_callback);
     }
   }
 
@@ -1077,10 +1073,9 @@ swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie *text,
       // FIXME: html value correct here?
       swfdec_text_field_movie_set_text (text, initial, text_field->html);
     }
-    if (object != NULL && SWFDEC_IS_MOVIE (object)) {
+    if (object != NULL && object->movie) {
       swfdec_movie_add_variable_listener (SWFDEC_MOVIE (object),
-	  SWFDEC_AS_OBJECT (text), name,
-	  swfdec_text_field_movie_variable_listener_callback);
+	  text, name, swfdec_text_field_movie_variable_listener_callback);
     }
   }
 }


More information about the Swfdec-commits mailing list