【问题标题】:ArcGIS API for Flex : dynamic InfoSymbolsArcGIS API for Flex:动态信息符号
【发布时间】:2013-10-26 08:04:36
【问题描述】:

我正在尝试在我的地图中添加一些 InfoSymbol,这就是我所做的:

<esri:InfoSymbol id="infoSymbol1">
        <esri:infoRenderer>
            <fx:Component>
                <s:DataRenderer>
                    <s:layout>
                        <s:VerticalLayout/>
                    </s:layout>
                    <s:Image id="eventImg" source="{imgSource}"/>
                    <s:Label id="eventName" text="{eventTitle}"/>
                </s:DataRenderer>
            </fx:Component>
        </esri:infoRenderer>
    </esri:InfoSymbol>

我正在从传递给视图的数据中填写一个列表,(该应用程序是一个基于移动视图的应用程序)

public function fillDataGrid():void {
            for each(var object:Object in data) {
                initDG.addItem(object);
                drawEvent(object);
            }
        }

最后我将 InfoSymbols 添加到 drawEvent(objt) 方法中:

private function drawEvent(object:Object):void{
            var myGraphicText:Graphic = new Graphic(new WebMercatorMapPoint(
                object.local.longitude, object.local.latitude));

            var event:InfoSymbol = new InfoSymbol();
            imgSource = "http://192.168.0.22:3000" + object.logo_thumb_url;
            eventTitle = object.name;
            event = infoSymbol1;

            myGraphicText.symbol = event;
            myGraphicsLayer.add(myGraphicText);             
        }

当然imgSourceeventTitle 是可绑定的, 问题是我得到了

描述资源路径位置类型 1120:访问未定义的属性 eventTitle。

和 imgSource 的消息相同,

任何帮助将不胜感激!

【问题讨论】:

    标签: actionscript-3 apache-flex maps arcgis


    【解决方案1】:

    你需要在给它赋值之前声明 eventTitle。

    var eventTitle:String = object.name;
    

    【讨论】:

    • 感谢您的回答,但我说“当然 imgSource 和 eventTitle 是可绑定的”,并且在 drawEvent 中我正在设置值
    猜你喜欢
    • 2016-10-12
    • 2021-12-24
    • 2010-12-18
    • 2021-11-11
    • 2015-07-22
    • 2016-09-23
    • 1970-01-01
    • 2013-07-18
    • 2010-11-22
    相关资源
    最近更新 更多