Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combobox behavior question...

Status
Not open for further replies.

michanagel

Technical User
Jun 23, 2007
34
US
Hi,

I designed my own combobox here since I didn't like the look of the combobox that ships with Flash and skinning didn't really work for me as well... ;)

Now, everything works fine but there's one behavior that the original component combobox has that I can't seem to set up for my duplicate.

It is when u pressed the scroll down button and the combobox shows the option menue and you then press outside of the combobox (just somewhere else on the screen) that the combobox rolls back up.

I can't seem to get this going for my own duplicate. What I tried:

1. made an invisible button (as bis as my combobox) and applied action script on(releaseOutside)... - did not work

2. applied the same action script simply on the movieclip that my combobox duplicate is and it didn't work as well...

It's probably because I work with a few invisible buttons inside the combobox and they have action script applied and that probably interferes with the one on the big invisible button....

The only thing I need to know is how to check if there was a click outside the combobox.

Any suggestions ?

As always thanx for your help in advance !!!

Mike
 
On click on stage hide the drop-down. But you have to set the Boolean to true/false on roll over/out on the combo box/drop-down, and hide it only when the mouse is not on the combo box/drop-down.

Kenneth Kawamoto
 
Kenneth,

thanx for the answer - makes perfectly sense to me, gonna set a flag for the rollover/out state of the dropdown...

But how do I specify (in code) 'on click on stage' ?

Thanx again for your help !

Mike
 
In AS3 it would be:
Code:
this.stage.addEventListener(MouseEvent.CLICK, hideDropdown);

function hideDropdown(evt:Event):void {
	if (!comboBoxIsActive) {
		mcDropdown.alpha = 0;
	}
}
AS2 I think you can just do: this.onPress - "this" being the Stage.

Kenneth Kawamoto
 
Kenneth,

tried it, but it doesn't work...

Here's the AS2 code I placed on an action script layer above the combobox layer:

this.onRelease = function(){
if(_root.cb == 1){
cb_1.gotoAndPlay("s3");
}
}

Explanation:

1. _root.cb = 1 is the flag for the dropddown menu being rolled down

2. cb_1 is the instance name of my combobox

The combobox, the action script layer (I placed the code in) & several other items are not on the main timeline, they're nested in a separate movieclip (which is nested in another movieclip).

With that action script placed on that nested action script layer all the buttons in that movieclip don't work anymore and even on any click away from any buttons (but still over that huge movieclip that has those items nested inside) nothing happens (although it should gotoAndPlay "s3"...

Will play around with it a little bit, if you have any ideas please let me know ! ;)

Thanx again for your help !

Mike


 
Kenneth,

which MovieClip do I need to target properly ?

The combobox or the 'stage' ?

As stated before the combobox is nested inside a movieclip which is nested in another movieclip, but the action script layer with code discussed is in the same movieclip as the combobox is and the path to the combobox is correct...

Do I need to place that action script on the _root ?

Still a little bit confused how to specify the 'stage' because theere are so many other objects placed on the stage as well...

Don't know if they would interfere with the function...

Thanx for your help !

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top