Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 945367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:44:27+00:00 2026-05-15T22:44:27+00:00

I am a java/php developer helping someone with actionscript. I don’t understand why this

  • 0

I am a java/php developer helping someone with actionscript. I don’t understand why “this” is undefined in the below code. this is only a snippet of the code, but hopefully it’s gives an idea of where i’m trying to reference “this”. I’m trying to find out which movie the tween is moving so that i can load the next movie. Tweens are used to move the movies in and out of the screen.

var tween_move_1:Tween = new Tween(movie_0, "_x", Strong.easeOut, 1600, 150, 0.5, true);

tween_move_1.onMotionFinished = function() {
    stop();
    setTimeout(function () {
        trace(this);//when trace runs it shows undefined
        var tween_move_2:Tween = new Tween(movie_0, "_x", Strong.easeOut, 150, 1600, 0.5, true);
        tween_move_2.onMotionFinished = function() {
        var tween_move_1:Tween = new Tween(movie_1, "_x", Strong.easeOut, 1600, 150, 0.5, true);
        };
    }
    ,2000);//end of setTimeout
};//end of tween.onMotionFinished

UPDATE! Here is the working code after applying tips from the responses/answers:

var tween_move_in:Tween = new Tween(movie_0, "_x", Strong.easeOut, 1600, 150, 0.5, true);   
tween_move_in.onMotionFinished = function() {
    stop();
    var tweeny = this;//create reference to this so it can be used in setTimeout()
    setTimeout(function () {
         var movie = tweeny.obj;//use ref to get the movie affected by the tween
         var movieName:String = movie._name;
         var splitArray = movieName.split("_");
         var index = parseInt(splitArray[1]);
         var tween_move_out:Tween = new Tween(_root["movie_"+index], "_x", Strong.easeOut, 150, 1600, 0.5, true);
         tween_move_out.onMotionFinished = function() {
              var tween_move_in2:Tween = new Tween(_root["movie_"+(index+1)], "_x", Strong.easeOut, 1600, 150, 0.5, true);
         };
    }
    ,2000);//end of setTimeout
};//end of tween.onMotionFinished
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:44:27+00:00Added an answer on May 15, 2026 at 10:44 pm

    If you trying to trace out tween_move_1, you can refer to it directly inside the setTimeout().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a new Java developer I've only ever done PHP in the past and
Since my AS3 and Php/Java knowledge is not good I got stuck on this
This is more a question of pros/cons between PHP and JAVA. Iv been doing
Hi I'm a PHP developer and I have some experience with Java. I'm trying
I am a PHP developer, I read about Java EE technologies and I want
I am primarily a Java and PHP developer and have some experience with .NET
I have been a long-term .NET developer, but dabble in Java and PHP development
I am a PHP developer but am transitioning to Java. (very new to Java
Ok, i wrote this pice of code as an beginner in java learning from
I am java, j2ee developer. But new to PHP lang. In Java Controller and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.