flash actionscript:
I defined the following 2 classes in .as files, and saved each under the same
name as its class, in the same folder. class ClassOne { var prop:ClassTwo;
var name:String = 'ClassOne'; function ClassOne() { } } class ClassTwo {
var prop:ClassOne; var name:String = 'ClassTwo'; function ClassTwo() { } }
When I click the Check Syntax button for ClassOne, I get the following error
message: **Error** C:\flash stuff\ClassOne.as: Line 1: The name of this class,
'ClassOne', conflicts with the name of another class that was loaded,
'ClassOne'. class ClassOne { And similarly for ClassTwo. However, I
saved the following ActionScript in a .fla file in the same folder: var
myClassOne:ClassOne = new ClassOne(); var myClassTwo:ClassTwo = new ClassTwo();
trace(myClassOne.prop); trace(myClassTwo.prop); myClassOne.prop = myClassTwo;
myClassTwo.prop = myClassOne; trace(myClassOne.prop); trace(myClassTwo.prop);
trace('Should be ClassTwo: '+myClassOne.prop.name); trace('Should be ClassOne:
'+myClassTwo.prop.name); The syntax checker found no errors, and Publish
Preview produced the expected outputs: undefined undefined [object Object]
[object Object] Should be ClassTwo: ClassTwo Should be ClassOne: ClassOne In
fact, afterwards the syntax check no longer found any errors for the .as files.
Deleting and retyping the 'v' in var on the first line of one of the class
definitions was enough to get the error messages again. Clearly, this
shouldn't happen. Is this a widely-known problem with the syntax checker?
Should I pass this on to Macromedia? Or is there some reason I should not
define classes which have each other as members, even though the .fla files
seems to run fine?