243 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Located in Europe
creativestuff says

hi…back one again, still working on that gallery and I need some help

I just finished learning how to use mx.tweens (before I was building the tweens by myself) and I really enjoy the simplicity of built in tweens.

The problem is I don’t know how to verify if a Tween is ended I searched the net and found that I have to add a listener to the tween, found some examples too but neither one is working or I found it in AS3 cuz if I try to run it it gives me some errors “the class or interface could not be loaded”

Basically I just wanna move an MC with mx tween and do some other stuff if the MC reached the desired position and the tween stopped.

myMC.onPress = function(){ myTween = new mx.transitions.Tween(this, “_x”, mx.transitions.easing.Strong.easeInOut, this._x, this._x+100,2, true); }

myTween.addEventListener(TweenEvent.MOTION_FINISH, doSomeStuff);

function doSomeStuff(e:TweenEvent):void{ trace(“the tween! She’s a’finished!”) }

the error is given on the line: function doSomeStuff(e:TweenEvent):void{ if I remove the e:TweenEvent there is no error message but nothing happens when the mc stopped moving (and I read that the e:TweenEvent is neccesary ).

60 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
ckeskin says

You should import tween classes first.

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

And yes, tweenEvent is necessary.

243 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Located in Europe
creativestuff says
You should import tween classes first.

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

And yes, tweenEvent is necessary.

I forgot to mention that the imports were done…. and still showing the error

class or interface fl.transitions.TweenEvent could not be loaded

(I use flash CS3 …)

1612 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 more
DaniMun says

It looks like you’re mixing AS2 with AS3 code, that’s why you’re getting all those errors.

1612 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 more
DaniMun says

The TweenEvent class is an AS3 class

1612 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 more
DaniMun says

If I was you, I’d use Jack Doyle’s TweenLite/Max tweening class, it’s really awesome! It features a special property – onComplete – which allows you to reference a function/method of your choice that you need to invoke once the tween is finished.

Long story short, IMHO that’s the best solution to your problem :D

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by