----- Original Message ----

> From: Jack Doyle <j...@greensock.com>
> To: Flash Coders List <flashcoders@chattyfig.figleaf.com>
> Sent: Mon, April 26, 2010 12:36:45 PM
> Subject: RE: [Flashcoders] Infinitely Looping Image
> 
> You're mixing Tween and TweenLite code. You've got an event listener set 
> up

I thought I'd commented out the TweenLite code, right?

> for a TweenEvent.MOTION_FINISH but TweenLite doesn't dispatch 
> events
(TweenMax does though), and you didn't define your cloudTween 
> variable.

> The easiest thing to do would be to use TweenMax and its 
> "repeat" property,
> setting it to -1 for infinite:

Well the problem there and with onComplete is that the clouds image has to move 
completely off the stage, trailing ugly white space the whole way, before the 
repeat kicks in. Can't have that ;) Other ideas?
TIA,
John


PS. Here's that code again:

        var cloudTween:Tween = new 
Tween(parent_container2,"x",null,0,300,1,true);

        function BigPic():void 
        {
            parent_container2 = new MovieClip();
            var square:Sprite = new Sprite();
            parent_container2.mask = square;
            addChild(square);
            square.graphics.lineStyle(3,0x065566);
            square.graphics.beginFill(0xffffff);
            square.graphics.drawRoundRect(22, 22, 966, 146, 20);
            square.graphics.endFill();
            addChild(parent_container2)
            var path:String = "images/clouds.png";
            var req:URLRequest = new URLRequest(path);
            var loader:Loader = new Loader();
            loader.load(req);
            loader.addEventListener(IOErrorEvent.IO_ERROR, 
function(e:IOErrorEvent):void{ trace(e) });          
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, 
BigPicLoaded);
        }

        function BigPicLoaded(evt:Event):void
        {
            var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
            var displayObject:DisplayObject = loaderInfo.content;
            displayObject.width = 2000;
            displayObject.height = 150;
            displayObject.x = 20;
            displayObject.y = 20;
            parent_container2.addChild(displayObject);
//            TweenLite.to(parent_container2, 50, {x:-1000});
            cloudTween.addEventListener(TweenEvent.MOTION_FINISH, 
restartAnimation);
        }
        
        function restartAnimation(oEvent:Event):void
        {
            cloudTween.start();
        }


      

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to