Jump to content
Search Community

reversing problem [SOLVED]

peterdavidsson test
Moderator Tag

Recommended Posts

Hi I'm trying to use the revese function but I get an error saying that the "1120: Access of undefined property myTween." thats for the mouse out function

 

here is the code:

 

this is on a mouse over:

var myTween:TweenMax = new TweenMax(e.target.textbox_mc, 1, { x:0, y:0, alpha:1, overwrite:2});

 

on mouse out

myTween.reverse()

 

does anybody see what i'm doing wrong?

thanks! /peter

Link to comment
Share on other sites

You use a local variable in your mouse over handler. Local variables will not be accessible elsewhere in your code. So you have to declare your myTween variable outside of your mouse over function. I encourage the following:

var myTween:TweenMax = new TweenMax(e.target.textbox_mc, 1, { x:0, y:0, alpha:1, overwrite:2, paused: true});

function onMouseOver(e:MouseEvent):void
{
   myTween.play();
}

function onMouseOut(e:MouseEvent):void
{
   myTween.reverse();
}

 

trispo

Link to comment
Share on other sites

ok! thanks for the reply!!

 

I don't really get it to work though, the error i'm getting is:

1120: Access of undefined property e. (for this: var myTween:TweenMax = new TweenMax(e.target.textbox_mc, 1, { x:0, y:0, alpha:1, overwrite:2, paused: true});)

 

1061: Call to a possibly undefined method play through a reference with static type gs:TweenMax. (for myTween.play();)

 

Where should I put the var myTween:TweenMax = new TweenMax etc..? right now its at the place where I declare my variables.. I tried put it in a function but that didn't work either...

Link to comment
Share on other sites

Sorry, I didn't recognize that your are using a previous version of the Tweening Engine. I recommend updating to the current version 11!

 

The first line is indeed wrong. You have to substitute "e.target.textbox_mc" with your target object. I don't know whether you have it on the stage already or whether you instantiate it dynamically.

 

Hope that helps. You can upload a simple fla file then I would see what you are doing wrong.

 

trispo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...