Static function in application

Hello,

Could anyone help me out a little bit? I’m trying to create a static function in my main.mxml which then i’d like to access from custom components. Is there anyone with experience that might suggest a solution?
What i have now is:


public static function showNextPage():void{
	ViewStack(Application.application.self.mainViewStack).selectedIndex++;
}

but then how do you call this code? you need to cast your application instance? cast it to what? etc…
i’d really appreciate if someone helped as i help others from time to time.

thanks,
Z