Can't drag map inside nested Box VBox
I'm pretty new to flex, and i'm trying to use Modest Maps. Unfortunatly when i try to use the control in my code, i cannot drag the map. Here is an example of the code. The First map object works (i can drag it) The second map object will not drag. Maybe i'm doing something wrong.
<?xml version="1.0" encoding="utf-8"?>
<mx:canvas height="674" width="1000">
<mx:box height="100%" width="100%">
<mx:vbox height="100%" width="475">
<panels:mappanel height="300" width="300">
</panels:mappanel></mx:vbox>
<mx:vbox height="100%" width="475">
<panels:mappanel height="300" width="300">
</panels:mappanel></mx:vbox>
</mx:box>
</mx:canvas>
Sorry, i don't know how to do a code block on here, so some stuff like ID's are missing from the code.
I'm using Flex 2
Thanks in advance.
--Jay
<?xml version="1.0" encoding="utf-8"?>
<mx:canvas height="674" width="1000">
<mx:box height="100%" width="100%">
<mx:vbox height="100%" width="475">
<panels:mappanel height="300" width="300">
</panels:mappanel></mx:vbox>
<mx:vbox height="100%" width="475">
<panels:mappanel height="300" width="300">
</panels:mappanel></mx:vbox>
</mx:box>
</mx:canvas>
Sorry, i don't know how to do a code block on here, so some stuff like ID's are missing from the code.
I'm using Flex 2
Thanks in advance.
--Jay
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?Actually, now that i've messed around with it, i noticed that if it's anywhere except for the top left corner, it doesn't work. Any solutions to this?
-
Inappropriate?I've experienced the same issue. It appears that the amount of the map's x position is being subtracted from the right side of the map (the same is true with the y position being subtracted from the bottom of the map). In other words, the map's draggable area has been reduced by the amount the map has been offset from the 0,0 coordinate.
This is even true in the examples. Even though the map is left and top aligned, there is still a 10-15 pixel border on the left and top - thus resulting in 10-15 pixels of non-draggable area on the right and bottom of the map.
I'm just as baffled at this and am searching for some guidance.
-
Inappropriate?Found a solution to the problem.
In your TileGrid.as class, at line 229 is a method called buildMask.
The code should be altered to look like the following:
protected function buildMask():void
{
_mask = new Sprite();
//_mask.name = 'mask'; // not necessary to unremark, but not needed either.
// as3 masks need to be child, so add the mask to the grid not the well
// because well children are all tiles
//addChild(_mask); // remark this out
//this.mask = _mask; // remark this out
//Alert.show(String(Stage.getChildByName("panMap")),"hi");
}
You still want _mask to be assigned to a new Sprite, but you don't want it to be added. This extends the mask to the correct boundaries of your map, thus allowing the entire map to be draggable and no longer reliant to the upper left position.
Not sure it's the best way to fix it, but it does solve the issue.
1 person says
this answers the question
-
Inappropriate?THanks! I really appreciate the help.
Hopefully i'll have time later this week to give it a try! I'll let you know how it goes.
Loading Profile...



