A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Movieclip tween on move

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    6

    Lightbulb Movieclip tween on move

    Hi, I'm new to AS3 and trying to get to grips with it all.

    When using AS2 a mc when moved via AS would slide to the new position. I have some AS3 code, which when the left or right buttons are pressed moves the mc to a new position, but it just jumps to the new position instead of sliding.

    How would I alter the code so that it slides to the new position instead of jumping? I've searched everywhere and tried to add tweenLite but I really am stuck


    Here's the code I'm using -


    illleftButton.addEventListener(MouseEvent.MOUSE_UP , leftbuttonill);

    function leftbuttonill(event:MouseEvent):void{

    if (MovieClip(root).mainContainer.illustration.x < -40){
    (MovieClip(root).mainContainer.illustration.x += 1250.0);

    }

    else if (MovieClip(root).mainContainer.illustration.x > 3.8){
    (MovieClip(root).mainContainer.illustration.x += 0);

    }
    }


    illrightButton.addEventListener(MouseEvent.MOUSE_U P, rightbuttonill);

    function rightbuttonill(event:MouseEvent):void{

    if (MovieClip(root).mainContainer.illustration.x > -7000){
    (MovieClip(root).mainContainer.illustration.x -= 1250.0);


    }

    else if (MovieClip(root).mainContainer.illustration.x < -7000){
    (MovieClip(root).mainContainer.illustration.x += 0);

    }
    }


    Any help would be greatly appreciated.

  2. #2
    Juvenile Delinquent CVO Chris's Avatar
    Join Date
    Jul 2002
    Location
    Ulster, UK
    Posts
    520
    You are moving the movieclip by 1250pixels in 1 go. You need to move it 1 pixel at a time.

    MovieClip(root).mainContainer.illustration.x = MovieClip(root).mainContainer.illustration.x - 1;

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    6
    It's an image slideshow, so I need it to move +1250.0 at a time to view the next image (the images are 1250.0 apart from each other within the mc).

    Correct me if I'm wrong but I don't think it's got anything to do with the amount of distance it's moving but more to do with it needing a tween class? I'm just not really sure on how I'd go about adding a tween class.


    Sorry for not making this clear.

  4. #4
    Junior Member
    Join Date
    Jan 2010
    Posts
    6
    Anyone?

Tags for this Thread

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center