Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




_x Tween Trouble



I am unable to tween into a specific position. Here is the code that I am using.
if (_root.arrow._x>330) {
_root.arrow._x-=70;
gotoAndPlay("loop");
} else{
gotoAndStop(1);
}
When I replace "-=70" with "--" I can hit the exact spot that I am going for, but it does not move fast enough.

Any suggestions would be greatly appreciated.

Thanks



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-24-2002, 08:59 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Multiple Tween Trouble
Ok are you sopposed to have more then 1 dif. kind of tweens on 1 layer....or are u sopposed to make a seperate layer 4 a seperate tween
thx alot 4 the help
this ? is bothering me

Fade In Tween Trouble...
maybe i'm completely crazy... i'm trying to tween a mc symbol... just a simple alpha fade... on the main timeline of a swf... he symbol is made of dynamic text embeded... but of two different text boxes... converted to grapic symbols... on two different layers... in the mc symbol... is there something wrong with me...? it wont tween... i've tried it with one layer... i've tried it grouping them... i need the fonts to be two different sizes in the one symbol...

help... it's probably something silly...

[FCS3] Tween Trouble In CS3
My Flash experience is in using Flash8, and I'm currently using CS3 for the first time. I am however using AS2.0, not 3.0.

I'm using several motion tweens between various keyframes in a layer of a movieclip. Each tween is from a keyframe with a symbol instance set at color: Alpha, 0% and the same symbol with color: Alpha, 100%. These appear to be functioning properly. Below that layer I have a layer with almost identical "static" symbols. The intended effect being part of the swf "fades in."

However, by the second frame as the alpha starts to tween in, the entire image (including the normal static layer) is washed out as if the tween layer has 100% opacity over the static fill layer.

I've done the exact same thing in the past using Flash8, so maybe I'm just forgetting something. Thanks for any help!

Tween Class Trouble
An swf is worth a thousand words, so....

Please go to http://www.datapixel.eu/datapixel.htm

and watch yourself. When you click on "Apri Menu" (Open Menu in english) an animation made with the Tween class shows.

It should enlarge the green panel in order to show the buttons. And IT DOES! .... sometimes.

Instead sometimes the animation stops prematurely and the menu is not correctly viewed. Do you know what's happening?

Thanks.

Trouble With The Tween Class
I'm having trouble with this code, it's for tweening Thumbnails in a photo gallery application I'm building:


Code:
var tween:Tween = new Tween(Thumbnails[Thumbnails.cur_thumbnail], "_alpha", mx.transitions.easing.Strong.easeIn, 40, 100, 1, true);
Thumbnails.cur_thumbnail = new_thumbnail;
What happens is while the tween variable is tweening the value of Thumbnails.cur_thumbnail changes therefore cutting off the tween before it gets started or at least I'm assuming this is what's happening.

How do I get around this? Thanks.

Tween Class Trouble
Well, firstly, excuse my poor english... I guess its not so good, but I hope you can understand me.

Well, I have imported the tween class at my .fla file with:

-------
import mx.transitions.Tween;
import mx.transitions.easing.*;
-------

as everywhere says it must be done. Later, I use:

-------
ROLLOVER:
var tw:Tween=new Tween(plano_mc, "_xscale", mx.transitions.easing.Elastic.easeOut,40, 100, 40, false);

var tw2:Tween=new Tween(plano_mc, "_yscale", mx.transitions.easing.Elastic.easeOut,40, 100, 50, false);
-------

inside a function that i call on the rollover method for the movieClip I want to tween.

The trouble comes in the rollOut method, where I have this code:

-------
ROLLOUT:
var tw:Tween=new Tween(plano_mc, "_xscale", mx.transitions.easing.Elastic.easeOut, 100,40, 1, true);
var tw2:Tween=new Tween(plano_mc, "_yscale", mx.transitions.easing.Elastic.easeOut, 100,40, 1, true);
-------

After the user rolls out, and even after the rollOut tween is well done, it resizes to the 100%, even if I'm out of the hitArea for the rollOver. All this instead of staying at the 40% of _xscale and _yscale, that is what I wanted the class to do (you can see it in the parameters of the tween).

It only happens in the rollOut method, because the rollOver doesn't get resized after is called as well as the rollOut... It should be logical if it should happen at both methods, but it just happens at RollOut, and even, each time I rollOut, is just one (or both sometimes) property which gets resized (sometimes the _yscale, other times the _xscale....). Is there any explanation for this???

I want to erase this error, that I can't find why happens. My only explanation is that Robert Penner did a bad class, but I don't really trust it because he is a Flash master and I'm just a beginner, so, please
pleeeeeaaaase!, anybody help me!
Thank you very much!

