On 2006-05-14, at 16:34 EDT, Philip Romanik wrote:
> (If I'm taking up too much bandwidth with these questions, please
> let me know.)
That's what this list is for!
> The variable $dataloaders is never initialized in LzDatasource.as.
> It is
> referenced without a 'this' prefix. Is this another example of a magic
> variable?
> LzDatasource.prototype.getNewLoader = function (proxied){
> if ( ! $dataloaders ){
> // SWF-specific
> _root.attachMovie("empty", "$dataloaders", 4242);
> var mc = $dataloaders;
> mc.dsnum = 1;
> }
$dataloaders is a global here. (The <movie>.attachMovie call will
create a property on the 'this' argument (_root in this case), so it
ends up defining _root.$dataloaders, which is equivalent to being a
global.
> While I'm on the subject, does the leading '$' of a variable name
> have any significance?
[From the ECMA spec:]
The dollar sign ($) and the
underscore (_) are permitted anywhere in an identifier. The dollar
sign is intended for use only in mechanically
generated code.
[So, this is not _really_ a correct use of $. I use $ prefix for
code the compiler generates (or inserts). We use _ prefix for
internal variables.]
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev