[Swfdec] AS context->global not an object problem

Paul Brooker paul at thefunnyfish.net
Tue Feb 9 10:15:08 PST 2010


Hi Benjamin,

Thanks for your reply. Ok, so im guessing im not going about it the right way. I plan to use swfdec as a user interface for an embedded arm device so 
im not really using it in its conventional manner.  Can you suggest a way to set variables using the public API? Maybe by creating a new buffer/stream 
which i assume is how loadVariables works... or maybe theres some mechanism in place for when the player is used as a plugin to enable SetVariable via 
javascript? Ive had a quick look through swfdec-mozilla but nothing jumped out at me.

Cheers, Paul

Benjamin Otte wrote:
> 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
>>
> 



More information about the Swfdec mailing list