flex4 application设置滚动条

flex4 application设置滚动条--不过需要注意不要设置application的minwidth而是

设置第一个容器的minwidth
最正確的作法是用 Application Skin Class
在 Content Group 外包一層 Scroller 就好了
http://butterfliesandbugs.wordpress.com/2009/03/13/how-to-add-a-scrollbar-to-a-gumbo-application/

这个是在别处看的,不过这个地址好像不能用了,附上皮肤类的代码

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/11/03/adding-scroll-bars-to-an-spark-application-container-in-flex-4/ -->
<s:Skin name="MyApplicationSkin"
  xmlns:fx="http://ns.adobe.com/mxml/2009"
  xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
  alpha.disabledStates="0.5">
 <!-- states -->
 <s:states>
  <s:State name="normal" stateGroups="normalStates" />
  <s:State name="disabled" stateGroups="disabledStates" />
  <s:State name="normalWithControlBar" stateGroups="normalStates" />
  <s:State name="disabledWithControlBar" stateGroups="disabledStates" />
 </s:states>
 
 <fx:Metadata>
  [HostComponent("spark.components.Application")]
 </fx:Metadata>
 
 <fx:Script fb:purpose="styling">
  <![CDATA[
   override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
    super.updateDisplayList(unscaledWidth, unscaledHeight);
   }
  ]]>
 </fx:Script>
 
 <!-- fill -->
 <!---
 A rectangle with a solid color fill that forms the background of the application.
 The color of the fill is set to the Application's backgroundColor property.
 -->
 <s:Group left="0" right="0" top="0" bottom="0">
  <s:layout>
   <s:VerticalLayout gap="0" verticalAlign="middle" />
  </s:layout>
  <s:Scroller id="contentScroller" width="100%" height="100%">
   <s:Group id="contentGroup" minWidth="0" minHeight="0" />
  </s:Scroller>
 </s:Group>
 
</s:Skin>


转载:http://jie4lin.blog.51cto.com/2514156/751430



你可能感兴趣的:(flex4 application设置滚动条)