Flex中如何通过backgroundImage和backgroundSize样式,设置VBox容器的背景图片以及大小

main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
  3. layout="vertical"
  4. verticalAlign="middle"
  5. backgroundColor="white">
  6. <mx:Style>
  7. VBox {
  8. backgroundImage: Embed("Fx.png");
  9. backgroundColor: red;
  10. }
  11. </mx:Style>
  12. <mx:ApplicationControlBardock="true">
  13. <mx:FormstyleName="plain">
  14. <mx:FormItemlabel="percentWidth:">
  15. <mx:HSliderid="sliderW"
  16. minimum="0"
  17. maximum="100"
  18. value="100"
  19. liveDragging="true"
  20. snapInterval="1"
  21. tickInterval="10"
  22. dataTipPrecision="0"/>
  23. </mx:FormItem>
  24. <mx:FormItemlabel="percentHeight:">
  25. <mx:HSliderid="sliderH"
  26. minimum="0"
  27. maximum="100"
  28. value="100"
  29. liveDragging="true"
  30. snapInterval="1"
  31. tickInterval="10"
  32. dataTipPrecision="0"/>
  33. </mx:FormItem>
  34. <mx:FormItemlabel="backgroundSize:">
  35. <mx:ComboBoxid="comboBox">
  36. <mx:dataProvider>
  37. <mx:Array>
  38. <mx:Objectlabel="auto" />
  39. <mx:Objectlabel="100%" />
  40. <mx:Objectlabel="90%" />
  41. <mx:Objectlabel="80%" />
  42. <mx:Objectlabel="70%" />
  43. <mx:Objectlabel="60%" />
  44. <mx:Objectlabel="50%" />
  45. <mx:Objectlabel="40%" />
  46. <mx:Objectlabel="30%" />
  47. <mx:Objectlabel="20%" />
  48. <mx:Objectlabel="10%" />
  49. <mx:Objectlabel="0%" />
  50. </mx:Array>
  51. </mx:dataProvider>
  52. </mx:ComboBox>
  53. </mx:FormItem>
  54. </mx:Form>
  55. </mx:ApplicationControlBar>
  56. <mx:HBoxpercentWidth="{sliderW.value}"
  57. percentHeight="{sliderH.value}">
  58. <mx:VBoxbackgroundSize="{comboBox.selectedItem.label}"
  59. width="100%"
  60. height="100%"/>
  61. </mx:HBox>
  62. </mx:Application>

你可能感兴趣的:(xml,Flex,Adobe)