How to define interface method with diffferent arguments in AS3?

I'm trying to define interface in which one method (initPage) needs to have different arguments in every implementation. How can I do this? Using ...args for me is not good, because I'm loosing strong type checking.

public interface IPage {
    function initPage(...args):void;
    function showPage():void;
    function hidePage():void;
    function removePage():void;
}

Answers


You know you can implements more than one Interface?

I think you should maintain your actual Interface, minus the "problematic" method, and create another Interfaces, each one with a different method

public interface IPage 
{      
    function showPage():void;
    function hidePage():void;
    function removePage():void;
}

public interface IPrettyPage
{
    function initPage(p:PrettyArg);
}

public interface IUglyPage
{
    function initPage(u:UglyArg);
}


// your implementation Class
package 
{
    public class Page extends Sprite implements IPage, IPrettyPage
    {
        // Implementation
    }
}

Anyway, here's an example with another good idea, BUT is a Java code: http://www.java2s.com/Code/Java/Language-Basics/Implementmultipleinterfaces.htm

I didn't tested, but I'm almost sure this issue is different in AS3.


Need Your Help

Can I lazy-load my libraries so they don't delay my app startup?

iphone performance startup

My app takes a long period of time during the startup, while the splash screen is shown. I assume that It is so due to the size of what the iOS has to load, including libraries. My question is, can I

Is it possible to have a Master ViewPage bound to a different object than the child viewpage?

c# asp.net asp.net-mvc-2

I wanted to do this because i wanted to have a master page bound to a strongly typed model, so that it can contain all of the Model Data that i will need for each page. But then I also need each