PDA

View Full Version : Problem with Combo Box Component


Girish_inf
08-30-2005, 11:04 PM
Hi,
Problem: The combo box does not dropdown when another movie is attached.

In my library I have the combobox control and a movie named "testMovie". Then I write this in frame 1.

import mx.controls.ComboBox;
var mc:MovieClip = this.attachMovie("testMovie","_mc", this.getNextHighestDepth());
var testBox:ComboBox = this.attachMovie("ComboBox", "test_cb", this.getNextHighestDepth());
testBox.addItem("ItemLabel","ItemData");

In this case the combo box does not dropdown. But if I remove "testMovie" it is droping down.

Any help on this?

Xeef
08-30-2005, 11:38 PM
Hmmmmm

seams to by a BUG

the drop down is there but it's behind the "testMovie"


//it trace by me 1048576 which is (as fare i know) outside of the range for depth !
trace(_root.getNextHighestDepth())
import mx.controls.ComboBox;

Billystyx
08-31-2005, 10:07 AM
not sure if I am understanding the problem, but in my experience, when working with movieclips and components, and using 'getNextHighestDepth' you need to use either swapDepths once you have added a component or a movieclip to a depth of your choice (I use 1000), or don't use getnexthighestDeoth in the first place.

components depth load below 0, and movieclips added after a component using getnexthighest depth will also load below 0 depth - causing many problems. (1 is that you can't remove them if they are in a sub-zero depth).
Also, I have a feeling AS2 doesn't allow a variable to be attributed directly to something like this line (something about strict typing I think...):
var mc:MovieClip = this.attachMovie("testMovie","_mc", this.getNextHighestDepth());
//rather do this:
this.attachMovie("testMovie","_mc", this.getNextHighestDepth());
var mc:MovieClip=this.testMovie;
//

but I thought that was only inside classes...


So I would suggest this:

import mx.controls.ComboBox;
dep=this.getNextHighestDepth();
this.attachMovie("testMovie","_mc", dep);
this.attachMovie("ComboBox", "test_cb", dep+1);
//and if that still loads behind...
this.text_cb.swapDepths(1000);
testBox.addItem("ItemLabel","ItemData");


All this is guessing mind you (no flash here), so please don't get upset if it doesn't work. Just thought I should try to help out:)

Good luck,

billystyx