Tween Class Trouble
I have 2 tweens. I want my first one to be around 50% completed to start my second one. How do I do that ?


Code:
var Tween_right:Tween = new Tween(_root.mc_holder.mc_backgroundBlue, "_x", Strong.easeOut, 0, 525, 1, true);

var AlphaUp:Tween = new Tween(obj, "_alpha", Regular.easeOut, 0, 100, 1, true);
AlphaUp.stop();

Trouble With HitTestPoint And Tween
Hi guys,
I'm having a trouble with hitTestPoint and tween. Well, if you look at the code you will understand what I am trying to archive here.

---------------------
var action:Tween;
target01.alpha = 0.6;
target01.addEventListener(Event.ENTER_FRAME, transition01);
function transition01(event:Event):void {
if (target01.hitTestPoint(mouseX, mouseY, true)) {
action = new Tween(target01, "alpha", Strong.easeOut,0.6, 1, 1, true);
} else {
action = new Tween(target01, "alpha", Strong.easeOut,1, 0.6, 1, true);
}
}
---------------------

Yes, that's right. I'm trying to make the movie clip 'target01' to fade in once the mouse pointer roll-overs, and fades out when roll-out. But tween actions don't work...
Yes, I did MouseEvents instead, but it is not the way I want it.. Please help me outta here guys.

Trouble With A Shape Tween
Howdy guys,
I got this problem with a shape tween in my project. Its basically a CBt type of deal. But the problem is when u click on a button and go to the page, a shape tween of a semi-transparent box betting bigger is supposed to happen, it is also a movie clip. It happens inside of it. It happens in the flash file, but when I export it it goes all wierd. The box is supposed to come from the top left and go to the right bottom. But when it plays it only shows the right side line.
Are both the timelines supposed to be the same amount. There both 10 frames. Any kind of help will be greatly appericated.
thanks

Tween Class Trouble
I don't use Tween class often, so don't scold me if this is an obvious question.

When I set up a simple Tween, it works if I assign a specific object's instance name as the object to tween. But when doing it inside a for loop, it doesn't work. Yet everything else within the for loop works. I've tested every variable, and it's the object name that doesn't work. Here is a simplified version of the code. Someone please tell me what I've done wrong.









Attach Code

import mx.transitions.Tween;
import mx.transitions.easing.*;
for (var k:Number = 1; k<15; k++) {
var dakine = this["letter"+k];
dakine.onPress = function() {
this._xscale = this._yscale=90;
this.startX = this._x;
this.startY = this._y;
startDrag(this);
};
dakine.onRelease = dakine.onReleaseOutside=function () {
stopDrag();
this._xscale = this._yscale=100;
var letterUp:Tween = new Tween(this, "_x", Bounce.easeOut, this._x, this.startX, 2000);
};
}

Still Having Trouble W/ Basic Color Tween
ok.
i have flash mx

frame one i create a circele with one color

click on frame 10, cpress f6(to create an identical keyframe to frame one, right)

by doing this the new objest is highlighted so i go to the properties window and change the color....


next i click on any frame between 1 and 10 and creat a motion tween from insert menu..

it still does not work.

the motion tween is dotted ... i know its supposed to be a solid line.

if i click on tframe 10 and create tween it change the objects to the same color.... what in tarnations is goin on here?!

please help.
thank you

Having Trouble With Tween Navigation (New To Flash)
http://douglas.mackenzie.natcoll.net...lash/index.swf
http://douglas.mackenzie.natcoll.net...lash/index.fla
is the link to the flash file.

The problem I am having is that it only tweens once. I wanted to be able to go back and forth - It just doesn't seem to respond after the first click.

Also it always goes the same way no matter where it's clicked. Can anyone work this out?

If anyone has time to read over this code it would be greatly appreciated.

Thanks


Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;

var xTween:Tween;
var yTween:Tween;

var castMc:cast = new cast;
addChild(castMc);
castMc.x = -580;
castMc.y = 145;
//castMc.buttonMode = true;

var trailerMc:trailer = new trailer;
addChild(trailerMc);
trailerMc.x = 120;
trailerMc.y = 145;
//trailerMc.buttonMode = true;

var datesMc:dates = new dates;
addChild(datesMc);
datesMc.x = 820;
datesMc.y = 145;
//datesMc.buttonMode = true;

castMc.addEventListener(MouseEvent.CLICK, navigate);
trailerMc.addEventListener(MouseEvent.CLICK, navigate);
datesMc.addEventListener(MouseEvent.CLICK, navigate);

var castXposFarLeft:Number = -1280;
var castYposFarLeft:Number = 145;

var castXposLeft:Number = -580;
var castYposLeft:Number = 145;

