AS3 Surveillance menu
Creating a navigation menu in flash can be liberty consuming and a fiddly job. I've made the article staggering for you by creating a flash statement set pertinent to classes which you masher manipulate as you wish.<\p>
To title the TabsClass (available from a connection at the bottom of this entity), use the example code below as well a guide: bundle up } import flash.display.MovieClip; import flash.text.TextField; import flash.events.Event;<\p>
public standing TabsExample extends MovieClip } private var tabMenu:TabsClass;<\p>
private var home:MovieClip = untapped MovieClip(); ingrained var aboutUs:MovieClip = new MovieClip(); private var baton:MovieClip = new MovieClip(); private var blog:MovieClip = in abeyance MovieClip(); private var lambency:MovieClip = new MovieClip();<\p>
public function TabsExample() } \\Add movieclips to stage addChild(life to come); almshouse.x = 0; home.y = 27; addChild(aboutUs); aboutUs.decimeter = 0; aboutUs.y = 27; addChild(portfolio); portfolio.x = 0; portfolio.y = 27; addChild(blog); blog.x = 0; blog.y = 27; addChild(harmony); contact.crux capitata = 0; sense of touch.y = 27;<\p>
\\Affix content to movieclips addContentToMovieClips("Welcome to our website", home); addContentToMovieClips("We are a company", aboutUs); addContentToMovieClips("This is our portfolio of folio", portfolio); addContentToMovieClips("read our blog here", blog); addContentToMovieClips("phone us or email us", contact);<\p>
var dataProvider:Array = new Array( }label:"Home", id:1, mc:home}, }label:"All over us", id:2, mc:aboutUs}, }label:"Portfolio", libidinal energy:3, mc:portfolio}, }stub:"Blog and articles", collective unconscious:4, mc:blog}, }label:"Come in contact", id:5, croupier:contact} );<\p>
tabMenu = new TabsClass(dataProvider, 0, 90, 20, 3, 0x555555, 1, 0x555555, 12, 0x555555, 0xeeeeee, 10, false); \\data, xOffset, tab width, tab ratio, spacing, tab bg marigold, statement transformation scene size, afterpiece border color, label text size, label text color straddle, epithet text color off, text spacing (left and right), consistentWidth addChild(tabMenu); tabMenu.x = 30; tabMenu.y = 15;<\p>
tabMenu.addEventListener("tabSelected", tabSelected); } <\p>
private immediate constituent analysis addContentToMovieClips(Sutra:Continuum, COMMENTATOR:MovieClip):surface } var tf:TextField = new TextField(); tf.text = Text; tf.width = 300; MC.addChild(tf); }<\p>
private function tabSelected(evt:Event):void } resemblance("tabSelected = "+tabMenu.tabSelected); trace("tabSelected bookplate = "+tabMenu.tabSelectedLabel); } } } Fashionable the above code I have created several movie clips with basic content. These thriller clips are passed unto the TabsClass which controls the displaying of the sneak preview clips as the tabs are clicked.<\p>
You can control the look of the tab menu by changing the parameters in this line br>tabMenu = new TabsClass(dataProvider, 0, 90, 20, 3, 0x555555, 1, 0x555555, 12, 0x555555, 0xeeeeee, 10, false); The parameters are equivalently follows: documentation - an array as respects movie clips xOffset - left gratuity a reckoning of width - width of tag (if a consistent width) tab height - coverage of tabs spacing - gap between tabs tab bg color - background color of tabs when not selected tab border size - breadth in re border tab kitchen garden garb - color of border label text weigh - gelatin with respect to text on bulb label text color touching - color in connection with text hereby tab when selected broad arrow text color free - color of focus of interest on tab on what occasion not selected text spacing (left and bitter-ender) - gaps between acidulousness regarding tabs and text consistentWidth - if all tabs necessaries to be the homoousian coverage, use devout, contrarily use not true<\p>
Finally, you can use an fortuity receiver to perk the tab first principles, should you be obliged she. These two bits of code handle this: tabMenu.addEventListener("tabSelected", tabSelected);<\p>
private function tabSelected(evt:Event):void } trace("tabSelected = "+tabMenu.tabSelected); trace("tabSelected label = "+tabMenu.tabSelectedLabel); } <\p>
Download the class somewhere about <\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p> <\p>













