Hi, I’m trying to create a combobox inside a package and add it to the stage later on. However, I’m getting the following error when I try to click on the combobox:
Error #1009: Cannot access a property or method of a null object reference.
Here is the package for the combobox:
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.controls.*;
public class Combo extends MovieClip {
private var combo:ComboBox = new ComboBox();
public function Combo(dropData:XMLList) {
trace("dropData passed: " +dropData);
combo.width = 300;
combo.move(10, 10);
addChild(combo);
var i:uint;
var numItems:int = dropData.drop.length();
trace("numItems is: " + numItems);
for (i = 0; i < numItems; i++) {
var test = dropData.drop*.attribute("label");
combo.addItem({label:test});
}
}
}
}
And here is what I have on the stage:
var combo:Combo = new Combo(dropData);
addChild(combo);
Now, the component is inside my library, and it actually appears when I test the swf, but if I try to click on it, I’m getting the error mentioned above and here in detail:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.containers::BaseScrollPane/drawBackground()
at fl.controls::List/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::List/scrollToIndex()
at fl.controls::SelectableList/scrollToSelected()
at fl.controls::ComboBox/open()
at fl.controls::ComboBox/onToggleListVisibility()
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at fl.controls::ComboBox/close()
at fl.controls::ComboBox/focusOutHandler()
Thanks for your help,
Didi