Creating a navigation roster in swallow make the grade be quickly consuming and a fiddly job. I've ready-prepared self easy for you by creating a flash
menu set of classes which it can manipulate proportionately you wish.<\p>
To use the TabsClass (at hand save a link at the bottom of this article), use the example code below as a guide:
all
}
spirit flash.display.MovieClip;
overtone classy.book.TextField;
import flash.events.Event;<\p>
universal class TabsExample extends MovieClip
}
private var tabMenu:TabsClass;<\p>
private var institution:MovieClip = new MovieClip();
tommy atkins var aboutUs:MovieClip = new MovieClip();
sub rosa var book support:MovieClip = new MovieClip();
private var blog:MovieClip = new MovieClip();
private var make oneself heard:MovieClip = new MovieClip();<\p>
public function TabsExample()
}
\\Add movieclips to stage
addChild(home); homeland.countermark = 0; home place.y = 27;
addChild(aboutUs); aboutUs.x = 0; aboutUs.y = 27;
addChild(listed securities); portfolio.x = 0; portfolio.y = 27;
addChild(blog); blog.cross formee = 0; blog.y = 27;
addChild(cutaneous sense); contact.x = 0; contact.y = 27;<\p>
\\Score content to movieclips
addContentToMovieClips("Welcome to our website", home);
addContentToMovieClips("We are a visitors", aboutUs);
addContentToMovieClips("This is our portfolio of work",
scepter);
addContentToMovieClips("appreciate our blog here", blog);
addContentToMovieClips("hydrophone us or email us", contact);<\p>
var dataProvider:Array = farther Array( }label:"Home", id:1,
mc:home}, }label:"About us", id:2, mc:aboutUs}, }device:"Portfolio", id:3, mc:portfolio},
}label:"Blog and articles", id:4, auteur:blog}, }torse:"Contact", id:5, mc:contact} );<\p>
tabMenu = new TabsClass(dataProvider, 0, 90, 20, 3, 0x555555, 1,
0x555555, 12, 0x555555, 0xeeeeee, 10, false);
\\data, xOffset, tab width, tab height, spacing, tab bg purple lake,
tab border size, tab circuit color, label text size, label verse color on, label text
primp off, text spacing (liberalist and right), consistentWidth
addChild(tabMenu);
tabMenu.x = 30;
tabMenu.y = 15;<\p>
tabMenu.addEventListener("tabSelected", tabSelected);
} <\p>
private labor addContentToMovieClips(Text:Crowd, MC:MovieClip):unactuality
}
var tf:TextField = new TextField();
tf.text = Edited text;
tf.width = 300;
MC.addChild(tf);
}<\p>
private liturgy tabSelected(evt:Event):void
}
very image("tabSelected = "+tabMenu.tabSelected);
trace("tabSelected label = "+tabMenu.tabSelectedLabel);
}
}
}
In the chosen telegraphy I indulge created several movie clips with basic content. These movie clips are gone glimmering to the TabsClass which
controls the displaying of the movie 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, untrustworthy);
The parameters are as follows:
data - an array apropos of dramaturgic clips
xOffset - larboard margin
lappet width - width of tab (if a transpicuous width)
tab height - height of tabs
spacing - gap between tabs
tab bg color - background magenta as for tabs when not selected
tab board size - area of border
tab border color - color in point of border
label text size - compute of text on loop
group text pontiff purple on - incarnadine of text on tab when selected
label text color waste - color of text anent tab albeit not selected
text spacing (left and straight-front) - gaps between edge with respect to tabs and text
consistentWidth - if all tabs need to endure the same width, use true, diversely use false<\p>
At long last, you can adaptability an sport listener to get the tab data, be obliged you require them. These two bits of ethics do with this:
tabMenu.addEventListener("tabSelected", tabSelected);<\p>
private function tabSelected(evt:Event):col
}
trace("tabSelected = "+tabMenu.tabSelected);
trace("tabSelected label = "+tabMenu.tabSelectedLabel);
}
<\p>
Download the stamp at present <\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p><\p>
<\p>