var castXposMiddle:Number = 120;
var castYposMiddle:Number = 145;

var trailerXposLeft:Number = -580;
var trailerYposLeft:Number = 145;

var trailerXposMiddle:Number = 120;
var trailerYposMiddle:Number = 145;

var trailerXposRight:Number = 820;
var trailerYposRight:Number = 145;

var datesXposFarRight:Number = 1280;
var datesYposFarRight:Number = 145;

var datesXposRight:Number = 820;
var datesYposRight:Number = 145;

var datesXposMiddle:Number = 120;
var datesYposMiddle:Number = 145;

function navigate(event:MouseEvent):void
{
if(event.currentTarget.name == "castMc")
{
setTweenCast(castXposMiddle, castYposMiddle);
setTweenTrailer(trailerXposRight, trailerYposRight);
setTweenDates(datesXposFarRight, datesYposFarRight);
}
else if(event.currentTarget.name == "trailerMc")
{
setTweenCast(castXposLeft, castYposLeft);
setTweenTrailer(trailerXposMiddle, trailerYposMiddle);
setTweenDates(datesXposRight, datesYposRight);
}
else(event.currentTarget.name == "datesMc")
{
setTweenCast(castXposFarLeft, castYposFarLeft);
setTweenTrailer(trailerXposLeft, trailerYposLeft);
setTweenDates(datesXposMiddle, datesYposMiddle);
}

//trace(event.currentTarget.name);
}

function setTweenDates(tweenX:Number, tweenY:Number):void
{
xTween = new Tween(datesMc, "x", Strong.easeOut, datesMc.x, 0, 4, true);
yTween = new Tween(datesMc, "y", Strong.easeOut, datesMc.y, 145, 4, true);

xTween.begin = datesMc.x;
yTween.begin = datesMc.y;

xTween.finish = tweenX;
yTween.finish = tweenY;
xTween.start();
yTween.start();
}

function setTweenCast(tweenX:Number, tweenY:Number):void
{
xTween = new Tween(castMc, "x", Strong.easeOut, castMc.x, 0, 4, true);
yTween = new Tween(castMc, "y", Strong.easeOut, castMc.y, 145, 4, true);

xTween.begin = castMc.x;
yTween.begin = castMc.y;

xTween.finish = tweenX;
yTween.finish = tweenY;
xTween.start();
yTween.start();
}

function setTweenTrailer(tweenX:Number, tweenY:Number):void
{
xTween = new Tween(trailerMc, "x", Strong.easeOut, trailerMc.x, 0, 4, true);
yTween = new Tween(trailerMc, "y", Strong.easeOut, trailerMc.y, 145, 4, true);

xTween.begin = trailerMc.x;
yTween.begin = trailerMc.y;

xTween.finish = tweenX;
yTween.finish = tweenY;
xTween.start();
yTween.start();
}

Tween Action Script Trouble
i need to make a tween in flash that repeats its self when it finishes. it needs to be 1 frame and be in action script 2.0 i have managed to make the tween but it wont play again.

Could any one give me and hand

Thanks
Stupid Saint

Trouble With 1st Kirupa Flash 8 Tween Tutorial
Hi,

I'm on a Mac and a Flash MX 2004 user. I attempted to do Kirupa's very basic animation tweening tutorial to get myself going with Flash 8, but I cannot get it to work.

The motion works fine, but when I introduced the alpha part, it started behaving erratically. It just won't fade IN.

I am familiar and comfortable with animation tweens involving motion and fades in MX 2004...

I tried just doing a fade in for a single letter, not even inside a movie clip (as the tutorial has you do), and didn't use motion -- just a fade in: Can't even get that to work.

Any ideas? Some silly thing I overlooked??

Thanks!

SL

Tween Class Trouble (based On The Tutorial)
Hey hey hey.

I was gonna have a fiddle with this tutorial http://www.kirupa.com/developer/actionscript/tween.htm
so I downloaded, unzipped, saved and published it. I didn't have a chance to fiddle with anything and it's already broken! I get this:

