AS3: creating a class with multiple and optional parameters?

Posted by redconservatory on Stack Overflow See other posts from Stack Overflow or by redconservatory
Published on 2010-05-18T15:42:52Z Indexed on 2010/05/18 16:40 UTC
Read the original article Hit count: 244

Filed under:
|
|

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)?

© Stack Overflow or respective owner

Related posts about as3

Related posts about class