PDA

View Full Version : ComboBox


sai1sg
09-12-2006, 05:00 PM
Hi all,

Im facing problem with linking my comboBox to open a URL link using Flash 8. Previously, Im able to do it with Flash 6, but when I export using Flash 8, it fails.

I imported the AS to the comboBox element in Flash 8, the selection is there, but when I select it, it won't bring me to the link in the internet browser. I have uploaded it for your reference.

Any suggestions to where I have gone wrong or web URLs I can read up more on this comboBox would be very much appreciated. Thanks a million.

EdKav1
09-12-2006, 05:30 PM
The comboBox has changed since flash 6. It uses event listeners instead of change handlers (look in the help file; there is a good description there). Also, Actionscript 2 is case sensitive. To fix the FLA you attached change the code on the last frame to something like:


var ComboSites = sitestext.Sites.split(",");
var ComboURLs = sitestext.URLs.split(",");
trace(ComboURLs);
CBOLoadSites.addItem("-- select site --");
for (i=0; i < ComboSites.length;i++) {
CBOLoadSites.addItem(ComboSites[i],ComboURLs[i]);
}

//Here is how you detect changes in the selection

var listenObj:Object = new Object();
listenObj.change = function(evtObj:Object):Void{
var SiteURL = evtObj.target.selectedItem.data;
trace("SiteURL is: " + SiteURL);
if(SiteURL != undefined) getURL(SiteURL, "_blank");
}
CBOLoadSites.addEventListener("change",listenObj);

stop();




Best of luck.

Ed