# Static function in application

**URL:** <https://forum.kirupa.com/t/static-function-in-application/275756>\
**Category:** Uncategorized\
**Created:** [November 18, 2008, 12:56pm UTC](https://forum.kirupa.com/t/static-function-in-application/275756 "2008-11-18T12:56:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pallzoltan](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@pallzoltan](https://forum.kirupa.com/u/pallzoltan)\
**Post date:** [November 18, 2008, 12:56pm UTC](https://forum.kirupa.com/t/static-function-in-application/275756/1 "2008-11-18T12:56:22Z")

</div>

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:

```auto

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
