MapControls Issue
I declare a MapControls object for my map object.
<modest:mapcomponent>
private function ccHandler(...):void{
...
navButtons = new MapControls(_map, true, false);
}
MapControl.onAddToStage function doesn't run. So I can't control keyboard event. And When I click the Map pop up a error window indicating the stage is null.
Why ?</modest:mapcomponent>
<modest:mapcomponent>
private function ccHandler(...):void{
...
navButtons = new MapControls(_map, true, false);
}
MapControl.onAddToStage function doesn't run. So I can't control keyboard event. And When I click the Map pop up a error window indicating the stage is null.
Why ?</modest:mapcomponent>
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?You need to add the map controls to the stage. Normally it would be a child of the map object:
map.addChild(navButtons);
This will trigger Event.ADDED_TO_STAGE which will call MapControls.onAddToStage. -
Inappropriate?Yes, that works. But I don't wanna show the buttons of the MapControl. Just need the handle keyboard ability. How should I do ?
I didn't add MapControls object to the map object.
<modest:mapcomponent>
private function ccHandler(...):void{
...
navButtons = new MapControls(_map, true, false);
map.addEventListener(KeyboardEvent.KEY_DOWN, keyboardHandler);
}
private function keyboardhandler(e:keyboradevent):void{
/* not executing */
...
...
}
why ?
</modest:mapcomponent> -
Inappropriate?Copy MapControls and delete everything except the keyboard part. It's open source for a reason :)
Loading Profile...



EMPLOYEE