A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: what variable type is one that can be set multiple types of class?

  1. #1
    aidanmack.co.uk
    Join Date
    Dec 2001
    Location
    York, UK
    Posts
    400

    what variable type is one that can be set multiple types of class?

    Hi,
    I have a method that can set a variable to various types of class depending on the outcome of a if statement.

    But as its an unknown what class the variable will be set to before running the method I dont know what type I could set the variable too?


    This is my code....


    Actionscript Code:
    private var displayRender
            private function setdisplayRender() {
                if (recievedAddData.type == "swf") {
                    displayRender = new swfDisplay(null, troot, ssModel);
                }else if (recievedAddData.type == "img") {             
                    displayRender = new imgDisplay(null, troot, ssModel);
                }else if (recievedAddData.type == "flv") {             
                    displayRender = new videoDisplay(null, troot, ssModel);
                }
            }


    Basically what variable type Could I set displayRender to?


    Thanks
    Aidan

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Object
    [SIGPIC][/SIGPIC]

  3. #3
    Senior Member
    Join Date
    Jan 2011
    Posts
    171
    *



    arkitx

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Ideally, you would set its type as a superclass of all alternatives, or an interface that they all implement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center