ActionScript 2.0 :: Tween Class - Rewinding Tweens
Nov 30, 2009
i've followed several tween classes tutorials across the internet. here's what I'm currently trying to do: there will be three buttons (let's name it A,B,C). when the user click A, it will move to X,Y coordinate on the stage (i've succeeded and have done it). then, when the user click B, B will now move to the same coordinate (succeeded too).
what i failed to do is when the user click B, i want A to return to its original position. do i have to use rewind or yoyo method to do this? how? can someone show me? this is my actionscript on frame 1: *info: top_mc is button A instance, mid is button B and btm is button C*
I am currently creating a menu system for a site, that when hovered over expands from a short strip into the larger menu containing buttons/graphics etc. To reduce the number of frames used within the site, i am trying to achieve this method using the tween class / onMotionFinished action as opposed to having a movieclip which plays through when hovered over. However if you move the mouse off before the "loading in" animation is complete, it begins the "reverse" animation and seperate titles both appear on top of eachother.
Basically i need to stop the tweens from playing, should the user hover away before they are complete, like a movieclip would "rewind" if you were using that well documented method. Below is the script, and I have attached the .fla for you to have a look at.
I am having trouble figuring out the best way to delay a tween if a mc is still tweening? I tried setInterval but couldn't figure out how to make it work at least in this context... i have several functions that might be causing the slider_mc to be tweening at any moment (including this one...), and i need the buttons to respond (eventually) to the users press even if they hammer it... but if they do the tween gets interupted and starts from some uneven _x and gets out of alignment. It should only be moved + or - 100 pixels at a time....
edit2: Well I found out what was wrong. answered my own question. * Face-palm* sorry for this waste of space. (if you come across this randomly, my solution is answered at the bottom)Edit: While mulling over my code trying to find a solution, I noticed that when my .swf freezes as it is tweening out, an animated movie clip that is on the stage also freezes mid-animation. which brings me to believe that my problems may stem from the loading/creating image portion of my code. as a result, here is my loading function to supplement the code below:
function loadImage():void { //if it's not already been loaded) if ((currentImageNbr+1) > imagesLoaded || images.length == 0) {
Now I am using the Tween Class to move some boxes in my movie, now I can move the first mc and then another mc after the first tween has finished with onMotionFinished but I was hoping someone could help with how do I start the second tween when the first mc has passed a certain _x coordinate. ie starting the second mc moving while the first tween is still moving.
If i have a clip with a bunch of stuff inside it (on layers) like other clips, bitmaps, etc. and perform a tween on that clip (via tween class), the stuff inside the clip seems to alpha at different rates.
For instance, i have a clip with an empty movieclip which loads a bitmap image and on top of the bitmap image, i have a gradient feathered edge (.png) bitmap and on top of that I have some dynamic text (embedded fonts).
The bitmap is supposed to create a feathered edge on the photo but since they alpha at different rates, you always see the hard edge of the photo...
is there a solution like cacheAsBitmap which would let the whole clip alpha at once? If it's cacheAsBitmap, i must be using it incorrectly, b/c it's not working!
Am trying to use the Tween class to scale and move a movieclip. Now the movieclip is within the loader, so I need the motion to be controlled by the percentage loaded. Now the code to move the movieclip to its final position is:
var xscaletween:Tween = new Tween(mstone, "_xscale", Regular.easeOut, mstone._xscale, 220, 6, true);
But this is the final location, I want to be able to change the properties of xscaletween, yscaletween, xmovetween and ymovetween as per percentage loaded.As in, within this final boundary limit of the tween, I want, for example, xscaletween, to scale only till 140 till percentage hits 50. Is this possible?? If not is there a workaround?Or do I have to use new tweens within each percentage limit?
I am trying to understand the thinking behind motion tweening using AS3 (rather than doing it on the timeline).I am trying to create a simple platform game, and while this is simply a learning project, I have an movieclip instance on the stage, and using basic x+5 logic I can get the instance to move left and right on the stage accordingly.Trying to make the instance 'jump' is a bit trickier. This is the code I am using:
I thought this code would move the instance from it's current y-position and tween it to it's highest jump point. From here I planned to use a MOTION.FINISH event to tell it to tween back to it's original position.Something strage happens though, rather than tween from the current y position and move up, the instance instantly transforms it's position to y+100 and then tween back to the original position. So it kind of turns out that it is the second part of the jumping action that I want to create.
I have a few movie clips in the library. each is created at runtime, placed in an existing movie clip, and given some text (each movie clip has a dynamic text box inside). The header text loads, and then body, and then the enter button. My problem is that the tween for body don't work, yet the tweens for the header and the enter text work. The only difference between the header and the body movie clips, is that the textbox inside, in the body clip is set to multiline.[code]
Is there any way to make a movie clip start at a given x and y point, and ends at another x and y point, in 90 seconds?m not getting a good result.The main problem is, I want the movie clip to travel along a straight line. And by this code below the "b" movie clips makes some curves.Heres what Ive done.
"p" is point movie clip "b" is ball movie clip fullTime = 90000;_currentTime = fullTime;oldTime = undefined;onEnterFrame = function () {if
What I want to do is tween a number from lets say 0 to 50 using the Tween class. The below is an example of my tween but it wasn't working (*NOTE* i'm using TweenExtended but if you change the tween to Tween only it will be the same thing, i just have a habit of using the TweenExtended class):
I'm building a presentation that utilizes cue points to bring in external swfs.I don't have the first clue as to how to rewind through the original presenation so that it includes the external swfs in the rewinding process.Here's the code for the presentation:
When I want to ask for a small fee for my app, I'm not allowed to use TweenLite. So I started thinking I could probably replace the tweens with Flash's built-in Tweens. BUT I'm also using rotationY. Flash doesn't support this as far as I know. Are there Tween engines out there with a copyleft?
Basically I have a series of animated movie clips that need to play when they are triggered by a button (button 1)....
(This bit I can do...But the next bit is tricky:
Then, the animated movie needs to rewind, when the button (button 1) is clicked on again, or triggered by clicking another button (button 2). - I have also figured out the rewind part using a movie controller [code]...
I just completed the "Playing Sounds using ActionScript" tutorial. I figured out a button to rewind the sound to the beginning. Is there a way to also rewind the sound, say two or three seconds each time the user clicks the rewind button? I've been using Flash since v4, but haven't ventured too far into ActionScript beyond the Movie Controls.
I rendered a 3d cube spinning in different directions using cinema 4d. I imported the entire sequence into flash as a movie clip. My goal is to set up buttons that will take you to certain points of the cube sequence. i.e. frame 1 scene is top of cube-the user presses a button and the cube animates to a different side-information pops up.Basically i have 3 buttons, they all animate the cube to different sides of it. I would like to animate back to the first side of the cube if the "home" button is pressed.
im attempting to use if else and currentFrame, but im having some trouble. I also tried using prevFrame(); instances when a button is pressed but didn't know how to stop it when the cube got to a specific side. Below is an example of my code.
I am working on a UI that makes heavy use of the Tweener class, and which also loads an external .swf that I believe also uses the Tweener class.
After tracking down all kinds of buggy behavior, I'm thinking that the problem is that the loaded .swf is making calls to Tweener.removeAllTweens() *(This is just an assumption) and stopping other tweens that are happening in my UI.
Is this possible, and if so, is it possible to isolate the two versions of the Tweener class so that they don't reference the same object?
I have an flvplayback component on the stage of a parent flash project. One can preview a video that has some text overlaying it that the user entered in a previous scene. Dynamic cuepoints sync the video with the overlaying text.If the viewer doesn't like the preview they can go back to the previous scene, edit the text, and rewatch/preview the video with the overlaying text to make sure they like it.
I'm running into an issue when they stop watching the video preview, they go back to the previous scene and they return to the video preview scene. I stop the video with a .stop() and I rewind it with a .seek(0) but when they return to the video player and rewatch the video there's a brief audio pop. I'm assuming the pop is a bit of video/audio left in the buffer of the flvplayback component.
My question is - is there a way or what is the best way to clear the buffer of the flvplayback component when I rewind the video so it can be replayed?Is there a better way to rewind an flvplayback to the beginning other than .stop() & seek(0) so I don't get a audio pop when it's replayed?
I'm working on a slide show which includes 3 sections that fade in and out automatically as well as can be navigated via buttons.Everything is working fine until I include a 3d tween animation of a hanging sign.it doesn't have any action script - just a 3d tween where the sign swings however once I include it in the slide show, the whole thing goes crazy:The fade in and out of tweens don't work.sometimes the slide show skips and everything start moving very fast as if the timeline was fast forwarded... can someone please helpe me and point me in the right direction of where to even start trouble shooting it? The problem is that it acts as if there was some kind of script added however there's no action script included in the hanging sign.
im using the tween class within a class and having trouble getting the .onMotionFinished of the tween to recognize or relate back to the scope of the class.so if i had
Code: var t1:Tween = new Tween(myClip, "_alpha", None.easeNone, 0, 100, 1, true); t1.onMotionFinished=function()
I'm working on a slide show which includes 3 sections that fade in and out automatically as well as can be navigated via buttons...
Everything is working fine until I include a 3d tween animation of a hanging sign.. it doesn't have any action script - just a 3d tween where the sign swings... however once I include it in the slide show, the whole thing goes crazy:
The fade in and out of tweens don't work... sometimes the slide show skips and everything start moving very fast as if the timeline was fast forwarded.. The problem is that it acts as if there was some kind of script added.. however there's no action script included in the hanging sign..
I have a movie clip that is rotated when a button is clicked:
Quote:
mc_rightBtn.addEventListener(MouseEvent.CLICK, onRotateRight); function onRotateRight(evt:MouseEvent):void { var myTweenRotation:Tween = new Tween(mc_gallery, "rotation", Elastic.easeOut, 0, 90, 5, true); }
The problem I have is that when the the right button (mc_rightBtn) is clicked again, the rotation starts from the original position. Ideally I would like the rotation to continue from its current position.
I've started using the Tween class as I find it to be a really quick way to create some smooth animations. However, what I would like to do is have a sequence of many different objects animating into the scene, but all using the Tween class.Now if they were all to animate in at the same time that would be fine - but what I would like to achieve is each object to animate in one at a time, so once 1 object has finished, the next one then animates in etc etc over until all 7 are animated in. I've read up a little on using continueTo etc but not sure how to get this to affect different mc's instead of self.
So I'm actually doing something very simple here, but it's my first attempt at tweening things through code rather than on the timeline, so I'm pretty new at this. Basically I have a small image gallery, all the thumbnails are butted up against one another in a grid. When you roll over an image, the title should tween to reveal itself below the image. I have it set up so that both the image and title are in one movie clip, with the image on the top layer.
My code does work when you move your mouse slowly, however when you roll over and out really fast, the whole thing freaks out a little, and the titles don't tween back properly, they actually stay exposed even though they shouldn't. It looks like they kind of tween back, then pop out again, with out a tween. I linked to my current swf file so you can see for yourself. [URL].
Here is an example of my code which is iterated for every image. MC.addEventListener(MouseEvent.ROLL_OVER,onMC); MC.addEventListener(MouseEvent.ROLL_OUT,offMC); var myTween:Tween; MC.buttonMode = true; function onMC(event:MouseEvent):void{ myTween = new Tween (MC.title,"y",Strong.easeOut,94.5,138,.65,true); } function offMC(event:MouseEvent):void{ myTween = new Tween (MC.title,"y",Strong.easeIn,138,94.5,.35,true); }