各位大虾,帮忙给点思路,三个MC转动
时间:2010-12-30
来源:互联网
如图。现在需要做这样一个效果。场景有3个MC。分别为mc1,mc2,mc3
3秒后。。。。mc1移动到mc2的位置,并且放大,mc2缩小并且移动到MC3的位置,MC3移动到MC1的位置。
3秒后。。。。不停的循环播放。
首先我采用的是Timer类,并设置一个变量num=0,默认第一个是放大的。并使用TweenMax让MC动起来。以下是部分代码。抱歉,因目前还在构思怎么写,没有完整的代码。现在的问题是。如何让这3个都一起运动起来。num这个变量如何设置?万分感谢!
myTimer=new Timer(3000);
myTimer.addEventListener("timer",TimerCom);
myTimer.start();
private function TimerCom(e:TimerEvent):void {
if (num < 3) {
num++;
} else {
num=0;
}
TweenMax.to(imgAry[num], 1, {x:250, y:0, scaleX:2, scaleY:2, ease:Quint.easeOut});
TweenMax.to(imgAry[num+1], 1, {x:650, y:0, scaleX:1, scaleY:1, ease:Quint.easeOut});
TweenMax.to(imgAry[num-1], 1, {x:0, y:0, scaleX:1, scaleY:1, ease:Quint.easeOut});
}
}
作者: v6goodv6good 发布时间: 2010-12-30
复制内容到剪贴板
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.papervision3d.materials.BitmapFileMaterial;
import gs.TweenLite;
import org.papervision3d.view.BasicView;
import org.papervision3d.materials.MovieMaterial
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;
/**
* @author FLASH023
* @date 2010-12-30 17:49
**/
[SWF(width="550", height="400", backgroundColor="#FEB74E", frameRate="30")]
public class T2 extends BasicView
{
private var displayObject3D:DisplayObject3D;
private var timer:Timer;
public function T2():void
{
super(550, 400, true, true);
init();
}
private function init():void
{
timer = new Timer(3000);
timer.addEventListener (TimerEvent.TIMER, onTimer);
initObj3D();
addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private function onTimer(e:TimerEvent):void
{
TweenLite.to(displayObject3D, .3, { rotationY:Math.round (displayObject3D.rotationY /120+1)*120 } );
}
private function initObj3D():void
{
displayObject3D=new DisplayObject3D();
scene.addChild(displayObject3D)
var i:uint = 3;
while(i--){
var material:MovieMaterial = new MovieMaterial(this["mc" + i]);
material.interactive = true;
material.doubleSided = true;
var plane:Plane = new Plane(material,200,200);
displayObject3D.addChild(plane);
plane.rotationY = 360/3*i;
plane.moveBackward(600);
plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, on3DClick);
}
timer.start ();
}
private function onEnterFrame(e:Event):void
{
singleRender();
}
private function on3DClick(e:InteractiveScene3DEvent):void
{
var _plane:Plane = e.target as Plane;
TweenLite.to(displayObject3D, .3, { rotationY:-_plane.rotationY } );
}
}
}
代码:
package{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.papervision3d.materials.BitmapFileMaterial;
import gs.TweenLite;
import org.papervision3d.view.BasicView;
import org.papervision3d.materials.MovieMaterial
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;
/**
* @author FLASH023
* @date 2010-12-30 17:49
**/
[SWF(width="550", height="400", backgroundColor="#FEB74E", frameRate="30")]
public class T2 extends BasicView
{
private var displayObject3D:DisplayObject3D;
private var timer:Timer;
public function T2():void
{
super(550, 400, true, true);
init();
}
private function init():void
{
timer = new Timer(3000);
timer.addEventListener (TimerEvent.TIMER, onTimer);
initObj3D();
addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private function onTimer(e:TimerEvent):void
{
TweenLite.to(displayObject3D, .3, { rotationY:Math.round (displayObject3D.rotationY /120+1)*120 } );
}
private function initObj3D():void
{
displayObject3D=new DisplayObject3D();
scene.addChild(displayObject3D)
var i:uint = 3;
while(i--){
var material:MovieMaterial = new MovieMaterial(this["mc" + i]);
material.interactive = true;
material.doubleSided = true;
var plane:Plane = new Plane(material,200,200);
displayObject3D.addChild(plane);
plane.rotationY = 360/3*i;
plane.moveBackward(600);
plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, on3DClick);
}
timer.start ();
}
private function onEnterFrame(e:Event):void
{
singleRender();
}
private function on3DClick(e:InteractiveScene3DEvent):void
{
var _plane:Plane = e.target as Plane;
TweenLite.to(displayObject3D, .3, { rotationY:-_plane.rotationY } );
}
}
}
附件

2010-12-30 17:47, 下载次数: 0

2010-12-30 17:47, 下载次数: 1
作者: flash023 发布时间: 2010-12-30
flash023一出 必是精品

作者: chiyuderen 发布时间: 2010-12-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28