OS 1.2 Changing the baselayer/whole map numZoomLevels after map and layer already instantiated/initialized/created via FLEX

10 views
Skip to first unread message

Mike C

unread,
Feb 9, 2012, 2:13:25 AM2/9/12
to openscales-dev
Hi guys!

Situation:

I have already created Flex Map instance via MXML and of course a
baselayer WMSC layer also via Flex MXML.

Problem:

I want to change the numZoomLevels of the baselayer/WMSC/map after
reading a config file.

In other words how do I change the numZoomLevels of the current map,
after already creating it with the default 18 zoomLevels via Flex
MXML?

When I try to directly set the numZoomLevels via AS it has no effect
on the map, and more specifically no effect on the PanZoomHandler, and
the WheelHandler. So it is as if nothing happened.

Do I need to somehow reset the map? Do I need to reinitialize the
wheel handler and the panzoom?

Anyone have experience with this specific problem?

-Mike

Mike C

unread,
Feb 9, 2012, 7:07:33 AM2/9/12
to openscales-dev
So far I have decided to not use the MXML tags to create the
baselayer. Instead I am doing it programmatically with AS
instantiating the FX components then adding them to the map. That way
I can specify the zoomLevels before it is created. So it's created
the first time with the correct zoomlevels.

However I have run across the problem of not being able to add the
FLEX PanZoom control to the map programmatically using the
map.addControl() function. It just doesn't work....However when I add
the older non FLEX version of PanZoom using the addControl() function
it works?

I ran into the same problem withe the FLEX WMSC layer but I used the
layer.getInstance() function to get a regular layer (non FLEX)
instance of the layer.
I looked and there doesn't seem to be a nice similar version for the
FLEX PanZoom control.

Looking deeper into the API, the new FLEX PanZoom control uses a
different parent class of the IControl interface which is also
different for the FLEX vs AS version of the control, blah blah, it
looks like I would have to dig pretty deep into the guts of the API to
fix the problem I am having, so....

I am looking at recustomizeing the old PanZoom control (AS only) and
using that but that will be a pain in the ass, and b/c it's AS only I
would have to toss my existing MXML component version of the PanZoom
control(FLEX).

Any suggestions out there?

-Mike
Reply all
Reply to author
Forward
0 new messages