Flex滚动(3D Carousel)组件

如果你不了解Carousel组件是什么东东,请看下图:

 

js开源的Carousel组件很多,具体有多少,请参考http://www.open-open.com/ajax/Carousel.htm。本文主要将的是flex的3d Carousel组件。

Doug写了很多开源组件(很佩服老外的开源精神),他的Carousel Component组件是一个3D的滚动组件,组件继承自ViewStack,可以水平或者垂直展示。下面就举个简单的例子,步骤如下:

1.导入papervision_phunky.swc和tweener.swc。其中第一个包主要是3D效果,第二个是倒影滤镜效果。

2.准备好几个要展示的图片。

3.引入xmlns:containers="com.dougmccune.containers.*"命名空间。

4.写上以下代码,附件是整个例子的源代码。

Java代码   收藏代码
  1. <mx:VBox id="box" verticalGap="0" height="100%" width="100%" maxWidth="600" maxHeight="400" >  
  2.               
  3.             <containers:CoverFlowContainer id="coverflow" width="100%" height="100%"   
  4.                 horizontalGap="40" borderStyle="inset" backgroundColor="0x000000"  
  5.                 segments="6" reflectionEnabled="true">  
  6.                   
  7.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  8.                     <mx:Image  source="images/1.png" />  
  9.                 </mx:HBox>  
  10.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  11.                     <mx:Image  source="images/2.png" toolTip="图片1" />  
  12.                 </mx:HBox>  
  13.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  14.                     <mx:Image  source="images/3.png" toolTip="图片2" />  
  15.                 </mx:HBox>  
  16.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  17.                     <mx:Image  source="images/4.png"  toolTip="图片3"/>  
  18.                 </mx:HBox>  
  19.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  20.                     <mx:Image  source="images/5.png" toolTip="图片4" />  
  21.                 </mx:HBox>  
  22.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  23.                     <mx:Image  source="images/6.png" toolTip="图片5" />  
  24.                 </mx:HBox>  
  25.                 <mx:HBox width="260" height="260" borderStyle="solid" borderThickness="1">  
  26.                     <mx:Image  source="images/7.png" toolTip="图片6" />  
  27.                 </mx:HBox>  
  28.             </containers:CoverFlowContainer>  
  29.             <mx:HScrollBar id="scrollbar" width="100%" pageSize="1" maxScrollPosition="{coverflow.numChildren - 1}"  
  30.                 scrollPosition="{coverflow.selectedIndex}"   
  31.                 scroll="coverflow.selectedIndex = Math.round(scrollbar.scrollPosition)" />  
  32.         </mx:VBox>  

 

 看看效果吧

 

垂直效果

 

 

 

滚动效果

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值