- Add a 'combobox' component and call the instance 'vid_ccb'
- Add a 'label' call it 'selVid_txt'
- Add a 'List' call it 'vList'
- Add 'label' call it 'selVidLs_txt'
- Add a number stepper, call it 'nStep'
- Add 'label' call it 'nstep_txt'
- add a 'window' call it 'vWin'

Next, create 2 smily faces (size it to 10x10 pixel) as the list uses icons, so u need to make 2 MC of smily faces, and ensure under linkage properties, its like this. Note i have 2 smily faces for first one the linkage identifier is 'icon_sm1' and second one is 'icon_sm2'

Next is the Codes. Copy and paste the actionscript to a new layer. code is simple, easy for your to figure out..(btw, im actually trying to make a video player with a playlist, work in progress)
//combo box setup
_root.vid_ccb.addItem("video 1", 1);
_root.vid_ccb.addItem("video 2", 2);
vid_ccb.dataProvider = [{label:"video 1", data:1}, {label:"video 2", data:2}, {label:"video 3", data:3}];
var oListener:Object = new Object();
oListener.change = function(oEvent:Object):Void {
if (oEvent.target._name == "vid_ccb") {
selectVidItem = vid_ccb.selectedItem.label;
_root.selVid_txt.text = selectVidItem;
}
if (oEvent.target._name == "vList") {
selectLsItem = vList.selectedItem.label;
_root.selVidLs_txt.text = selectLsItem ;
vWin.visible = true
vWin.title = selectLsItem
}
if (oEvent.target._name == "nStep") {
nstep_txt.text = nStep.value
}
};
oListener.click = function(oEvent:Object):Void {
if (oEvent.target._name == "vWin") {
oEvent.target.visible = false
}
}
_root.vid_ccb.addEventListener("change", oListener);
_root.selVid_txt.autoSize = true;
vList.dataProvider = [{label:"video 1", data:1, icon: "icon_sm1"},
{label:"video 2", data:2, icon: "icon_sm2"},
{label:"video 3", data:3, icon: "icon_sm2"},
{label:"video 4", data:4, icon: "icon_sm1"},
{label:"video 5", data:5, icon: "icon_sm1"},
{label:"video 6", data:6, icon: "icon_sm2"},
{label:"video 7", data:7, icon: "icon_sm1"}
];
vList.addEventListener("change", oListener);
vList.iconField ="icon";
vList.multipleSelection = true; //to allow multiple selection via ctrl btn
_root.nStep.minimum = 0
_root.nStep.maximum = 100
_root.nStep.stepSize = 10
nStep.addEventListener("change", oListener);
vWin.visible = false
vWin.closeButton = true
vWin.addEventListener("click", oListener);
No comments:
Post a Comment