AS3: creating a class with multiple and optional parameters?
- by redconservatory
I'm creating a slideshow where each slide can have:
- a video or a still
- 1 audio track or many (up to 3)
- 1 button or many (up to 3)
I was thinking that each slide can be it's own object, and then I would pass the video, audio, buttons, etc., into it as parameters:
package
{
import flash.media.Video;
public class Section
{
public function Section (video:Video, still:myPhotoClass, audiotrack:Sound, button:myButtonClass) {
// can have video OR a still
// can have 1 audio track or several
// can have 1 button or more
}
}
I'm not sure how to go about approaching this since there can be multiples of certain items (audio, buttons) and also two items are sort-of-optional in the sense that there can be ONE or the OTHER (video/still).
For example, is this something that I should just avoid passing as parameters altogether, using a different approach (getters/setters, maybe)?