Confused about referring to newly created objects

Hi All

I don’t fully understand the various alloc()'s init() for various objects. EG

set mainWindow to NSWindow's alloc()'s initWithContentRect_styleMask_backing_defer_(aRect, 0, 2, false)

will create a new window and i can refer to mainWindow for various tasks. But if i run the code again, I will get another window. I now have 2 windows, but there is only reference to mainWindow. I can refer to the windowNumber,
but my question is, am i supposed to give the mainWindow a unique name every time i create a new window i.e.

set mainWindow01 to NSWindow’s alloc()'s …
set mainWindow02 to NSWindow’s alloc()'s …

I have a project that requires 2 QTMovies to be initialized all the time, with a 3rd movie waiting to initialized. When that happens, i then dispose one of the 2 QTMovies. Unlike NSWindow objects, I can’t find a way to refer to unique id of the object.

Please tell me if i have totally missed the boat!

Regards

P

Think of it in AS terms:

tell application "Finder"
	set x to make new Finder window
	set x to make new Finder window
end tell

Obviously they need separate variables.