Share Posted May 30, 2014 Hi, thank you team greensock for the terrific work you're doing! I'm a big fan of your engine and your support! In my project I'd like to go forth and back on the timeline of a movieclip (which has a bitmap on each frame) while scrolling with my mouse wheel. For that I am creating a frames-based tweenMax and adding it to an also frames-based timelineMax. Then I am using the "tweenTo" method to go forwards or backwards on the timelineMax according to the values I create while scrolling. Tweening forwards seems to work, but it wouldn't tween back when the value decreases again. I attached a demo file with a simple rectangle moving to the side, instead of the bitmaps, on each frame. As you might have noticed I am quite new to actionscript, so I am really happy if anyone would like to give me a hint. Greetings from Germany elsa DEMO.zip Link to post Share on other sites
Share Posted May 30, 2014 Wups, it looks like you forgot to attach the sample file. Make sure you hit "More Reply Options" at the bottom to get to the screen that allows you to attach files. And please zip the file(s) first. Link to post Share on other sites
Author Share Posted May 30, 2014 Yeah, forgot to hit the "attach this file" button, thanks! Link to post Share on other sites
Share Posted May 30, 2014 the only thing that stood out as being problematic was that you were using your createTween function as an ENTER_FRAME listener which means it was creating a new tween in your timeline 30 times per second (based on the frame rate). Please try this modified code import com.greensock.*; import com.greensock.easing.*; import flash.events.MouseEvent; import flash.events.Event; var myDeltaVar:int; var frameAmount:int=new int(1); var myFrameAmount:int=1; var tl:TimelineMax=new TimelineMax({useFrames:true,paused:true}); //don't do this //stage.addEventListener(Event.ENTER_FRAME,createTween); stage.addEventListener(MouseEvent.MOUSE_WHEEL,mouseDelta); function mouseDelta(e:MouseEvent):void{ myDeltaVar=e.delta; scrollMc(); } function scrollMc():void{ if(myDeltaVar>0 && frameAmount>=2){ frameAmount-=myFrameAmount; } if(myDeltaVar<0 && frameAmount<=mc.totalFrames-1){ frameAmount+=myFrameAmount; } trace(frameAmount); tl.tweenTo(frameAmount); } function createTween():void{ var mcTween:TweenMax = new TweenMax(mc, mc.totalFrames, {frameLabel:"end", ease:Linear.easeNone, useFrames:true/*, paused:true*/}); tl.add(mcTween,0); } //only call createTween once createTween() I didn't investigate exactly what you are doing in scrollMc but it seems that mousewheel movement allowed the timeline to go back and forth. *note on Mac I had to test in a browser as it seems that mousewheel events are ignored when you test in Flash Pro Link to post Share on other sites
Author Share Posted June 2, 2014 It's working fine now! You two are geniuses! Thank's so much for helping out with my beginners mistake! *on pc I have to click on the swf before it reacts to my mousewheel everytime I test!? Link to post Share on other sites
Share Posted June 2, 2014 Yes, the swf needs focus before responding to mouse wheel events. There are some javascript solutions that work in some browsers, but I haven't researched it in awhile. Start with a google search of "Flash mouse wheel focus". Link to post Share on other sites