Link to home
Start Free TrialLog in
Avatar of MistahT
MistahT

asked on

Hyperlinks for Flash Combo Box Items

Hi Everybody,

I'd like to add hyperlinks to the items in my combo box in Flash CS4.
The combo box will act as a navigation to different websites.

Can anyone please explain to me how to do it?


This is the code so far:

function subList():void {
      cb1.addItem( { label: "INTRODUCTION" } );
      cb1.addItem( { label: "HISTORY" } );
      cb1.addItem( { label: "OBJECTIVES" } );
      cb1.addItem( { label: "PERFORMANCE" } );
      cb1.addItem( { label: "MANAGEMENT" } );
}


function subClick (event:MouseEvent):void {
      cb1.removeAll();
      subList();
}



cb1.addEventListener(MouseEvent.CLICK, subClick);




Thanks!
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MistahT
MistahT

ASKER

Hi blue-genie,

thanks so much for the quick reply! :)


I pasted your code, but receive the error:

1120: Access of undefined property urlRequest.
function subList():void {
	cb1.addItem( { label: "INTRODUCTION" } );
	cb1.addItem( { label: "HISTORY" } );
	cb1.addItem( { label: "OBJECTIVES" } );
	cb1.addItem( { label: "PERFORMANCE" } );
	cb1.addItem( { label: "MANAGEMENT" } );
	
}


function subClick (event:MouseEvent):void {
	cb1.removeAll();
	subList();
}



cb1.addEventListener(MouseEvent.CLICK, subClick);






cb1.addEventListener(Event.CHANGE, enterHandler);

function enterHandler(e:Event):void
{
	trace(e.currentTarget.selectedItem.label);
	gotoSite(e.currentTarget.selectedItem.label);

}




function gotoSite(str:String):void
{
	switch (str) {
		case "OBJECTIVES":
			urlRequest = new URLRequest("objectives.htm");
			navigateToURL(urlRequest);
			break;
		case "PERFORMANCE":
			urlRequest = new URLRequest("performance.htm");
			navigateToURL(urlRequest);
			break;
	}
}

Open in new window

i take it you figured out you need to import the URLRequest class?