[Swfdec] variable scope

Nguyen Thai Ngoc Duy pclouds at gmail.com
Mon Jun 11 06:03:51 PDT 2007


On 6/11/07, Benjamin Otte <otte at gnome.org> wrote:
> Now, all this code is only relevant for getting variables. When
> setting variables that are not defined yet (where not defined means
> not in the scope not including the global object), it depends on if
> the variable is set via DefineLocal or SetVariable. I've never really
> checked this, but I think SetVariable sets on the current target and
> DefineLocal sets on the current target unless in a user-defined
> function, where it sets in the current function's frame.

I have a feeling that SetVariable always sets undefined variables on
the current frame (cx->frame->var_object).

>
> So, after telling you all of this, I'd like to note that this is oly
> how Swfdec works, but I have no clue if it's correct. So if you manage
> to create an SWF (like the one you just posted) where this doesn't
> work, we have to fix Swfdec. And probably rewrite all the knowledge I
> just posted above...

Got an article here [1]. There are differences between flash 5 and
flash mx (flash 6?) in the way new variables are created. So I guess
everything works fine (for flash 5). I just hit the edge because I
played with a flash 6 script. There is a sentence "Because Flash looks
for a variable called myVar in the timeline of the movie clip,..." in
the article. What variable in swfdec is "timeline of the movie clip"?

[1] http://www.kirupa.com/developer/actionscript/tricks/scope.htm

>
> Cheers,
> Benjamin,
> who sometimes feels like the Winston Smith of Flash
>
-- 
Duy


More information about the Swfdec mailing list