Add image to map from custom widget

417
0
06-13-2013 11:48 AM
ErikMartin
Occasional Contributor
I have a custom widget in the Flex Viewer and I would like to add an image to the map via ActionScript in my custom widget. The following works when it is called in the code, but it adds the image at the bottom of my widget, not in map:

At the top:

private var img:Image = new Image;


then the function:

private function addImage():void
{
 trace("trying to add legend")
 img.source = "assets/images/image.png";
 this.addChild(img)
}



When I try the following, the trace happens, but no image is added.

private function addImage():void
{
 trace("trying to add legend")
 img.source = "assets/images/image.png";
 map.addChild(img)
}


Any advice would be appreciated.
Thanks,
-Erik
Tags (2)
0 Kudos
0 Replies