**Error** Scene=Scene 1, layer=actions, frame=1:Line 5: There is no property with the name 'onMotionFinished'.
xScaleT.onMotionFinished = function() {

**Error** Scene=Scene 1, layer=actions, frame=1:Line 8: There is no property with the name 'onMotionFinished'.
xPosT.onMotionFinished = function() {

Total ActionScript Errors: 2 Reported Errors: 2


Any ideas why guys? Cheers in advance.

<"))))><

Edit: MX04 by the way.

Scope Trouble... Unregister/ Remove Object / Tween ?
Hi,

I hope somebody can help with the following problem.
I'm trying to make a powerpoint kind of projector:
- Main flash movie: works as a container to load different flash files.
reacts on the left and right arrow buttons to go to the next or previous movie, which is loaded in a movieClip.

- Several external swf files all exported from the same: slide.fla only adjusting xml node settings make the differences in text and pictures.
This works, but after loading into the container I use to show the images the tween of my images gets messed up. (Not in the first loaded movie, but sure after around the third)

Please can anybody look at my code and tell me what could be the problem?
I'm sure it has to do with the scope after loading into the container.fla, and all the objects having the same name, for the submovies. (exported from the same .fla)
Do I have to unregister/ remove these objects after usage - I think this might be it, but don't know how.

In the container.fla I already set:
clipLoader_mc._lockroot = true;
but this doesn't solve the problem.


Code:
/// **************************** ///
/// START TWEEN METHODS FOR SCREENS ///
/// **************************** ///
var mcl_obj:Object = new Object();
mcl_obj.onLoadInit = function(target_mc:MovieClip):Void {
target_mc._width = 500;
target_mc._height = 395;
target_mc._x = 500;
var distance:Number = 5;
var angleInDegrees:Number = 45;
var color:Number = 0x000000;
var alpha:Number = 75;
var blurX:Number = 7;
var blurY:Number = 7;
var strength:Number = 1;
var quality:Number = 3;
var inner:Boolean = false;
var knockout:Boolean = false;
var hideObject:Boolean = false;
var filter:DropShadowFilter = new DropShadowFilter(distance, angleInDegrees, color, alpha, blurX, blurY, strength, quality, inner, knockout, hideObject);
var filterArray:Array = new Array();
filterArray.push(filter);
target_mc.filters = filterArray;
var tween_target:Object = new Tween(target_mc, "_y", Back.easeInOut, Stage.height, 300, 1, true);
tween_target.onMotionFinished = function() {
intervalClearScreenId = setInterval(ClearScreen, 8000, counter);
};
screenCounter++;
//initiated on top of the page.
};
function ClearScreen():Void {
var tween_screen:Object = new Tween(mover_mc, "_x", Strong.easeInOut, mover_mc._x, 1250, 1, true);
tween_screen.onMotionFinished = function() {
if (screenCounter<screenMaxCount) {
ShowScreens();
} else {
screenCounter = 0;
ShowScreens();
}
clearInterval(intervalClearScreenId);
};
}
ShowScreens = function ():Void {
// Create a movie clip instance.
this.createEmptyMovieClip("mover_mc", getNextHighestDepth());
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mcl_obj);
// Load an image into the movie clip
img_mcl.loadClip(imageArray[screenCounter], mover_mc);
};
//load XML voor screens on the left:
function loadScreensXML(loaded) {
if (loaded) {
_rootNode = this.firstChild.childNodes[imageNodeNr].childNodes[0];
trace(_rootNode);
total = _rootNode.childNodes.length;
for (i=0; i<total; i++) {
//add images to imageArray:
imageArray[i] = _rootNode.childNodes[i].firstChild.nodeValue;
}
screenMaxCount = imageArray.length;
//initiated on top of the page
//Show the screens:
ShowScreens();
} else {
content = "file not loaded!";
}
}
xmlScreens = new XML();
xmlScreens.ignoreWhite = true;
xmlScreens.onLoad = loadScreensXML;
xmlScreens.load(urlImagesXML);
/// **************************** ///
/// END TWEEN METHODS FOR SCREENS ///
/// **************************** ///
I'm trying all day already to solve this so please can anybody help?
Thanks in advance!

Tween Class: Can One Tween More Than One Property Using The Same Tween
I want to scale both the _xscale and the _yscale properties of a clip, using a single execution of the Tween Class. See example below:


Code:
import mx.transitions.Tween;
var myTween:Tween = new Tween(myMovieClip_mc, "_xscale", Strong.easeOut, myMovieClip_mc._xscale, 300, 5, false);

Since one property at a time must be passed as a string to the constructor, I tried the following code, but it does not work quite as flawless as I expected:


Code:
myTween.onMotionChanged = function() {
//trace( this.position );
myMovieClip_mc._yscale += (300 - myMovieClip_mc._yscale)/12;
};
Any suggestions?

Using Stop(); On A Shape Tween Of A Swapped Movie Clip Symbol Within A Motion Tween
Thanks a lot for your time. I'm new to actionscript, and language syntax and I never really got along to begin with so I appreciate any help in the matter.

Basically the title says it all - I made a motion tween in the main scene, made a movie clip symbol (to shape tween a gradient) and added a stop(); inside the gradient-tweened-symbol. I then swapped the movie clip symbol with the motion tween in the main scene, and got exactly the effect I wanted (the item moved, then tweened itself) but the stop(); seems to have no effect.

I know this looks like one of those "that idiot didn't google before posting" questions, but I've been looking for about a half hour with different permutations of stop, doesn't work, actionscript, and flash, and I haven't found anything that seems to target this problem specifically.

If you've got any idea what's going wrong, please feel free to respond or show me how to better seek help on my own. Thanks again.

Tween Class If Moved Mc Passed Point Start Another Tween
Hey Actionscript Gurus

Now I am using the Tween Class to move some boxes in my movie, now I can move the first mc and then another mc after the first tween has finished with onMotionFinished but I was hoping someone could help with how do I start the second tween when the first mc has passed a certain _x coordinate.

ie starting the second mc moving while the first tween is still moving.

I am trying to do a intro loader for my front page controlling around 7 boxes. So I need to repeat this a few times.

Regs,
Jacko

Tween Class If Moved Mc Passed Point Start Another Tween
Hey Kirupa Flash Gurus

Now I am using the Tween Class to move some boxes in my movie, now I can move the first mc and then another mc after the first tween has finished with onMotionFinished but I was hoping someone could help with how do I start the second tween when the first mc has passed a certain _x coordinate.

ie starting the second mc moving while the first tween is still moving.

Regs,
Jacko

Laco Tween Engine Versus Flash Native Tween
i am wondering if there is a way to put a delay (seconds) on the flashs' native tween class like you can on the laco tween engine... such as

Code:
#include "lmc_tween.as"
my_mc.tween("_x",100,1,"easeOutStrong",1.5,callbackFunction)
where "1.5" is would be the one and a half second delay before the tween starts. this is very useful to me because i dont have to use a callback function or an onMotionFinished function to start a new tween.

thanks in advance to anyone who can teach me

-frankf

Tween Class Scaling Breaks Motion Tween?
I have a movie clip which uses a motion guide to animate the entry (and eventually the exit) of a bunch of other movie clips. These smaller clips contain buttons, and animate on rollOver and rollOut using the following code:


Code:
on(rollOver) {
this.swapDepths(2);
ParentxScale = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Back.easeOut, this._xscale, 100/.6, .5, true);
ParentyScale = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Back.easeOut, this._yscale, 100/.6, .5, true);
play();
}
on(rollOut) {
ParentxScale = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Bounce.easeOut, this._xscale, 100, .5, true);
ParentyScale = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Bounce.easeOut, this._yscale, 100, .5, true);
stop();
}
However, once an object has been moused over, it doesn't exit with the others. Any ideas why it seems to "fall off the track" of the motion guide?

