whenever we started to make a game first thing we need is Main menu, its our first screen and we have to make it user friendly, so that user find very easy how to play the game. when we have more than one stage in our game we need a menu so that user can scroll and select the desired stage. so here the starling framework in flash provides the facility through which we can easily make our menu
In starling ScrollContainer is a class we just have to instantiate it and the use some methods and then our menu will work like a smooth scrolled menu. the code for scrolled menu is below.
(Just embed starling folder in your project)
1- First we need a layout on which we have to show our menu icons, so we set the layout and also tell that which type of layout we needed, either horizontal or vertical. so addLayout() method will do that part.
Here we have taken horizontal layout.
2- Now we will make a container object of scroll container class, set the properties like its width ,height and layout etc. Here pagesprite is a sprite on which we have added our menu icon simply by addchild on it. Now we have a stack here _layout-->_container-->_pagesprite-->menuIcons.
basically this is a pattern for placing these items.
3- Now the Question arises how the menu will swipe, so no worries, if you drag on the screen if will get the effect.