all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

bug in #include with AS 2.0


bug in #include with AS 2.0 ggigante
11/26/2004 10:54:03 PM
flash actionscript:
steps to reproduce:
start with an empty flash movie. in its first frame put:

#include "foo.as"

and in the text file "foo.as", write:

var foo:Array = new Array();
foo["bar"] = 1;

you get this error:
ActionScript 2.0 class scripts may only define class or interface constructs.

but this happens ONLY if both the file and the associative array have the same
name. It does not happen with numbered array elements, nor if the array has any
other name.
It seems that flash thinks that a named array element inside a file of the
same name looks very suspicious... even if it is perfectly legal.
But to me, it looks like a bug.

Giovanni Gigante
Re: bug in #include with AS 2.0 Fruber Malcome
11/28/2004 7:33:26 AM
Interesting, I guess that ties to the rule that a class name must match the
file name, I guess it was thinking you made a mistake, so it caught it. (it
thought you were trying to use a class instead of seperated code.)

good catch. - Fortunately I've never called a file something close to a
variable that I use. I also wonder if this is true in any scenario where that
variable is used within that .as file. (e.g. maybe near the end after a few
hundred lines of code.)

It may only be looking at the first few lines..
thanks - Fruber.

RE: bug in #include with AS 2.0 Trillian
5/5/2005 12:00:00 AM
The associative array thing is beacause they are considered as an object and u cand instanciate an object that has the same name than the filename, i think its a bug too!

exemple

hello = new Object(); //doesnt work
same for new array

I got fuked up but u got the point, THANKS FOR THIS POST, SAVED ME!

From http://www.developmentnow.com/g/69_2004_11_0_0_352263/bug-in-include-with-AS-2-0.htm

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button