openscales的CustomMarker的问题,bug??

openscales2.2的CustomMarker.createUrlBasedMarker直接报错,使用CustomMarker.createDisplayObjectMarker只能map1.addElement(s);       一次,第二次就报错,彻底晕了,暂时记下,看有无更好解决方法:


这个是CustomMarker.createDisplayObjectMarker添加一个元素可以看到效果的:

                //添加已知图像

                var _markerlayer:VectorLayer =_map.getLayerByIdentifier("worklayer") as VectorLayer;
                if(_markerlayer==null){Alert.show("没有找到目标图层");return;}
                //
                var s:spark.components.Image=new spark.components.Image();
                //s.source="http://localhost:8080/dbserver/6_1.png";
                s.source="assets/2_24x24.png";
                map1.addElement(s);                
                //
                var lox:Location=new Location(114.156915973307,35.726901271851,_map.projection);
                var marker:CustomMarker=CustomMarker.createDisplayObjectMarker(s,lox);
                _markerlayer.addFeature(marker);

                _markerlayer.redraw(true);


这是2个feature也可以看到效果的:

                //添加已知图像
                var _markerlayer:VectorLayer =_map.getLayerByIdentifier("worklayer") as VectorLayer;
                if(_markerlayer==null){Alert.show("没有找到目标图层");return;}
                //
                var s:spark.components.Image=new spark.components.Image();
                //s.source="http://localhost:8080/dbserver/6_1.png";
                s.source="assets/2_24x24.png";
                //map1.addElement(s);                

                
                var lox:Location=new Location(114.156915973307,35.726901271851,_map.projection);
                var marker:CustomMarker=CustomMarker.createDisplayObjectMarker(s,lox);
                _markerlayer.addFeature(marker);
                //
                //
                var xx1:spark.components.Image=new spark.components.Image();
                //s.source="http://localhost:8080/dbserver/6_1.png";
                xx1.source="assets/2_24x24.png";
                //map1.addElement(xx1);
                var lox1:Location=new Location(114.166915973307,35.736901271851,_map.projection);
                var marker1:CustomMarker=CustomMarker.createDisplayObjectMarker(xx1,lox1,null,30,30);
                //var marker1:CustomMarker=CustomMarker.createUrlBasedMarker("http://localhost:8080/dbserver/6_1.png",lox1);
                _markerlayer.addFeature(marker1);
                //必须在最后,否则报错!!
                map1.addElement(s);
                map1.addElement(xx1);
                //
                _markerlayer.redraw(true);


CustomMarker.createUrlBasedMarker报错内容(跟踪到loadurl,里面乱的很,改了也不行):

                TypeError: Error #1009: 无法访问空对象引用的属性或方法。
                at org.openscales.core.feature::CustomMarker/loadUrl()[D:\workspace\openscales\target\checkout\openscales-core\src\main\flex\org\openscales\core\feature\CustomMarker.as:97]
                    at org.openscales.core.feature::CustomMarker$/createUrlBasedMarker()[D:\workspace\openscales\target\checkout\openscales-core\src\main\flex\org\openscales\core\feature\CustomMarker.as:52]
                        at test_scale/button31_clickHandler()[F:\F\flashgis\test_scale\src\test_scale.mxml:899]
                            at test_scale/___test_scale_Button37_click()[F:\F\flashgis\test_scale\src\test_scale.mxml:120]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值