Skip to main content
May 10, 2010
Question

Question About Class Structure

  • May 10, 2010
  • 1 reply
  • 384 views

Okay, I'm new to AS3, so largely my first philosphy is,  "If it works, do it." However, my second is "Is this good practice?"

I've been building a portfolio site.

I've been using a real Composition-based method of webbing numerous external classes together by instance rather than Inheritance method of using extends. Reason being, simply because I've run into a bunch of unnecessary variable passing issues and the classes until now didn't have enough in common to troubleshoot it.

Well now I've run into the major content portion of the site (thumbnails etc.) and I've run intot the situation where I believe I might be using extends backwards.

I've got the SWFLoader class instancing the main Portfolio class that extends the Thumbnails class. Now typically my understanding is that you want subclasses extending from a superclass. Well, in this instance I want my Portfolio class to extend and take all the dynamic variables from the Thumbnails class even though the Thumbnails class is a subclass of Portfolio.

Is that alright? That is, to instance Class B in Class A and also extend Class B to Class C?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 10, 2010

it's alright if it suits your design.

May 10, 2010

Cool, was hoping that was the case.

Thanks!

kglad
Community Expert
Community Expert
May 10, 2010

you're welcome.