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 7 of 7

Thread: Collapsing my home, about, contact sections with an animation

  1. #1
    Junior Member Settled In Kivit is on a distinguished road
    Join Date
    Jul 2008
    Posts
    10
    Rep Power
    0

    Unhappy Collapsing my home, about, contact sections with an animation

    amazing Flash templates
    When I click the buttons on my flash website, I have it set up such that each section opens up as a neat little animation. Simple to do! But... I cannot, for the life of me, figure out how to make the animation "collapse" when a new button is clicked, thus proceding to the animation for the next section.

    for example if i am under the "home" section and I click the "about" section I need the content in the "home" screen to animate back to whence it came, and the "about" section content to pop up with its usual animation... and of course, this has to work with any given situation.

    I tried a million things... and I kept hitting brick walls... It's baffling me.

    I tried to write what needed to be done on paper, to see if i could script it, but my head just explodes...

    I know it's possible, I've seen other sites do it... Maybe I'm just missing something really obvious? That usually seems to be the case... but i usually figure that out pretty quickly.

    Any help would be appreciated!

    Thanks :)

  2. #2
    Flasher Settled In xInstinct is on a distinguished road xInstinct's Avatar
    Join Date
    Jun 2008
    Posts
    42
    Rep Power
    0

    Re: Collapsing my home, about, contact sections with an animation

    Hi Kivit :)

    Have you looked into the ActionScript 3.0 Tween() class?
    You can dynamically set up a tween (motion) and also add listeners to see when it has finished, that way I think you can achieve what you want.

    Lemme know,


    xInstinct

  3. #3
    Junior Member Settled In Kivit is on a distinguished road
    Join Date
    Jul 2008
    Posts
    10
    Rep Power
    0

    Re: Collapsing my home, about, contact sections with an animation

    That sounds like it just may work! I'll give it a shot then get back to you :)

    Thanks xInstinct!

    but there may be one problem, part of my animation is not a tween... but i think i can figure out a way to do it.

  4. #4
    Junior Member Settled In Kivit is on a distinguished road
    Join Date
    Jul 2008
    Posts
    10
    Rep Power
    0

    Re: Collapsing my home, about, contact sections with an animation

    oh... and i just thought of another problem. I'm not sure how I would make it listen for 4 possible tween endings.

    and how would i make an event that varied based on what button was clicked... like where would i even put the script for that... would it be something that is part of each button? oh darn here i go getting all confused again... I still think im missing something obvious here lol

  5. #5
    Flasher Settled In xInstinct is on a distinguished road xInstinct's Avatar
    Join Date
    Jun 2008
    Posts
    42
    Rep Power
    0

    Re: Collapsing my home, about, contact sections with an animation

    Lol, lemme give you an example...

    Say you have a rectangle (shape, but lets make it a movieclip) and a button.
    When you click the button, the shape will Tween to a new position.
    Button's instance name is btn, movieclip's instance name is shape.

    Code:
    btn.addEventListener(MouseEvent.MOUSE_DOWN, doSomething);
    
    function doSomething(e:MouseEvent):void
    {
        var myTween = new Tween(shape, "x", Bounce.easeOut, shape.x, shape.x+60, 0.5, true);
    }
    So, that will make the object (shape), animate in the "x" direction, in a Bounce fashion, from where it's x position (shape.x) is to plus 60 pixels (shape.x + 60) in half of a second.
    Then, you can add a listener...

    Code:
    btn.addEventListener(MouseEvent.MOUSE_DOWN, doSomething);
    
    function doSomething(e:MouseEvent):void
    {
        var myTween = new Tween(shape, "x", Bounce.easeOut, shape.x, shape.x+60, 0.5, true);
        myTween.addEventListener(Event.COMPLETE, doSomethingElse);
    }
    
    function doSomethingElse(e:Event):void
    {
        myTween.removeEventListener(Event.COMPLETE, doSomethingElse);
        var newTween = Tween(shape, "x", Bounce.easeOut, shape.x, shape.x-60, 0.5, true);
    }
    So when that's done, it will move back to where it was... You gotta love the functions!

    xInstinct

  6. #6
    Junior Member Settled In Kivit is on a distinguished road
    Join Date
    Jul 2008
    Posts
    10
    Rep Power
    0

    Thumbs up Re: Collapsing my home, about, contact sections with an animation

    wow thanks, combining that with another idea that popped into my head solved the problem! woo

  7. #7
    Junior Member Settled In Kivit is on a distinguished road
    Join Date
    Jul 2008
    Posts
    10
    Rep Power
    0

    Re: Collapsing my home, about, contact sections with an animation

    once i get it all working ill post an example of what I did to make it clear to everyone else. thanks again :)

+ Reply to Thread

Similar Threads

  1. Replies: 63
    Last Post: 10-01-10, 12:15
  2. Created a menu and trying to manage the different sections
    By linoroids in forum advanced Actionscript 3.0
    Replies: 0
    Last Post: 29-12-09, 22:20
  3. creating a contact from with AS 3 and PHP
    By JonesIwerks in forum advanced Actionscript 3.0
    Replies: 2
    Last Post: 17-04-09, 01:08
  4. contact.asp aiuto
    By dinomari in forum Flash Italiano
    Replies: 1
    Last Post: 23-10-08, 09:00
  5. Menu Calls sections, runs if/then script triggering an animation????
    By donteatyourfriends in forum advanced Actionscript 3.0
    Replies: 0
    Last Post: 04-04-08, 01:22

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

Search Engine Optimization by vBSEO