Should I be able to add an event listener to a child of a Repeater
class and receive keyboard events?  I'm trying this and it doesn't
seem to be working.  Specifically, I have the following MXML:

 <mx:Canvas width="100%" height="100%" id="browserCanvas"
horizontalScrollPolicy="off" verticalScrollPolicy="off">

        <mx:Repeater id="menuPageRepeater" dataProvider="{menuPageArray}">
            <mx:VBox id="menuPages" styleName="menuPage" width="100%"
height="100%" visible="false">
                ... other stuff ..
            </mx:VBox>
        </mx:Repeater>

</mx:Canvas>

Elsewhere, "menuPageArray" is defined as a [Bindable] array, and it
correctly creates a number of overlapping pages, all of which are
initially invisible.  In my "applicationComplete" function I set the
first of the pages to be visible, and register to receive keyboard events:

menuPages[0].visible = true;
menuPages[0].addEventListener( "keyDown", onKeyDown );

However, onKeyDown doesn't seem to ever get called.

At first I thought "Maybe it's because menuPages[0] is at the bottom
of the canvas and some other invisible page is getting the keyboard
events", but that doesn't seem to be the case -- even if I make the
last page visible and add a listener to it, the same result (no events).

Then I was thinking "Maybe the <mx:Canvas> is eating and suppressing
all the keyboard events from bubbling up", but that doesn't seem to be
the case because I can add a listener to the "stage" and it gets the
events just fine.

So now I'm wondering if it has something to do with the fact that the
node is being created by a <mx:Repeater>?

Basically, do you see anything obvious (to you) that I'm doing wrong
-- possibly involving repeaters -- or have any tips for how to capture
keyboard events on a repeated node?

Thanks!

-david

Reply via email to