Tween fade animation with buttons

Hi, can anyone help me!
I have four movie clips with instance names of "purple_ob", "green_ob", "orange_ob" and "blue_ob"
and four buttons "purple_but", "green_but", "orange_but" and "blue_but"
I want to have the movie clips automatically fade from one to another continually with a 5 second pause inbetween, but then if the user clicks one of the four buttons it will fade the relevant movieclip in. Then if nothing else is pressed the fading will carry on working through the four images in a loop.
So far I have the movie clips fading on a button press but how do I implement the automatic fading from one MC to another?
I've added the code below into the first frame of my scene
//My actionscript 2.0 code
import mx.transitions.Tween;
import mx.transitions.easing;
purple_but.onPress = function() {
purple_ob.alpha = 0;
purple_ob._x = 0;
purple_ob._y = 0;
var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
var alphaTween2:Tween = new Tween(purple_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
var currentPage:String = purple_ob;
purple_ob.swapDepths(thedepth += 1);
green_but.onPress = function() {
green_ob.alpha = 0;
green_ob._x = 0;
green_ob._y = 0;
var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
var alphaTween2:Tween = new Tween(green_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
var currentPage:String = green_ob;
green_ob.swapDepths(thedepth += 1);
orange_but.onPress = function() {
orange_ob.alpha = 0;
orange_ob._x = 0;
orange_ob._y = 0;
var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
var alphaTween2:Tween = new Tween(orange_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
var currentPage:String = orange_ob;
orange_ob.swapDepths(thedepth += 1);
blue_but.onPress = function() {
blue_ob.alpha = 0;
blue_ob._x = 0;
blue_ob._y = 0;
var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
var alphaTween2:Tween = new Tween(blue_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
var currentPage:String = blue_ob;
blue_ob.swapDepths(thedepth += 1);

Perfect!
I removed the 'swapdepth' and it works perfectly now.
thank you so much for your help, Ned!!!
Below is the final code
import mx.transitions.Tween;
import mx.transitions.easing;
var ob_array = new Array(purple_ob, green_ob, orange_ob, blue_ob);
var ob_count = 0;
var currentPage = purple_ob;
var intervalID = setInterval(fadeOBs, 3000); // adjust the 3000 (3 secs) as desired
green_ob._alpha = 0;
orange_ob._alpha = 0;
blue_ob._alpha = 0;
purple_ob._x = 0;
purple_ob._y = 0;
green_ob._x = 0;
green_ob._y = 0;
orange_ob._x = 0;
orange_ob._y = 0;
blue_ob._x = 0;
blue_ob._y = 0;
function fadeOBs(){
      clearInterval(intervalID);
      intervalID = setInterval(fadeOBs, 3000);
      ob_count += 1;
      if(ob_count >= ob_array.length){
            ob_count = 0;
      var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
      var alphaTween2:Tween = new Tween(ob_array[ob_count], "_alpha", Strong.easeIn, 0, 100, 15, false);
      currentPage = ob_array[ob_count];
//Uncomment the line below if you want to increase the MC's depth
      //ob_array[ob_count].swapDepths(thedepth += 1);
purple_but.onPress = function() {
      ob_count = -1; // one less than this
      fadeOBs();
green_but.onPress = function() {
      ob_count = 0; // one less than this
      fadeOBs();
orange_but.onPress = function() {
      ob_count = 1; // one less than this
      fadeOBs();
blue_but.onPress = function() {
      ob_count = 2; // one less than this
      fadeOBs();

Similar Messages

  • How can I have an object toggle between fade out and fade in with button?

    Hello all,
    I have a problem and I was hoping someone out there could help me out with it.
    I have smart shape that is set to show for "rest of project" on one of my early slides.  It is not visible in output in the properties, but when a user clicks a button in the project, it should fade in and then stay visible.  If the user clicks the same button again, it should fade out and stay hidden.  So rather than toggle between show and hide, which I know how to do, I want it to toggle between fade in and fade out.  I am having trouble with this.  Setting its transition to fade in and fade out in the properties of the smart shape doesn't help...
    Here is the advanced action I have attached to the button that should allow the user to toggle between fade in and fade out.  The "if" parts works -- the object fades in and then finally "shows" at 100% the "else" part almost works.  It fades out, disappears, but then shows again, which I obviously dont want it to do.  I want it to stay hidden.
    If you can help, it would be great!! 

    I Don't
    But as a work around you could try increasing the canvas size to match the illustrator file, paste in the object then crop off the excess canvas in photoshop

  • Dial animation with buttons

    I have a simple game with a dial and a needle. I have made two "right" and "wrong" buttons. Simply, I need to be able to make the needle move forward when the "right" buttons is clicked, and backward when the "wrong" button is clicked, regardless of the needle position on the dial. What would be the simplist way to accomplish this? I am a beginner with Actionscript, and I've tried all I know to do. Thanks for any reply.

    Showing what you've tried to do will help.  You essentially just need to change the rotation value of the needle depending on the button selected...
    objectName.rotation += someValue;
    Where some value is either a positive or a negative number representing degrees.  In that example line, AS3 (rotation) is used.  In AS2 it would be _rotation.

  • Help with Reverse Animation On Button

    The buttons are animated with a movie clip inside each button
    and the movie clip plays on rollover, however I need this same
    movie clip inside the buttons to play reversed, when the cursor is
    moved away from the button.
    I know how to do this with an instance but I already made
    each button and fooled around a thousand times with the animation
    and I do not wish to start over again!
    I have only experimented with this type of action script
    before and I must say I am a little lost =(
    Can anyone help me as to how I would go about doing this ?
    Any coding would help.
    I know there is a simple way of doing it with action script,
    but I have no more time to fool around and I need your assistance
    =P
    If you could supply the code it would help me out.
    (I can modify it to work with my page and my buttons)
    Just need something to work off of.
    Maybe a code I can put on the button, or whatever you can
    come up with.
    For future reference,
    thanks

    Without knowing the details of what you have created, or the
    code you have attempted to use, the best I can offer at the moment
    is to say you need to have the reverse playing code of the
    movieclip get triggered by the mouse out event and not stop
    stepping back down the timeline until the _currentframe value
    reaches 1. If another mouse over should occur, then it's your
    decision as to whether it picks up from where it has stepped back
    to or starts from frame 1.
    Starting over again is often the better approach, since what
    you may have created may not be able to facilitate directing things
    to play in reverse.

  • Having trouble with buttons in motion menus

    I'm having some problems with buttons in motion menus:
    - I've created a motion menu where some text (button names) fade in.
    - I set a loop point after the text has faded in completely.
    - I set the end condition to "loop"
    (there is some animation after the text fades in that I would like to loop)
    - I draw out 5 buttons and assign different overlay colors to each of the button states.
    The problem is that each time the motion menu jumps back to its loop point.. the menu seems to stutter - the overlay color on the currently selected button turns off for a second and the button is momentarily disabled (can't be selected). This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    I can avoid this problem by losing the animation and just setting the end condition to "still".. but I was wondering if anyone knows if there is something I might have missed or could try as a workaround.
    17" powerbook g4   Mac OS X (10.4.5)  

    This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    It could be how the DVD is reading the DVD (sort of the nature of DVD, everything is not exactly the same), because buttons will not show until the loop point and there may be a slight pause from end of animation in the menu to the loop point. And the overlay will turn off briefly when it hits the end.
    Visually what you can do is make the animation in a manner so that at the loop point the buttons are part of the background itself and make sure your loop point is at that point (or slightly after) so it looks like the button is there.
    For the most part the setting of still may work okay (really a creative call), sometimes listening to the same music/seeing samee animation may be too much (of course it depends on project) and you can jump to the loop point on the menu on subsequent calls

  • Ghosting occurs in shape tweens in clips with scale9Grid active.

    Why does ghosting occur in shape tweens?  Is this some kind of rendering bug?  I seem to keep running into stuff like this
    (sorry, first post had image that was not cropped properly by MSPaint and had tons of white space; I fixed it)
    --Background (feel free to skip if TL;DR): My SkinnedButton class supports states for DEFAULT, ROLLOUT, ROLLOVER, PRESS, RELEASE, RELEASEOUTSIDE, TRACKOVER, TRACKOUT, DRAGOVER, DRAGOUT, DRAGDROP, plus all variations of SELECTED_* states in addition to a "selectedMask" and "focusMask" display objects that are automatically arranged, docked, and made visible to suit not only the button state, but also (at least in the case of "focusMask") taking into account the manor in which it entered a particular state (via keyboard, via mouse, via assignment, what the drag source origin was, exact origin clip, custom tracked drag source, whether a drag even began, was cancelled, etc.).  It dispatches events for all of these states and has fallback chains for any that are missing, since they're all classified into simple states out, over, and down.  For example, if no RELEASE state is defined (can be either property named "mc_release" or "release" label on "skin" MovieClip), then it will progressively fall back to ROLLOVER, ROLLOUT, and finally DEFAULT until one is defined.  The bare minimum for a functional button is to define a clip for the default state.
    So anyway, I wanted to animate my "release" state by having the button collapse and expand, and I discovered this odd ghosting behavior.  This is just a simple reproduction of the problem with no special logic, just a shape tween on a clip with scale9Grid active.  It appears as though Flash isn't re-rendering the bottom most shape as its exposed by the tweened shape on the layer above:ShapeTweenGhosting.fla - Google Drive
    I suspect this is occurring because of the active scale9Grid, since the ghosting goes away when you turn it off, but then the button is all distorted.  Turning on cacheAsBitmap exhibits the same behavior.  Again, it's not a performance issue, it's just incorrectly rendering.  I don't see any documentation stating shape-tween animations are not allowed in clips with scale9Grid applied.  The shapes themselves appear to be rendering correctly based on the scale9Grid (i.e. without distortion), but the ghosting is a problem.
    Here is an even more pronounced example with a large shrinking and expanding oval shape:
    ShapeTweenGhosting2.fla - Google Drive

    I posted a bug here: Bug#3767678 - Ghosting occurs in shape tweens in clips with scale9Grid active
    Continued experimentation revealed it occurs on the y axis too, and depends on how much you scale the clip.
    At 99%, 100%, and 101%, no ghosting is observed.  At 110%, it occurs a little bit.  At 120%, the ghosting is very pronounced.  I suspect the problem is arising due to inaccurate calculations of the redraw regions, which may not be taking into account certain scaling factors, perhaps such as stroke widths; however, I reduced all stroke widths to zero (hairline), and the ghosting still occurred, so something is not quite right.

  • Animation with Alpha?

    Hi,
    I'm trying to create an animation with Flash CS3, so that a text will slowly fade in into the scene (ie alpha 0 -100). When working in design mode it works fine but when I test the movie de text pops up at once. I converted the text first into a symbol (movieclip) and added a motion tween afterwards.
    I've done this sort of thing before with MM Flash 2004 and that works fine. But when I try to add another one in that one, the same thing occurs.
    It works fine if I use shapes but not with text, eventhough in converted it to a movie clip. It's possible that I've forgotten something significant, but I can't figure ou what, so any help will be very much appriciated.
    Greetings, Ger

    It sounds like you are using a dynamic textfield.  You need to embed the font in a dynamic textfield in order to animate it.  If you do not need it to be dynamic text, then convert it to static text and you won't have to embed the font.

  • Troubles importing Flash 10 Animation with 3D Transform

    I am looking for any workaround/experiences for importing a Flash 10 animation with 3D transforms. Currently, doing this will wig out Captivate 4 and break the embedded animation in all sorts of ways. AS3 support in Captivate is turned on and the same animation will load and play correctly if the 3D transform is removed. All other Flash 10/AS3 possibilites work including motiosn graphs and filters.
    I find the 3D transform option of Flash CS4 to be one of the most powerful features ever introduced in Flash and would allow some incredible breakthrough design possibilities for my Captivate projects, if it would just support it! Any experiences with this issue welcomed. A bug report has been submitted also, but looking for a quicker remedy.

    Problem Resolved!
    I got this tip from Vikram (Adobe Support)
    1. Open your project having Flash Player 10 animations involving 3D transforms.
    2. Click the Edit menu and select Preferences.
    3. Select "Publish settings" under the "Project" section.
    4. Check "Animations" option under the "Externalize resources" section.
    5. Press OK.
    6. Now click the publish button.
    7. In the publish dialog, select Flash Player 10 from the "Flash Player version:" drop down.
    8. Click publish.
    (F4 preview may not work, so use preview in browser)
    Also, you may need to be wary of embedded scripted symbols as they may loose reference to the parent symbol after being embedded in yoru your CP4 project containing 3D transforms. My advice here is to try to script using as much object oriented js as possible in the main timeframe.
    I am using a combination of localConnect and ExternalInterface functions to control the 3D animation from captivate quiz buttons. This process adds a whole new level of interactivity and visual interest to your captivates!

  • [SOLVED] XFCE Slideshow Wallpaper - Fade animations

    Dear forums
    As the title says, I wonder if there is any way to get nice fade animations like in Gnome or KDE for XFCE. I remember there being an inbuilt option in XFCE making it possible to select some images which would be cycled through, but other than using e.g. Variety on Ubuntu, there is no animation when the wallpaper changes. Does this depend on some library? Could it be that Ubuntu has a configuration which makes it possible to use those animations automatically in XFCE too?
    I'm seriously considering leaving Ubuntu for good and use Arch Linux again, but since I'm using my Computer every day, I'd like my Desktop to look pretty.
    Thanks in advance!
    Last edited by alexftw (2014-03-16 04:43:48)

    twelveeighty wrote:http://www.linuxjournal.com/content/cre … ounds-xfce
    This only explains how to get a slideshow with xfdesktop, I know that already. My question was how to get fancy animations when the wallpaper changes.
    progandy wrote:You could try shantz-xwinwrap-bzr to force a window in the background.
    What a coincidence, I just figured that out myself!
    In case anyone will need this:
    xwinwrap -b -fs -sp -fs -nf -ov -- feh --bg-fill /path/to/your/wallpapers/
    xwinwrap will say that feh died but the exit code is 0 so there's nothing to worry about (does feh run as a daemon in the background?). Fade duration is specified by the compositor itself (now the only thing that'd make it perfect would be making compton use a longer fade duration on feh only), for automatic switching I'll use this for now, file "wallpaper_randomizer":
    #!/bin/bash
    while true; do
    xwinwrap -b -fs -sp -fs -nf -ov -- feh --randomize --bg-fill /home/alexander/Bilder/Wallpapers/
    sleep 600
    done
    chmod +x wallpaper_randomizer
    I'm using the XFCE settings to start it automatically, but adding it to .xinitrc would probably work too (useful if not using XFCE):
    compton -b &
    /path/to/wallpaper_randomizer &
    exec start_xfce4
    That makes me really happy somehow. Thank you, progandy, that would've really helped me if I've given up searching for a solution already.

  • How to control animation with touch

    Hello! I need some help with controlling animations with touch. I am building a fake app and need to 'unlock' an iphone (slide an arrow along a track and then have it fade into another page). I have been using http://forums.adobe.com/message/4865693 that thread. The prototype link listed there is similar to waht I need to recreate, but I think I need an 'on touch' actino instead of a mousemove one.
    http://assets.ordienetworks.com.s3.amazonaws.com/the_occasional/checkerPro/checkerPro.html
    That is a link to the Edge file I have been working on, using the info in the thread above. It is broken at the moment, and I am terrible with javascript and have no idea how to move forward. I have figured that I'll need an 'on touch' action instead of the mouseover one, but I'm not sure how to build it.
    If there is a working example of this on a different thread that I've missed I'd love a link as well!!
    Thank you!!

    Hi, akall-
    There are a number of touch events that you can use to accomplish what you want.  You can try using the touchmove event instead of the mousemove event, and stick your code in there.
    Hope that helps,
    -Elaine

  • Please help, 3D animation play button Java Script

    The U3D file embedded into the PDF contains 3 procedure animations
    I would like to add a play button for each procedure.
    But I do not see the Animation Objects in the model tree of the pdf and I do not know how to connect to these animations
    with JavaScript.
    I have tried with no luck:
    var _anim = scene.animations.getByIndex(0);
    scene.activateAnimation(_anim);
    _anim.currentTime = 0;
    runtime.play();
    Please show me how this is done with Java Script on a button.
    Thank you

    If you're controlling the 3D animation from a button on the PDF page you need to talk to the correct API.
    The easiest way to do it is to embed a function into the 3D annotation (using a .js text file) then call that function from your button.
    e.g. in the 3D script, use this:
    function playAnimation(i) {
    var _anim = scene.animations.getByIndex(i);
    scene.activateAnimation(_anim);
    _anim.currentTime = 0;
    runtime.play();
    Then on your button, use this:
    getAnnots3D(pageNum)[0].context3D.playAnimation(0);
    then the same for (1) and (2) on your other buttons.

  • Specific region mouse over effect(Button 1 fades out and Button 2 fades in).

    Dear All -
    I am new to Flash CS5 and building Flash navigation bar with buttons on it.
    Below is my problem description that I want to solve with your help.
    I have a rectangular bar and placed one small button(Button 1) on this bar. Also, I have similar button(Button 2) with some graphics on it which is of similar size as to previous Button 1.
    Button 1 - Without graphic.
    Button 2 - With graphic on it.
    What I want is that, whenever mouse is taken over Button 1 placed on the rectangular bar, it should fade out and simultaneously Button 2 should fade in. I want only button region to be sensitive to this mouse over effect and not the complete rectangular bar.
    Kindly let me know how can I define the specific region(button region only) to be sensitive to mouse over effect in flash, and how to place Button 1 and Button 2 in layers so that both are at the same positition(so that there is no displacement of button detected).
    Thank You,
    Saurabh Khanna.

    Hello -
    Thank you for the reply. Button 1 does not have glowing effect, whereas Button 2 has a glowing effect. So what I wanted is that when initially Button 1 is loaded during page load, when I mouse over Button 1, Button 1 would fade out and Button 2 sitting behind Button 1 would automatically look like fade in(due to gradual fad out of Button 1 on top of Button 2).
    I could do this now, and would like to Thank you for your reply.
    I did this by creating movie clip on "Over" event of Button 1 and changing its Alpha property. But now what I want is how to gradually fade out, means when I remove my mouse from over button, then Button 2 should fade out gradually which will automatically make Button 1 fade in gradually.
    I could not find the "Out" event just like we have "Over" event for Button, so I assume this can only be done using ActionScript somehow.
    Let me know if I am going correct with my assumption, and possibly if you could help me achieve the remaining half(fading out gradually when mouse is removed from the button).
    Thank You once again for your reply.
    Thank You,
    Saurabh Khanna.

  • Script that initiates animation with mouseover

    I need some help with the following: I want to initiate a Flash Professional CS4 animation with a mouse over script. I have tried to use a component called mouseover that is an Adobe extention. I think I have done everything right in Flash but it doesn't work after making the .swf movie. Seems like it would be a pretty simple script, but I am not an expert by any stretch. Any help with this would be much appriciated.

    Here's one way to do it:
    Create two layers.
    On the first layer, place a button.
    On the second layer, create a movie clip that contains your animation.  Place a stop action on frame one of the that movie clip.  Give the movie clip and instance name such as myMovieClip. .
    On the button action use:
    on (rollover) {
       myMovieClip.gotoAndPlay(2);

  • Creating animations with transparent backgrounds?

    I'm running into some problems when using After Effects to create animations with transparent backgrounds for Keynote...
    I use animated gifs and short quicktime movies with uniform backgrounds as source files, use color keying to take out the backgrounds, preview them to see if they look OK, render the results as RGB+alpha, and... they don't show up as transparent in Keynote. They work in Powerpoint, however. I've tried outputting as .mov, as .gif, as premultiplied vs straight alpha... no joy. Can someone explain (or point me to an explanation) of how Keynote differs from other programs in its handling of transparency? What am I missing?

    Using a TYPE_INT_ARGB BufferedImage worked beautifully. I had played around with Image for hours, but it never occurred to me that BufferedImage would be needed. :)
    many, many thanks,
    Steven

  • I'm a Graphic Designer and Animator with a Mid 2012 15" MBP...Programs slowing need up grade

    Hey everyoe,
    I'm a Graphic Designer and Animator with a Mid 2012 15" MBP. My programs get REALLY SLOW, ToonBoom Harmony and Sometimes Illustrator, HELP! I upgraded my Ram to 16GB LONG time ago and it's made a big difference but still the stuff I make is semi complicated/detailed I can't imagine this is the strength of my MBP I refuse to accept that. WIth that said HELP ME PLZ!!! I have deadlines and I dont know what else to do! Steve Jobs my life is your hands right now man...

    Maz0327,
    if you boot into Safe mode, log in, and run your graphic design and animation apps, do they run just as slowly then?

Maybe you are looking for