243 posts
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Turkey
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
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1 and 9 users
+5 more
DaniMun says

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

1612 posts
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1 and 9 users
+5 more
DaniMun says

The TweenEvent class is an AS3 class

1612 posts
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1 and 9 users
+5 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

by
by
by
by
by
by