Shape Tween Like A Motion Tween, Using Guide Layer
How if possible, can i make a shape tween behave and follow a set path (like using a guide layer)while morhping/tweening?

So far it seems as each time i try it always goes in a straight line from a to b and in this case that's not what i'm after.

Diference Between Motion Tween And Shape Tween
What exactly is the difference between a motion tween and a shape tween?

What's The Best Way To Do A Motion Tween And A Shape Tween At The Same Time?
Hi all,

I'm having some difficulty doing this. I have tried motion tweening a movie clip containing a shape tween but it just doesn't look right. Anybody have any ideas?

Cheers

Do I Use A Shape Tween? Mask? Motion Tween?
How do I make this arrow grow into shape? I want it to slowly appear...but not fade in...

it's hard to explain...but here is the arrow, hopefully you will understand what I want...

I tried using a mask, but instead of revealing the arrow little by little, it dissapeared little by little...(basically the exact opposite)...

I also tried putting a white box over it & motion tweening the box to reveal the arrow...but that didn't look good...


any ideas?...suggestions?

thanks in advance...

What's The Difference Between A Shape Tween And A Motion Tween?
Hi!
I just wanted to ask that what is the difference between a shape tween and a motion tween???

Not to bother you.

please reply me back

[MX04] Shape Tween And Motion Tween
Why do Flash doesn't allow ungrouped objects into motion tween and symbols into shape tween?

After Tween, Jump To New Frame (using Tween Class)
I need some help with using the tween class (among other things).

See my attached test file. It's clearer than my description.

You're supposed to be able to click the "next" or "prev" buttons and see the movie clip move forwards or backwards. It works, but only on the first click of the button. After the initial click I need the timeline to jump to frame label "2", and after the second click I need the timeline to jump to frame label "3", and so on, so that I can implement a new set of perameters. Is that clear? I'm so annoyed with this. Please help!

Thanks.

Tween Class Problem. Tween Freeze?
I am using the tween class to do an alpha tween on some jpgs that get loaded into a movieclip. Everything thing works great until the user rapidly clicks on the 'next' arrow to jump forward to a new picture. If the user clicks too quickly something happens and the tween function stops working.

