Select to view content in your preferred language

Making the Static Legend widget moveable

2194
2
08-10-2010 09:31 PM
StephenLead
Honored Contributor
The Static legend sample shows how to embed a legend as an image.

What is required in order to make this legend moveable? That is, the legend can be moved around on the screen and opened/closed, like other widgets.

Thanks,
Steve
Tags (2)
0 Kudos
2 Replies
MichaelSmith2
Occasional Contributor
I copied the viewer:WidgetTemplate section from the HelloWorld sample widget and pasted it in the StaticImageWidget.mxml below the line </fx:Script>. Then I deleted the label section from that and moved the mx:VBox tag into the new WidgetTemplate configuration.

The following is how the end of my StaticImageWidget.mxml looks:
    </fx:Script>

 <viewer:WidgetTemplate id="showLegend"
       width="300"
       height="490">
  <viewer:layout>
   <s:VerticalLayout horizontalAlign="center"
      verticalAlign="middle"
      paddingTop="2"
      paddingLeft="2"/>
  </viewer:layout>

  <mx:VBox width="100%" height="100%">
   <mx:Image id="img"/>
  </mx:VBox>
 </viewer:WidgetTemplate>

</viewer:BaseWidget>
0 Kudos
CaryChadwick
Emerging Contributor
Thanks for this tip, it worked great!
0 Kudos