irregular animation/tweens REDUX

Software: Away3D 3.x

ge5, Newbie
Posted: 30 September 2011 02:11 PM   Total Posts: 13

Anyone? please? (ran outta room at bottom)..
In the following file,(away 3d 3.6) I am loading a collada and
animating the bones. After tweaking the vertex positions of the bones
and adding tweens, it works! but…upon loading the “programmatic”
bones animation only SOMETIMES works; sometimes not! ; so that the
model will rotate in the viewport but none of the bones/tweens, etc—
i might have to load + reload the .swf MANY times until the tweens +
transforms + timer event   kick in (in various browsers the result is similar). The overall rotation of the model is always working and the .dae loads in super-quickly.  Iam really lost.thank you for your time + consideration.

package
{
    import away3d.containers.*;
    import away3d.core.*;
    import away3d.core.base.*;
    import away3d.events.*;
    import away3d.loaders.*;
    import away3d.materials.BitmapMaterial;
    import away3d.modifiers.data.*;
    import away3d.primitives.*;
    import com.greensock.TweenLite;
    import com.greensock.TweenMax;
    import com.greensock.core.*;
    import com.greensock.easing.*;
    import com.greensock.*;
    import fl.transitions.*;
    import flash.display.Bitmap;
    import flash.events.*;
    import flash.geom.Vector3D;
    import flash.utils.Timer;
    [SWF(width=“800”, height=“800”)]
    public class anim2 extends SampleBase
    {
      private var _loader : Loader3D;
      private var _skeleton : ObjectContainer3D;
      private var mid : Bone;
      private var dl: Bone;
      private var lfu : Bone;
      private var lf : Bone;
      private var rfu : Bone;
      private var mfu : Bone;
      private var mf : Bone;
      private var rf : Bone;
      private var th : Bone;
      private var l:Array;
      private var u: Array;
      private var myTween:TweenMax;
      private var _bitMat:BitmapMaterial;
      private var timer:Timer ;
      [Embed(source=“doComp.jpg”)]
      private var tex:Class;
      public function anim2() {
          super();
      }
      protected override function _createScene() : void
      {
          var collada : Collada = new Collada();
          _loader = new Loader3D();
          _loader.addEventListener(Loader3DEvent.LOAD_SUCCESS,
_onLoadSuccess);
          _loader.loadGeometry(‘knits/25old.dae’,collada);
          _loader.y = -250;
          _loader.z=750;
          _loader.x=-90;
          _view.scene.addChild(_loader);
      }
      private function _onLoadSuccess(ev : Loader3DEvent) : void
      {
          _skeleton = _loader.handle as ObjectContainer3D;
          _bitMat=new BitmapMaterial(Bitmap(new tex()).bitmapData);
_skeleton.materialLibrary.getMaterial(“doComp_jpg”).material=_bitMat;
          _skeleton.scale(5);
          _skeleton.scaleZ=5.3;
          _skeleton.rotationZ= -25;
          _skeleton.useHandCursor = true;
          dl = _skeleton.getBoneByName(‘DOLL’);
          mid = _skeleton.getBoneByName(‘MID’);
          lf = _skeleton.getBoneByName(‘LF’);
          lfu = _skeleton.getBoneByName(‘LFU’);
          mf = _skeleton.getBoneByName(‘MF’);
          mfu = _skeleton.getBoneByName(‘MFU’);
          rf = _skeleton.getBoneByName(‘RF’);
          rfu = _skeleton.getBoneByName(‘RFU’);
          th = _skeleton.getBoneByName(‘TH’);
          dl.scale(5.2);
          th.scale(5.40);
          lf.scale(5);
          mf.scale(4.88);
          rf.scale(4.88);
          mid.addOnMouseOver(onMouseOver);
          dl.ownCanvas=true;
          l=[];
          u=[];
          l.push(rf,mf,lf);
          u.push(rfu,mfu,lfu);
      OverwriteManager.init(OverwriteManager.AUTO);
      timer= new Timer(1500,1);
      timer.addEventListener(TimerEvent.TIMER, onOver);
          timer.start();
      }
protected function onOver(event:TimerEvent):void{
          myTween=new TweenMax(th,.7,{x:-3,y:0,z:-1.0,scaleY:4.8,scaleX:
4.8,scaleZ:4.8,onComplete:rerun, repeat:-1,yoyo:true});
      }
      protected function rerun():void{
          myTween.reverse();
          timer.removeEventListener(TimerEvent.TIMER, onOver);
      }
      protected function onMouseOver(event:MouseEvent3D):void{
          TweenLite.to(dl,.7,{x:-6.3,z:-0.82,scaleX:5.25,scaleY:5.25,scaleZ:
5.25,jointRotationX:80,jointRotationZ:15,ease:Quad.easeOut});
          mid.removeOnMouseOver(onMouseOver);
          mid.addOnRollOut(onRollOut);
      }
      protected function onRollOut(event:MouseEvent3D):void{
          TweenLite.to(dl,.7,{x:-8,z:-2,scaleX:5.,scaleY:5.,scaleZ:
5.,jointRotationX:-60,ease:Quad.easeIn});
          mid.removeOnMouseOut(onRollOut);
          mid.addOnMouseOver(onMouseOver);
      }
      protected override function _onEnterFrame(ev : Event) : void
      {
          if (_skeleton) {
_skeleton.rotationY = -90-(stage.mouseY - stage///////etc////

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X