Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Results 1 to 2 of 2

Thread: Tweening Movieclips

  1. #1
    Junior Member Settled In xPINKMERCEDESx is on a distinguished road
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Tweening Movieclips

    flash templates
    Hello everyone...I'm trying to change some great code cbeech authored for me a while ago. I'm just trying to change the code to use Tweenlite and to make it that so I fully know how to edit the code, thus make it modular for me. Right now the code uses the flash tween classes. I rather use Tweenlite.


    So, basically what the code does is tween a movieclip on its X axis. Thus, when a button is pressed, the corresponding movieclip tweens out to the right and the other one tweens in from the left simulataneously. But I need to code to be completely modular, in case i want to do the same thing o n the Y axis, or if I need to add some more properties to the tween.

    Here's the code cbeech crafted, which is great but I'm not skilled enough, yet, to edit to fit all of my circumstances:


    import fl.transitions.*;
    import fl.transitions.easing.*;

    var index:int = 1;
    var buttons = [ ];

    page1.x = 0;

    for(var i=1; i<7; i++)
    {
    this['page'+i+'Btn'].id = i;
    buttons.push(this['page'+i+'Btn']);
    if(i != index)
    {
    this['page'+i+'Btn'].buttonMode = true;
    this['page'+i+'Btn'].addEventListener(MouseEvent.ROLL_OVER, onRollover);
    this['page'+i+'Btn'].addEventListener(MouseEvent.CLICK, buttonClicked);
    }else{
    this['page'+i+'Btn'].gotoAndPlay('open');
    this['page'+i+'Btn'].removeEventListener(MouseEvent.ROLL_OVER, onRollover);
    }
    }

    function onReady(btn:MovieClip):void
    {
    btn.addEventListener(MouseEvent.ROLL_OVER, onRollover);
    }

    function onRollover(e:MouseEvent):void
    {
    e.target.gotoAndPlay('open');
    e.target.removeEventListener(MouseEvent.ROLL_OVER, onRollover);
    e.target.addEventListener(MouseEvent.ROLL_OUT, onRollout);
    }

    function onRollout(e:MouseEvent):void
    {
    e.target.gotoAndPlay('close');
    e.target.removeEventListener(MouseEvent.ROLL_OUT, onRollout);
    }

    function buttonClicked (e:MouseEvent):void
    {
    for(var b=0; b<buttons.length; b++)
    {
    if(index == b+1)
    {
    if(buttons[b].currentLabel == 'open')
    buttons[b].gotoAndPlay('close');
    buttons[b].addEventListener(MouseEvent.CLICK, buttonClicked);
    buttons[b].buttonMode = true;
    }

    if(e.currentTarget.id == b+1)
    {
    e.currentTarget.removeEventListener(MouseEvent.ROL L_OUT, onRollout);
    e.currentTarget.removeEventListener(MouseEvent.CLI CK, buttonClicked);
    e.currentTarget.buttonMode = false;
    }
    }
    nextPage(e.currentTarget.id);
    }

    function nextPage(n:int):void
    {
    var aOUT = new Tween(this['page'+index], "x", Regular.easeOut, 1, 0, 1, true);
    var tOUT = new Tween(this['page'+index], "x", Regular.easeOut, this['page'+index].x, stage.stageWidth, 1, true);

    index = n;
    var aIN = new Tween(this['page'+index], "x", Regular.easeOut, 0, 1, 1, true);
    var tIN = new Tween(this['page'+index], "x", Regular.easeOut, 0 - this['page'+index].width, 0, 1, true);
    }




    And now here is what I started with; need help just adding some vars :



    stop();

    import gs.TweenMax;
    import gs.TweenLite;
    import gs.easing.*;
    import gs.plugins.*;
    TweenPlugin.activate([FrameLabelPlugin]);

    var exitStage:*;
    var lastClicked:*;

    clipOne.addEventListener(MouseEvent.CLICK, clipOneMover,false,0,true);
    clipTwo.addEventListener(MouseEvent.CLICK, clipTwoMover,false,0,true);

    function exitStage ():void
    {
    lastClicked=exitStage;
    TweenMax.to(exitStage, 1, {x:1000});
    }

    function clipOneMover (event:MouseEvent):void
    {
    lastClicked=event.target.name;
    TweenMax.to(clipOne, 1, {x:0});
    exitStage();
    }

    function clipTwoMover (event:MouseEvent):void
    {
    lastClicked=event.target.name;
    TweenMax.to(clipTwo, 1, {x:0});
    exitStage();
    }





    Thanks for any help...I need help creating the right vars to move the Movieclip off the stage when I clicked a button to tween a new movieclip onto the stage...my main plan is to make this code modular and simple enough for me to edit the x y or z, or even the scale properties...cbeech code is awesome, but I'm not skilled to edit it to fit all of my needs...thanks to cbeech for the code...


    I attached the .fla


    thanks for any time...I'm very well grateful...

    x lisa x
    Attached Files

  2. #2
    Junior Member Settled In GiveMeUrCookies is on a distinguished road GiveMeUrCookies's Avatar
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Re: Tweening Movieclips

    First of did you or did you not write this code your self?, also you have to make clear what you need help with in less text, becouse i'm a lazy ass and dont wanna read all of the code and your text. I'm currently not working within this area so i might not be able to answer it, but atleast i will try when you answer me those questions. Also i don't get why using this kinda code at this,what are you going to use it for?.

+ Reply to Thread

Similar Threads

  1. movieClips Ricorsivi
    By rivo900 in forum Actionscript 3.0 base
    Replies: 2
    Last Post: 31-01-10, 21:36
  2. Need Help in tweening
    By sweetcandy in forum Actionscript 3.0 newbies
    Replies: 0
    Last Post: 21-10-08, 14:21
  3. Tweening da as3
    By Nedyc in forum Actionscript 3.0 avanzato
    Replies: 0
    Last Post: 30-06-08, 14:29
  4. Adressing MovieClips
    By hard_overclocker in forum Flash English
    Replies: 3
    Last Post: 07-10-07, 06:09
  5. Replies: 0
    Last Post: 23-09-07, 12:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts