AS3.0: How to extend a class that extends MovieClip  
Author Message
nimzorr





PostPosted: 2007-6-14 23:12:16 Top

flash-actionscript, AS3.0: How to extend a class that extends MovieClip When I try to set the base class of a library symbol to a class that doesn't
DIRECTLY extend MovieClip, but instead extends another class that DOES extend
MovieClip, it's disallowed, saying, "The class 'Whatever' must subclass
'flash.display.MovieClip' since it is linked..."

Is this just a validation bug in the property windows, only checking one class
deep into the inheritance hierarchy? Because the specified class does extend
MovieClip, just two levels in instead of one. Is there a fix for this? Or must
library symbols always directly extend MovieClip? If so, why?



 
kglad





PostPosted: 2007-6-14 23:18:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip if it's a movieclip, it must extend the MovieClip class.

what's there to fix?
 
nimzorr





PostPosted: 2007-6-14 23:28:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip Did you read my post at all?

ClassA extends MoveClip
ClassB extends Class A

Setting a library symbol's base class to ClassB results in the compile-time
complaint that ClassB must subclass MovieClip -- even though it DOES, since
ClassA does, and ClassB extends ClassA.

So what to fix is: that Flash mistakenly thinks ClassB doesn't subclass
MovieClip.

 
 
SymTsb





PostPosted: 2007-6-14 23:33:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip did you bother importing class A?
 
 
nimzorr





PostPosted: 2007-6-14 23:47:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip Yes, I "bothered" to import the base class. I also bothered not to misspell
"class" as "alijqaoeifrjaof," and a host of other newbie errors.

Honestly, why bother responding if you don't know the answer?

 
 
kglad





PostPosted: 2007-6-14 23:55:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip good luck.
 
 
SymTsb





PostPosted: 2007-6-14 23:59:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip Which classes from flash.display have you imported. Just because a class
extends another doesn't mean that it inherits all of its properties. Saying a
class extends sprite doesn't give you access to all of it's properties, members
and display unless you first import flash.display.* or flash.display.Sprite.
If you aren't already importing flash.display.*, try importing
flash.display.MovieClip and see what happens...

 
 
Raymond Basque





PostPosted: 2007-6-15 0:38:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip
Rubbish.


 
 
Raymond Basque





PostPosted: 2007-6-15 1:49:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip Just installed CS3 to check this -- the AS3 preview didn't have base class
linkage.

I managed to set a base class to com.mydomain.MovieClipEx2 (see below). So I
wonder what's different in what you did.


Class inheritance:

com.mydomain.MovieClipEx2 --> com.mydomain.MovieClipEx -->
flash.display.MovieClip --> ...blah,blah,blah




 
 
nimzorr





PostPosted: 2007-6-15 2:32:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip SymTsb's reply (importing flash.display.* in the subclass as well as the base
class) solved the problem. I didn't know that was necessary--in every other
language I know, inheritance alone does give full access to base class members,
and importing is only necessary if the file itself makes otherwise-unresolvable
type references.

Thanks SymTsb.

 
 
SymTsb





PostPosted: 2007-6-15 3:27:00 Top

flash-actionscript >> AS3.0: How to extend a class that extends MovieClip Yeah. This is just a limit of the language at this point. I would hope that
eventually, inheritance would make it to a level comparable to C# and Java.
Maybe a version down the road and the issue will be cleared.