Yeah, this is one of the places where something nonobvious happens.
SwfdecPlayer unsets the current global object unless it is actually
executing code. This is because multiple global objects can exist at
the same time due to the Flash security model (feel free to google it
up, I'm not gonna get into details).
The internal Swfdec code uses the functions
swfdec_sandbox_use()/swfdec_sandbox_unuse(), but they are not exported
as public API.
So I don't think there's any chance for a user of the public API to
modify the state of the Flash player currently. Certainly the
SwfdecAsContext APIs don't work.
Benjamin
On Tue, Feb 9, 2010 at 12:51 AM, Paul Brooker <paul at thefunnyfish.net>
wrote:> Hi, another quick question,
>
> Im trying to set a variable within the flash movie at runtime. Im trying to
set the variable triggered by fscommand, the code im using so far is...
>
> static void
> do_fscommand (SwfdecPlayer *player, const char *command, const char *value)
> {
> ? SwfdecAsValue val;
> ? SwfdecAsContext *context;
>
> ? if (g_str_equal (command, "test")) {
> ? ? context = SWFDEC_AS_CONTEXT (player);
> ? ? SWFDEC_AS_VALUE_SET_STRING (&val, "success!");
> ? ? swfdec_as_object_set_variable (context->global,
swfdec_as_context_get_string (context, "teststring"), &val);
> ? }
> }
>
> Firstly, im not sure if this is the correct approach, but more importantly
it fails because there appears to be no global object. Ive tested that the
> context is in a running state which it is, plus ive tried sticking similar
code in swfdec_as_context_startup which works ok, so i know context->global
> is valid at this point. Im guessing theres something fundamental im not
understanding!
>
> Im hoping someone can help shed some light :)
> Thanx, Paul
> _______________________________________________
> Swfdec mailing list
> Swfdec at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/swfdec
>