Jump to content


LOGGED:Class Definition Order Confusion


4 replies to this topic

#1 s02

    Advanced Member

  • Members
  • PipPipPip
  • 3161 posts
  • Gender:Male
  • Location:Germany

Posted 08 December 2009 - 10:18 PM

Please see the attached SWI, it contains two classes (A and B) defined in two separate movie clips. Class B extends class A, and class A extends MovieClip.

In the current release build 2009.09.04, the movie clip containing class B must appear before the one containing class A (in the outline), when changing the movie clip order you'll see that it will trace "false" since class B no longer extends class A.

In the current pre-release build 2009.11.30 the order doesn't make any difference, it works no matter which clip appears first in the outline... until you start using the import statement! When using import the order again makes a difference, but this time the base class must appear first as opposed to the 2009.09.04 build where it's the other way around. Change class B as follows to see the difference:

import foo.bar.what.ever.A;

class foo.bar.what.ever.B extends A
{
	public function B()
	{
		super();

		trace(this instanceof A);
	}
}

So now i'm a bit confused. Which is the correct behaviour? And might it change again in the future?

Best
Oliver

Attached Files


www | esb

#2 Roger Onslow

    Advanced Member

  • staff Moderator
  • PipPipPip
  • 11114 posts

Posted 09 December 2009 - 12:45 PM

The correct expected behavior is the Max3 doesn't care what order class definitions are in .. there was a bug in earlier max3 that the order did matter, but I fixed that. Obviously if you have base classes before derived classes in your SWI, then that would work regardless.

I'm not sure what is going on with imports - I'll have a look at your example when I can, and see what's going on there.
Roger the RED - SWiSH developer

#3 Roger Onslow

    Advanced Member

  • staff Moderator
  • PipPipPip
  • 11114 posts

Posted 09 December 2009 - 12:49 PM

Note: this does work ok
class foo.bar.what.ever.B extends foo.bar.what.ever.A
{
	public function B()
	{
		import foo.bar.what.ever.A;
		
		super();

		trace(this instanceof A);
	}
}

Roger the RED - SWiSH developer

#4 HughB

    COO

  • Admin
  • PipPipPip
  • 3970 posts

Posted 20 January 2010 - 01:46 PM

This has been logged as a bug, thank you for reporting it! - Call No. 204911

Cheers!
http://blog.swishzone.com/ ...for cool tutorials, samples and new components

#5 s02

    Advanced Member

  • Members
  • PipPipPip
  • 3161 posts
  • Gender:Male
  • Location:Germany

Posted 06 October 2010 - 03:19 AM

Just wondering if there is any progress. Even after 10 months i'm still struggeling with moving clips and/or include statements around... it's still a big pain in the you know what :/

Best
Oliver
www | esb





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users