Here is the tween code:

Code:
//set up tweening
import mx.transitions.easing.*;
import mx.transitions.Tween;
var tweenAlpha:Tween;
function alphaTween(object,duration){
easeType = mx.transitions.easing.Regular.easeIn;
tweenAlpha = new mx.transitions.Tween(object, "_alpha", easeType, 0, 100, duration, true);
}
http://12dogsofchristmas.com/12_dogs_menu2.swf

You'll notice that if you click slowly on the arrows the pictures load correctly with the story. However, if you click fast they stop tweening.

thanks for the help.

Change From Motion Tween To Shape Tween
I am trying to have a motion tween of some text move on the page and then change into a shape (i.e, a shape tween). I can't seem to make this work. I put a keyframe at each end of the motion tween and that works fine. Then I add another keyframe, delete the text and replace it with my shape. Then I select just those frames and add the shape tween but nothing happens. How do I accomplish this successfully?

Thanks.

Shape Tween / Motion Tween Problem
I must be missing something very obvious.

I have created a movie that draws a box, fills in the box with color and then is supposed to have the menu swoop in from the right. Mind you this is for learnnig, not cosmetic appeal Why is it when I use tweens I get the dotted line versus a solid line in the time line?

If you take a peek at the FLA it is obvious what I am referring to. I must be using the tween function or symbols in an improper manner.

I have attached the FLA.
Any help appreciated.
Thanks,
Kerry
www.skurz.com

Tween.stop(). Part Of The Tween Class?
I need to know if tween.stop() is part of the Tween class in Flash 8 or if it's related to an extension I installed (ie. TweenExtended).

How To Programmatically Begin A Tween When Another Tween Ends?
Hey everybooody,

In this example, I'm trying to programmatically fade-in the alpha of menu items created from xml data. Using the tween object, I'm trying to start the next tween once the first or previous tween has finished.

Clearly in my attempt below, the “if” statement isn't cutting it because it's not waiting for the tween to be finished.

Using the oListener.onMotionFinished method, I tried using a Boolean to return true when finished, and then to start the next tween. But clearly I haven’t figured out the proper control flow for this.

I also tried a 'do while' statement, attempting to creating a waiting-loop until the bCheck returned true, but that just created a series of open loops, and crashed the program.

The big problem here is that I'm trying to figure out how to do this while looping through an array of menu items, so that I triggure the fade in of each menu item...



Has anyone had experience with this? Thanks!!!

Here's what I was trying to do:

function fadein_menu() { var bCheck:Boolean = false;
var oListener:Object = new Object();
oListener.onMotionFinished = function(twObject:Tween):Void {
bCheck=true;
};
for (var i = 0; i<totalMenuItems; i++) {if (i==0) {var twMenuAlpha:Tween = new Tween(menuitems[i], "_alpha", Strong.easeIn, 0, 100, 3, true);
twMenuAlpha.addListener(oListener);
} else if (i>0) {if (bCheck==true) {bCheck=false;
var twMenuAlpha:Tween = new Tween(menuitems[i], "_alpha", Strong.easeIn, 0, 100, 12, true);
twMenuAlpha.addListener(oListener);
};
};
};
};

Tween Class Not Always Fulling Complete Tween
I have a switch statement that is a part of the tween effects found on the header of http://gfxcomplex.com/blog.

the problem is this case will change the rotation of a sprite and then tween it to zero. The funny thing is some times ("not all the time") some of the tween stop in the middle and do not complete leaving the sprite with a rotation somewhere in the middle of 180 to 0. My question is, is there something in my code that could be the reason for this or is this a bug??

You may have to watch the header for a long time to see this bug happen as it seems to be more a fluke then a true code bug.


PHP Code:



case 7 :            var u:uint = 0;            test1.getChildAt(0).rotation = 180;            test1.getChildAt(1).rotation = 180;            test1.getChildAt(2).rotation = 180;            test1.getChildAt(3).rotation = 180;            test1.getChildAt(4).rotation = 180;               intervalId = setInterval(function myFunction(){                                                          myTween1 = new Tween(test1.getChildAt(u), "rotation", Bounce.easeOut, 180, 0, 3, true);                                                          u++;                                                          if(u == 5){                                                                                                                      clearInterval(intervalId);                                                                                                                        }                                                          },                                                          150);break; 

Shape Tween / Motion Tween Problem
I must be missing something very obvious.

I have created a movie that draws a box, fills in the box with color and then is supposed to have the menu swoop in from the right. Mind you this is for learnnig, not cosmetic appeal Why is it when I use tweens I get the dotted line versus a solid line in the time line?

