这是我在www.riacn.com论坛上看到的一个关于TabBar的例子,原文地址:
http://www.riacn.com/bbs/showthread.asp?threadid=1857
V2 TabBar - simple example
V2 TabBar - simple example
Heres a simple example of using the V2 TabBar (version 1.0.1) in Flash.
1. Add a TabBar and Loader to the Library.
2. Add this code (frame 1 of Timeline):
var tabListener:Object = new Object();
tabListener.change = function(evt:Object) {
content_ldr.load(evt.target.value);
};
this.createClassObject(mx.controls.TabBar, "myTabBar", this.getNextHighestDepth());
myTabBar.addEventListener("change", tabListener); myTabBar.setSize(550, 30);
myTabBar.addItem({label:"Home", data:"http://www.flash-mx.com/images/image1.jpg";});
myTabBar.addItem({label:"News", data:"http://www.flash-mx.com/images/image2.jpg";});
this.createClassObject(mx.controls.Loader, "content_ldr",
this.getNextHighestDepth(), {_x:0, _y:30, _width:550, _height:370});
3. Ctrl+Enter.
If you bought DRK5 which includes the original version of this component, you can update to the V2 version for free. For more information, visit this link.
V2版TabBar可以在我的网站下载,访问页面: