Jitendra Madhav Ramchandani

November 19, 2008

Flash ComboBox misbehaves in child movie

THE ISSUE

The Flash ComboBox component behaves abruptly when instantiated in a movie which is loaded further inside another movie. In other words, when we use a ComboBox in a child movie and load it in a parent movie, it stops dropping down. (However, you can move between the values using your keyboard.)

THE CAUSE

This is happening because of the _root references given in the component code. When the component receives events it executes code which somewhere refers _root. The _root here actually refers the root of the component container, the child movie in this case. While, when the child movie runs inside a parent movie, the same _root reference refers to the root of the parent container.

This results in the misbehaviour.

THE SOLUTIONS

Solution 1
Make sure you add the ComboBox component in the parent movie, not necessary to display on screen but it should be present in the library.

But this solution may not always work.

Solution 2
Add the following code to you child movie:

this._lockroot=true;


This limits the scope of _root and the code in child movie considers _root as the local root instead of the root of the parent.


[Keywords: combobox misbehaves, comobobox component, flash, combox issue, child-parent movie issue, combobox doesn't works]