If you take a peek at the FLA it is obvious what I am referring to. I must be using the tween function or symbols in an improper manner.

I have attached the FLA.
Any help appreciated.
Thanks,
Kerry
www.skurz.com

Seperating Motion Tween From Alpha Tween
I am trying to fade in the alpha on a graphic symbol rather quickly at the same time the symbol scrolls very slowly up the stage, but the two seem linked, so that a very slow scroll means a very slow opacity gain. How can I fade the photo in quickly while the photo motion tweens slowly?

Laco Tween Pause/Stop Tween
Hi There,

I am using laco tween to move dynamic text that is taken from XML. I need the text to pause when the user rollsover the text, is there anyway of using the stopTween() function, then on rollOut getting flash to continue with the tween?

Thanks.

Dabush

Jerky Tween- How To Get A Smooth Slow Tween- Help
I'm working with a very slow tween of an image (800 by 350px and 50 kb) over a time of 60 seconds and it's jerky.

Code:

Tweener.addTween(pic, {x:pic.x-100, time:60, transition:"linear"});

I tried upping the frame rate to 30, then 60, but it didn't seem to make a difference.

I also tried using TweenLite, Tweener, and the built-in Tween class. None really performed better than the other. Another thing I tried was importing the image as a swf, masking it, and then tweening it. None of those really made a difference, still jerky.

Any ideas?

How To Motion Tween Thats Not Linear Using Script Or MC Tween?
If you wanted to do an animation of a ball that goes from A to B but not linear, how would you do it by code or Mc tween. How would you make the ball go in a curve line for example instead of a straight line from A to B?

I understand you can use a guide to get all types of non linear motion tweens on a timeline, but how would you do it using MC tween or coding.

Motion Tween & Shape Tween In Same MC? How?
I have created a shape tween on my first layer. On my second layer I would like to create a motion tween. But the motion tween says it will not occur with layers with shapes or more than one group. Can anybody enlighten me a little bit on this.


Thanks for any help that is given.

Derek

Make Exit Tween Do Into Another Tween
okay here's the deal. for every button i have on a flash menu. i have a lil animation tween that plays when the specific button it's set for it clicked on.

what i would like to do is add an exit tween for each of these animations that does the reverse of the animation before starting up the new animation.

now... this could probably be done using gotoandplay actionscript with frame labels, but i would have to make special sets of buttons for each section...

is there another easier why for the button to play the exit tween when pressed then go to the tween of whatever button was pushed??

please let me know...

K-Fresh

Tween Class Vs Custom Tween?
I have searched for info on the Tween class, gave up when I found little to nothing on it, so here I am with some questions.

1 - Can I use this class in MX 2004 or is it in 8 only? If so, what is the invocation script?

2 - How flexible is the easing of the Tween class? Can it do more than just fast/slow in/out (fully customizable time curves)?

3 - Can you specify a finite amount of time in which the current invocation of Tween must be completed, or do you have to calculate and apply values to enforce this?

Thanks,
+Q__

[F8] Mx.transitions.Tween Set Quality During Tween
Code:
function tweenull(clip:Object, targetX:Number, targetY:Number, seconds:Number):Void {
new mx.transitions.Tween(clip, "_x", mx.transitions.easing.Elastic.easeOut, clip._x, targetX, seconds, true);
new mx.transitions.Tween(clip, "_y", mx.transitions.easing.Elastic.easeOut, clip._y, targetY, seconds, true);
}

this is my tween function. How can i set the quality to low during the tween action ?

Tween Class - Tween Lines
I have 5 seperate movie clips that each contain 5 lines, which are contained within their own individual movieclips, each with their own instance name.

I have written a function, included below, that uses the tween class to make one set of lines move/morph to the location of the second set, contained within the other movieclip.

It's basically a transition.. it's for the navigation of a site I'm working on. When you click a different navigation link, the lines that the nav & content are based around morph/change.

The problem I'm having is not all the lines tween to the right location/position. I've attached a 2 screenshots to show..

I've tried the function with the addition of the _xscale, _yscale, and _rotation properties, but they don't change anything.

Heres the function:


