dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Help with onLoad function

  1. #1
    Senior Member Ryanw2626's Avatar
    Join Date
    Dec 2002
    Location
    NY
    Posts
    190

    [F8] Help with onLoad function

    Hi everyone. I'm doing a website and I'm having trouble with something. I have a movieclip that I want to animate using the tween class. However, I want the tween to occur once the frame that the code is on loads. This is a problem because I can't use onEnterFrame because it will play the tween continuously. I need it to play once the frame loads and only once. I tried using the movieclip.onLoad function but it's not working for me. What am I doing wrong? I'm using Actionscript 2 and Flash 8. Here is the code that I'm using...

    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var oListener:Object = new Object();
    home_txt.onLoad = function() {
         home_txt._visible = true;
         myTweeningY = new Tween(home_txt, "_y", Bounce.easeOut, 0, 250, 2, true);
         myTweeningY.FPS = 40;
         myTweeningY.onMotionFinished = function() {
              trace("Y motion is finished");
         };
    };
    home_txt._visible = false;
    stop();

    Ryan Wilson
    Creative Director
    3rd Lounge Inc
    http://www.3rdlounge.com

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    just use the frame number in an if statement.


    Code:
    if (_currentframe== 2) {
    my_tween_function();
    }
    Last edited by calmchess; 12-12-2006 at 02:40 PM.

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