flex 滚动新闻效果
最初网上的这个滚动新闻是只有一条的,我这个是经过深加工的,可以滚动多条新闻!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="complete(),success()">
<mx:Script>
<![CDATA[
private function complete():void
{
move_up.yFrom = cs.height - 6; //"加6减6是为了首尾连接更加自然"
move_up.yTo = 0 - tt.height + 6; //同上
move_up.repeatCount = 0; //无限次重复
move_up.repeatDelay = 0; //重复时间,毫秒
move_up.duration = 6000; //滚动一次的时间,毫秒
move_up.play();
}
private function move_pause():void
{
move_up.pause(); //暂停
}
private function move_resume():void
{
move_up.resume(); //从暂停位置开始
}
private function success():void
{
move_up1.yFrom = ca.height - 6; //"加6减6是为了首尾连接更加自然"
move_up1.yTo = 0 - aa.height + 6; //同上
move_up1.repeatCount = 0; //无限次重复
move_up1.repeatDelay = 0; //重复时间,毫秒
move_up1.duration = 6000; //滚动一次的时间,毫秒
move_up1.play();
}
private function move_pause1():void
{
move_up1.pause(); //暂停
}
private function move_resume1():void
{
move_up1.resume(); //从暂停位置开始
}
]]>
</mx:Script>
<mx:Move id="move_up" target="{tt}" />
<mx:Move id="move_up1" target="{aa}" />
<mx:Panel width="250" height="458" layout="absolute" title="公告栏"
fontSize="13" horizontalCenter="0" verticalCenter="0">
<mx:VBox height="100%" width="100%">
<mx:Canvas id="cs" width="100%" height="59"
verticalScrollPolicy="off" mouseOver="move_pause()" mouseOut="move_resume()">
<mx:Text id="tt" width="94%" horizontalCenter="0"
text="Varyall Javaeye 社区Web欢迎您的到来!" verticalCenter="0">
</mx:Text>
<!--<mx:Text id="bb" width="94%" text="欢迎光临Varyall Javaeye的店面,谢谢大家的捧场!" x="4" y="77"/>-->
</mx:Canvas>
<mx:Canvas id="ca"
verticalScrollPolicy="off" mouseOver="move_pause1()" mouseOut="move_resume1()" width="100%" height="34">
<mx:Text id="aa" width="94%" horizontalCenter="0" text="欢迎光临Varyall Javaeye的店面,谢谢大家的捧场!" verticalCenter="0"/>
</mx:Canvas>
</mx:VBox>
</mx:Panel>
</mx:Application>