Code:
function moveLines(begin, end) {
//this moves the MC that holds the 5 lines to the x/y pos of the other MC.
var x_container:Tween = new Tween(_root[begin], "_x", Regular.easeOut, _root[begin]._x, _root[end]._x, 10, false);
var y_container:Tween = new Tween(_root[begin], "_y", Regular.easeOut, _root[begin]._y, _root[end]._y, 10, false);


//this is the loop that gets the start/end variables and creates the tweens
for (i=1; i<=5; i++) {
x_begin = _root[begin]["l" + i]._x;
x_end = _root[end]["l" + i]._x;

y_begin = _root[begin]["l" + i]._y;
y_end = _root[end]["l" + i]._y;

height_begin = _root[begin]["l" + i]._height;
height_end = _root[end]["l" + i]._height;

width_begin = _root[begin]["l" + i]._width;
width_end = _root[end]["l" + i]._width;

var x_tween:Tween = new Tween(_root[begin]["l" + i], "_x", Regular.easeOut, x_begin, x_end, 15, false);
var y_tween:Tween = new Tween(_root[begin]["l" + i], "_y", Regular.easeOut, y_begin, y_end, 15, false);
var height_tween:Tween = new Tween(_root[begin]["l" + i], "_height", Regular.easeOut, height_begin, height_end, 15, false);
var width_tween:Tween = new Tween(_root[begin]["l" + i], "_width", Regular.easeOut, width_begin, width_end, 15, false);
}
}
Now here are the screenshots. The first is before the tween occurs, and the second is after. As you can see, some of the lines don't fall into the right position. Any help is greatly appreciated! I have a deadline for this this week and I'm freaking out!

before tween:
http://sagebrown.com/before.jpg

after tween:
http://sagebrown.com/after.jpg

How To STOP A Tween With The Tween Class?
here's my code....


Code:
function generalTween(mc, attr, begin, end, time, func, easeType)
{
if (easeType == undefined) easeType = mx.transitions.easing.Bounce.easeOut;
var myTween = new mx.transitions.Tween(mc, attr, easeType, begin, end, time, true);
if (func != undefined) myTween.onMotionStopped = func;
}
function onReleaseFunc()
{
myBall.stopDrag();
generalTween(myBall, "_x", myBall._x, (Stage.width / 2), 2, undefined, mx.transitions.easing.Elastic.easeOut);
generalTween(myBall, "_y", myBall._y, (Stage.height / 2), 2, undefined, mx.transitions.easing.Elastic.easeOut);
}
myBall.onPress = function()
{
myBall.startDrag();
}
myBall.onRelease = function()
{
onReleaseFunc();
}
myBall.onReleaseOutside = function()
{
onReleaseFunc();
}
To test this just make a movieclip on your stage and give it an instance name of "myBall"

you'll notice that the problem is, if you try to click and drag the movieclip again before the tween is completed finished, then it doesn't work.

How can you force a stop on a tween?

thank you so very much in advance!!!!

Tween Vs Non-Tween Which Is Intensive On Processor
Im working on a Real time strategy game in AS3 currently, and for unit movement I need to decide whether or not I should use Tweens or looping functions which update the .x and .y parameters of the movieclips on screen.

Currently the game uses Tweens from the start position to end position, with a speed variable defining how fast it should move, but currently there are very few units moving at once. I could however use a looping function which checks to to see which units need to be moved each cycle and moves them accordingly.

The question is which with considerable amounts of units on screen at once would be less processor intensive? OR is there some other method I could use?

End 1st Tween Start 2nd Tween {Newbie}
Hi

I'm thinking of that close all day long I can't find an answer for it.
I want that the mc clip 'rahmen' play's the tween 'move' first and than when the move tween is finishe start to play the 2nd tween 'mover'.

How could I do that?

PHP Code:



stop();

MovieClip.prototype.mover = function(distX, distY, breite, hoehe, speed) {
    this.onEnterFrame = function() {
        this._x += (distX-this._x)/speed;
        this._y += (distY-this._y)/speed;
        this._width += (breite-this._width)/speed;
        if (this._width === breite); {
            this._height += (hoehe-this._height)/speed;
        }
    };
};

MovieClip.prototype.move1 = function(ys, al, tar) {
    this.onEnterFrame = function() {
        this._y -= ys;
        this._alpha += al;
        if (this._y <= tar) {
            delete this.onEnterFrame;
        };
    };
};
    

_root.attachMovie("mc_rahmen", "rahmen", 100, {_alpha:100, _x:200, _y:400});
rahmen.move1(2, 10, 200);
rahmen.mover(200, 200, 200, 100, 40); 




I hope somebody could help me please.

thx a lot

Newbie_AS

Playing Another Tween As The Other Tween Ends
Hi,

I am currently working on a web site and i cannot run a another tween animaton when i click on another button.
i have a main MC( with 4 buttons on it) on the stage and when i click on a button it animates 2 blocks that have been created at runtime and goes from right to left.
What i want is when i click on another menu button, the boolean changes and i must be able the rewind the animation and do another but it does not work.I must click twice, once it rewind and the 2nd one it shows the animation..

Please help as it is quite urgent.

jerome.chevreau@gmail.com

Please please

Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved