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




Tween Class For Movement?



Hi...What is the best way to scale and move objects in Flash these days? The code I have always used doesn't seem to work as nice in version 8. I'll post a sample of what I am talking about. The redraw of the image in 8 seems jagged and a little blurry. Or is that just the way it is now?http://schmidtmediaco.com/flashtest/Thanks,Dan



General Flash
Posted on: Thu Jun 29, 2006 3:52 pm


View Complete Forum Thread with Replies

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

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

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?

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?

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.

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).

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; 

Tween Class Applied In Custom Class Not Working
var sizerW:Object = new Tween(pda_mc,"_xscale",mx.transitions.Tween.None.e aseNone,pdaOrigW,pdaSmallW,3,true);

this code produces and error when applied in a custom class but not in a fla?

the error = There is no property with the name 'None'.

Tween Class In Custom Extend MovieClip Class
I want to use the tween prototype in a custom class that extends MovieClip. I am already including "lmc_tween.as" in my root and I have already replaced the "MovieClip.as" file in my flash directory with the one from the shared/Zigo directory. However, I still get compiler errors if I try to include "lmc_tween.as" in the class file, or without the include in the class it will compile but the tween prototype will not work in the custom class. Does anyone know how to fix this?

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__

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 Movement Using AS
I want to move a movie clip from startx and starty to endx and endy using AS
but have it calculate the smallest distance and move the MC at a set speed accordingly so both X and Y stop in the right place at the same time.

in other words i want a small script to act like i have just tweened a MC
Tween:
MC _X=0
MC _Y=0
Create Motion tween on frame 0
move on 50 frames
Create Motion tween on frame 50
set the _X from 50 to 100
set the _Y from 50 to 200
play()

The movie clip moves to frame 50 but the _X moves at a slower speed than the Y because it has less distance to travel

can someone show me how this is done in AS
with a startX of 0 and a startY of 0
end X of 100 and an end Y of 200

Tween Movement
Hi, some long time ago i downloaded some thing where is could choose between tween movements. When i have a motiontween then i can choose erase 100 or -100 to make te movement smooth, the thing i downloaded long time ago had some other ways to let a objectmove smooth or bounce etc. I think i had a option in the "Insert/.." menu

Im looking for that.

Tween Movieclip Movement
I have a button, which when clicked moves a movieclip to a new position. Is there code which cn be addedto make the movement of the clip smoother because right now it just jumps.

Originally Posted by My current code
hide_btn.onPress = function() {
mainbg_mc._x -= 130;
}

Diagonal Movement With Tween
is it possible to do diagonal movement? with tweens?

Tween Class & Button Class
Sorry I accidently made two threads.. can this be deleted please??

Can You Actionscript A Tween For More Fluid Movement?
Here is the delima: I have seen a site that uses moving 3 boxes as a design element. I liked the design so I copied it when makeing my site. Only problem is mine moves somewhat jittery and his is smooth. I have tried increasing the frame rate to no avail. I have come to the conclusion that this could only have been created with actionscript to make it so smooth. Please compare the two sites to see what I am talking about.

His site: http://stevenlippman.com
My site: http://domophoto.com

Tween Mouse Movement Based On...
Searched the forum and couldn't find the mouse movement using the ._x/._y tween class to move based on another mc's dimension to give me the idea how to work on it. Could use some help here to nudge me the right direction...

jace

Movement A Bit Jumpy With Motion Tween
I have created a simple motion graphic.

the content is a static background, two lines, and some words. I have set up a mask layer so that as the two lines (one horizontal, and one verticle) move accross the graphic, the words are revealed.

my problem is that instead of a nice smooth movement of the lines and the mask, it jumps. Granted the jumping is very small increments, but it is deffinitly noticeable.

any ideas how to make motion tweens smooth?

thanks
Ras

How Do You Create A Smoother Tween Movement
I have created a simple opening sequence on a Flash splash page. The background simply motion tweens from point A to point B (right to left) and stops on the stage. So far so good. The trouble is the tween movement over a ten second period appears jerky or choppy, even though I have it set at 24fps. Is there anyway to fix this problem?

Tween Combination Odd Movement (curving Round)
Ive got some balloons I want to zoom through, so I need to do them all, but Im just working on one and the problem is instead of moving diagonally and enlarging it curves around annoyingly and I dont understand why.

I am scaling from 30% as thats how large the mc is to start with on the canvas (the mc is 30% so in the code the function has to start from 30% otherwise it just uses 100% for some reason, this may be why its messing up I dont know)

I really need someone to look at the file I think, just look at how the balloon curves around rather than moving in a line.


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

var scaleFrom = 30;

function zoom(){
var mcXScale:Tween =
new Tween( balloon1, "_xscale",
Regular.easeIn, scaleFrom, 200, 4, true );

var mcYScale:Tween =
new Tween( balloon1, "_yscale",
Regular.easeIn, scaleFrom, 200, 4, true );


var mcYMove:Tween = new Tween(balloon1,"_x",Regular.easeOut,250,-170,4,true);//250 is x location of mc, next num is where to go on x axis, 4 is time
var mcXMove:Tween = new Tween(balloon1,"_y",Regular.easeOut,340,1000,4,true);//340 is y location of mc, next num is where to move to on y, 4 time
//

};

hope someone can help (code is on main line, click balloon in distance for the animation to happen)

Attachment:
http://homepage.ntlworld.com/spensley/portProb.zip

Image Movement Problem On Alpha Tween
Occasionaly when I do a motion tween on a jpeg (that I converted to a symbol) from 0 alpha to 100 alpha, the image seems to move slightly (jumps around a pixel or so) as it fades in? Has anyone has this problem and know a way around it?

Thanks & Regards
Weevil

Actionscript Movement Corrupt The Motion Tween
I have a MoveiClip in my stage, I use actionscript to move it to some other position. It works great.But in some frames later I inserted a keyframe and I used the same movieclip for a motion tween. but this motion tween is not considered at all. what's the problem.... how should I fix it ?!

the main goal of doing such a thing is below :

I'm doing a game, in the desired movieclip there are some other of movieclips which will be visible / invisible due to some conditions. after finishing the game I want the same MovieClip ( with exactly the same properties of visible / invisible internal movieclips) to start a motion tween, but It doesn't start the motion.

Rnadom Movement Class
I currently have this code attached to multiple movieclips on my stage. But, I have two questions regarding the code:


Code:
onClipEvent (load) {
width = 5
height = 5
accelFactor = Math.ceil(Math.random()*4) + 2;
newX = Math.round(Math.random()*width);
newY = Math.round(Math.random()*height);
}

onClipEvent (enterFrame) {
currentlocx = this._x;
currentlocy = this._y;
differencex = newX-currentlocx;
differencey = newY-currentlocy;
accelx = differencex/accelFactor;
accely = differencey/accelFactor;
this._x = this._x+accelx;
this._y = this._y+accely;
if (Math.round(this._y) == Math.round(newY) && Math.round(this._x) == Math.round(newX)) {
newX = Math.round(Math.random()*width);
newY = Math.round(Math.random()*height);
accelFactor = Math.ceil(Math.random()*4) + 2;
}
}
1) How can I make this into a class so that I can link the class to the movieclips?

2) How can I make it so that the clips are independent of the stage. Because right now, if you attach this code to a clip and test the movie the clips go to the upper left corner. I want them to be independent of the _root x and y. So it would basically hover wherever you place the clip on the stage

Thanks,

-- K

Tween Class
for some reason i can not get the alpha to fade out a dynamic text box

attached it the .fla

just run, and click the box in the centre (bottom left is simple for test purposes)

[f8]Using The Tween Class
Hi everyone


I have this script

PHP Code:



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

var myRan:Number = (Math.random()*15000)+10000;
var firstRandom:Number = 290;
var secondRandom:Number = (Math.random()*370)+50 ;

setInterval(movePlayer,myRan);
movePlayer = function(){
    var yScaleT:Tween = new Tween("musicPlayer", "_y", Elastic.easeOut , firstRandom, secondRandom, 1.5, true);
    firstRandom = secondRandom;
    secondRandom = (Math.random()*370)+50 ;
    myRan = (Math.random()*15000)+10000;
    setInterval(this,myRan);
}




Basically what I want it to do is:
after [10 + random amount]seconds it should call up the function movePlayer
this function tweens the _y of the instance musicPlayer.
At first, the _y should start at 290(firstRandom) and move to a random number between 50 and 420(secondRandom). Then, firstRandom gets the value of where it is right now, and another secondRandom is being defined.
Then, the function does a setInterval on itself, again with [10 + random amount]seconds.

Now, what am I doing wrong? Any sort of syntax error? Logic error?
Please help
Thanks

[AS3] Tween Class Bug?
I have a problem with the Tween Class that I do not understand.

If I put several tweens in a loop - rewind and start them again -
they suddenly stop(!!) after a while (about 10 sec).
http://www.coldminer.com/nwf/test/test1.php

But when I put the code in an extended Sprite Class with the
DisplayObject everything works as expected.
http://www.coldminer.com/nwf/test/test2.php

Ok, "problem solved", but why is this? I don't understand.
Is it a bug, or am I doing it wrong?
It works in AS2 (Test 3).
http://www.coldminer.com/nwf/test/test3.php

Code is available on the examples

Anyone?

Can This Be Doing Using The Tween Class?
after months of trying to figure out why the animation gets corrupted using what appears to be a simple script i now must resort to the tween class.

is there anyway i can get this effects using the tween class?
http://nubianniht.com/

please help

thank you

*don't press the buttons unless you want to see the animation corrupt

Using Tween Class
I am having an issue with setting dynamic values in the tween class parameters. I want to make a function I can use for moving multiple objects using the teen class. The start and end point are dynamic based on the current location of the object, but I cannot seem to figue out a way to pass that value into the parameters of the tween class.

I have the end point hard coded based on an equation clip_y + 200 or clip_y - 200. If I click the object once, and then click it again before it reaches the it's first destination the return code has the wrong destination value because clip_y has not reached its destination.

Anyone hav any suggestions for creating a calculation that will not require me to hard code a value for the destination?

Here is the code I am currently using

import mx.transitions.Tween;
import mx.transitions.easing.*;
BarStatus = "closing"

BarDown = function(barName){

var bar = barName
var begin = barName._y;
var end = barName._y + 300;

yPosTween = new Tween(bar, "_y", Strong.easeOut, begin, end, 2, true);

}

BarUp = function(barName){

var bar = barName
var begin = barName._y;
var end = barName._y - 300;

yPosTween = new Tween(bar, "_y", Strong.easeOut, begin, end, 2, true);

}


_root.design_mc.onPress = function(){
if(BarStatus == "closing"){

//Open the nav
BarDown(web_mc);
BarDown(print_mc);
BarDown(interactive_mc);
BarDown(advertising_mc);
BarStatus = "opened"

}

else{

//Close the Nav
BarUp(web_mc);
BarUp(print_mc);
BarUp(interactive_mc);
BarUp(advertising_mc);
BarStatus = "closing"
}

}

Tween Class
Can someone take a look at this I just cannot figure out what to do or what I am doing wrong.

When the icon is clicked I would like it to get a new x & y position as well as the over and out and released functions to stop working after I click the icon.

Here is the example

Here is the code


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

var theClips:Array = new Array(blank1, blank2, blank3, blank4, logo, theatre, soundSystem, webDesign, maint, backup, av, net, webDev, eComm);
for (var i:Number = 1; i < theClips.length; i++) {
// For performance and ease of typing, set up a reference to the current clip.
var aClip = theClips[i];
aClip.onRollOver = over;
aClip.onRollOut = out;

// Animate them in.
var tw1:Tween = new Tween(aClip, "_xscale", Elastic.easeOut, 0, 80, i*.8, true);
var tw2:Tween = new Tween(aClip, "_yscale", Elastic.easeOut, 0, 80, i*.8, true);

/*var tw1:Tween = new Tween(logo, "_xscale", Elastic.easeOut, 0, 80, 2, true);
var tw2:Tween = new Tween(logo, "_yscale", Elastic.easeOut, 0, 80, 2, true);

var tw1:Tween = new Tween(theatre, "_xscale", Elastic.easeOut, 0, 80, 2, true);
var tw2:Tween = new Tween(theatre, "_yscale", Elastic.easeOut, 0, 80, 2, true);*/

// Set up the mouse actions.
aClip.onRollOver = over;
aClip.onRollOut = out;
aClip.onRelease = released;
}

function over():Void {
var tw1:Tween = new Tween(this, "_xscale", Elastic.easeOut, 80, 100, 2, true);
var tw2:Tween = new Tween(this, "_yscale", Elastic.easeOut, 80, 100, 2, true);
}
function out():Void {
var tw1:Tween = new Tween(this, "_xscale", Elastic.easeOut, 100, 80, 2, true);
var tw2:Tween = new Tween(this, "_yscale", Elastic.easeOut, 100, 80, 2, true);
}

function released():Void {
for (var i:Number = 0; i < theClips.length; i++) {
t.xPos = aClip._x;
t.yPos = aClip._y;


if (this == theClips[i]) {



var tw1:Tween = new Tween(this, "_xscale", Elastic.easeOut, 100, 250, 2, true);
var tw2:Tween = new Tween(this, "_yscale", Elastic.easeOut, 100, 250, 2, true);
var tw4:Tween = new Tween(this, "_x", Strong.easeOut, _x, t.xPos, 5, true);
var tw5:Tween = new Tween(this, "_y", Strong.easeOut, _y, t.yPos, 5, true);



} else {
theClips[i]._visible = false;
}
}
delete over;
delete out;
delete released;
}

Best Tween Class?
I need a tween class that doesn't add much file size to a .swf, but I need it to work sort of like Fuse. (doesn't have to be as in depth) I tried tweenLite, but haven't really gotten into it. Anyone know of a open source tween class that fits the bill?

Using The Tween Class
Hi, I have 10 square movie clips in a row, all contained within a clip called 'container_strip'. when i click on a clip i have written code so that the container tweens so the clicked clip is in the middle of the screen and then it expands (using the tween class to grow its xscale and yscale values). My problem is I need the following clips in the strip to move along the x axis so they move out of the way of the selected clip while it grows. The way i was trying to do it was:


Code:

for(var i=currentClipNumber+1; i=numOfClips; i++)
{
//produces the correct name for the clip to be tweened
bumpclip = eval("_root.container_strip.clip"+i);

var (eval("bumpTween"+i)) = new Tween (bumpclip, "_x",
Strong.easeOut, bumpclip._x, bumpclip._x+200, 1, true);
}

when compiled it throws up this error:
**Error** D:ACTIONSCRIPTclusta_projectsclipClass.as: Line 29: Identifier expected
var (eval("bumpTween"+i)) = new Tween (bumpclip, "_x",


the problem is it wont evaluate a unique name for the tween instance on each loop...does any one know a different way of doing this?

Tween Class Help
I have 66+ image thumbnails in a scrolling panel and I would like to use a tween class on then ?

this is what I have now


Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
//Loads the xml
var xml:XML = new XML();
xml.ignoreWhite = true;
var url:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number;
xml.onLoad = function() {
var photo:Array = this.firstChild.childNodes;
for (i = 0; i < photo.length; i++) {
url.push(photo[i].attributes.url);
captions.push(photo[i].attributes.caption);
}
holder.loadMovie(url[0]);
caption.text = captions[0];
whoIsOn = 0;
};
xml.load("image.xml");
//Gallery panel
panel.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = stroke.getBounds(_root);
function scrollPanel() {
if (_xmouse < b.xMin || _xmouse > b.xMax || _ymouse < b.yMin || _ymouse > b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
if (panel._x >= 42) {
panel._x = 42;
}
if (panel._x <= -1870) {
panel._x = -1870;
}
var xdist = _xmouse - 400;
panel._x += Math.round(-xdist / 11);
}
This is the code I have for each (66+) thumbs now.

Code:
panel.s1.onRollOver = function() {
panel.s1.swapDepths(this.getNextHighestDepth());
new Tween(panel.s1, '_xscale', Elastic.easeOut, panel.s1._xscale, 100, 1, true);
new Tween(panel.s1, '_yscale', Elastic.easeOut, panel.s1._yscale, 100, 1, true);
};
panel.s1.onRollOut = function() {
new Tween(panel.s1, '_xscale', Elastic.easeOut, panel.s1._xscale, 50, 1, true);
new Tween(panel.s1, '_yscale', Elastic.easeOut, panel.s1._yscale, 50, 1, true);
};
panel.s1.onRelease = function() {
holder.loadMovie('images/l1.jpg');
};
panel.s2.onRollOver = function() {
panel.s2.swapDepths(this.getNextHighestDepth());
new Tween(panel.s2, '_xscale', Elastic.easeOut, panel.s2._xscale, 100, 1, true);
new Tween(panel.s2, '_yscale', Elastic.easeOut, panel.s2._yscale, 100, 1, true);
};
panel.s2.onRollOut = function() {
new Tween(panel.s2, '_xscale', Elastic.easeOut, panel.s2._xscale, 50, 1, true);
new Tween(panel.s2, '_yscale', Elastic.easeOut, panel.s2._yscale, 50, 1, true);
};
panel.s2.onRelease = function() {
holder.loadMovie('images/l2.jpg');
};
panel.s3.onRollOver = function() {
panel.s3.swapDepths(this.getNextHighestDepth());
new Tween(panel.s3, '_xscale', Elastic.easeOut, panel.s3._xscale, 100, 1, true);
new Tween(panel.s3, '_yscale', Elastic.easeOut, panel.s3._yscale, 100, 1, true);
};
panel.s3.onRollOut = function() {
new Tween(panel.s3, '_xscale', Elastic.easeOut, panel.s3._xscale, 50, 1, true);
new Tween(panel.s3, '_yscale', Elastic.easeOut, panel.s3._yscale, 50, 1, true);
};
panel.s3.onRelease = function() {
holder.loadMovie('images/l3.jpg');
};

Tween Class
Trying to use a zoom in zoom out effect:

ActionScript Code:
import mx.transitions.Tween;
var mc:MovieClip = northern_mc;
function zoomIn(){
            var xs:Tween = new Tween (mc, "_xscale", mx.transitions.easing.Back.easeOut, this._xscale, 150, 1, true);     
            var ys:Tween = new Tween (mc, "_yscale", mx.transitions.easing.Back.easeOut, this._yscale, 150, 1, true);
}
function zoomOut(){
            var xs:Tween = new Tween (mc, "_xscale", mx.transitions.easing.Back.easeOut, this._xscale, 100, 1, true);     
            var ys:Tween = new Tween (mc, "_yscale", mx.transitions.easing.Back.easeOut, this._yscale, 100, 1, true);
}

northern_mc.onRollOver=function(){
    zoomIn();
}
northern_mc.onRollOut=function(){
    zoomOut();
}
Ideally I would like to use these functions for multiple mc's, but at the moment I cannot get my head round it.... Can anyone help me out?

Cheers

Tween Class
any idea how i use tween class with infinite moviment not set end var?

if i cannot do with tween class any other idea to make that?

Tween Class?
I have this code


Code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

public class LightUpSquare extends MovieClip
{
public function LightUpSquare()
{
fill_mc.alpha = .2;
fill_mc.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver);
fill_mc.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut);
}
private function handleMouseOver(event:MouseEvent):void
{
fill_mc.alpha = .5;
}
private function handleMouseOut(event:MouseEvent):void
{
fill_mc.alpha = .2;
}
}
}
this works fine and everything. But I want to fade in and fade out instead of simply cutting in.

Also, is that issue fixed now... where in AS 2.0 with the tween class, if you started a tween while another one was finishing, and the second one finished before the 1st one finished, then it would jump back to finishing the 1st one. that was REAL annoying.

Tween Class Help
Hey actionscript.org,

If anyone is willing to help me with this, I'd greatly appreciate it!

I'm completely new to the tween class, but not to flash.

Right now I'm working on making an image "fadeshow". (One image fades out as another one fades in, etc.)

I can do this using regular motion tweens, but it seems like there has GOT to be an easier way to do this. I know there is!

I've got 7 movie clips that I want to fade in and out, one after another, and they need to be clickable for website links.

Anyone willing to help?

Thanks in advance! :]

Tween Class
I am creating a site that has buttons that move based on what is clicked. So when you click on the portfolio button the three buttons below it slide down to reveal some more buttons. I'm trying to use the tween class to move the buttons but I cant seem to get it to work.

I have two separate files. The main page and the portfolio page.

I want the portfolio to load right away and slide the buttons below it down then when the user clicks on something other than the portfolio page the buttons slide up...so far I can't even get them to slide down.

Here is what I have:

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

var about_Tw:Tween = new Tween(about_mc, "y", Regular.easeIn, 140, 245, 3, false);
var resume_Tw:Tween = new Tween(resume_mc, "y", Regular.easeIn, 175, 280, 3, false);
var contact_Tw:Tween = new Tween(contact_mc, "y", Regular.easeIn, 210, 315, 3, false);

function portfolio_on() {
var portfolio_Vis = true();
about_Tw.start();
resume_Tw.start();
contact_Tw.start();
content_mc.loadMovie("portfolio.swf",1);
}

stop();

portfolio_bt.onRelease = function() {
if (portfolio_Vis == true) {
trace("portfolio is true");
} else if (portfolio_Vis == false) {
var portfolio_Vis:Boolean = true();
portfolio_on();
content_mc.loadMovie("portfolio.swf",1);
}
};
I hope this makes sense.

Thanks,
Josh

Tween Class ...help Please
hi,
i'm trying to recreate the navigation on http://www.spin.co.uk.
so far i could exchange the buttons correctly, but can't get them to ease..
tried the new Tween class (?) but this is not working.

i've got 3 buttons in an array so far["a", "b", "c"] which have this action and a, b and c as parameters in the getIndex function:

on (release) {
location = countries.getIndex("a");
checker(location);

}

on my first frame of the timeline if got this rather wild looking code
rather muddling through it...really

countries = ["a", "b", "c"];
w0 = _root[countries[0]]._width;
w1 = _root[countries[1]]._width;
w2 = _root[countries[2]]._width;
x0 = 220;
b0 = _root[countries[0]]._x;
b1 = _root[countries[1]]._x;
b2 = _root[countries[2]]._x;
e_off = -120;
e0 = x0;
e1 = x0+w1;
e2 = x0+w1+w2;
//shuffle function
shuffle = function () {
countries2 = countries.shift();
countries.push(countries2);
}
/////
///getindex functon
Array.prototype.getIndex = function(data) {
for (i=0; i<this.length; ++i) {
if (this[i] == data) {
return i;
}
}
return -1;
}

//tween
function move(b, e, temp) {
easeType = mx.transitions.easing.Bounce.easeOut;
var begin = b;
var end = e;
var time = .5;
var mc = temp = this;
Tween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
}

///////move function
checker = function (location) {
if (location != 0) {
if (location == 1) {
_root[countries[0]].move(b0, e_off, temp);
_root[countries[1]].move(b1, e0, temp);
_root[countries[2]].move(b2, e1, temp);
_root[countries[0]].move(600, e2, temp);
shuffle();
} else if (location == 2) {
_root[countries[0]]._x = -100;
_root[countries[1]]._x = -100;
_root[countries[2]]._x = x0;
_root[countries[0]]._x = x0+w1;
_root[countries[1]]._x = x0+w1+w2;
shuffle();
shuffle();
}
}
}

any suggestions welcome!!!! maybe it is the this reference?? not quite sure what i'm doing here...still lots to learn

Tween Class Help
Hi everyone. I'm doing a website and I'm having trouble with something. I have a movieclip that I want to animate using the tween class. however, I want thetween to occur once the frame that the code is on loads. This is a problem because I can't use onEnterFrame because it will play thetween continuously. I need it to play oncethe frame loads and only once. I tried using the movieclip.onLoad function but it's not working for me. What am I doing wrong? Here is the code that I'm using...










Attach Code

import mx.transitions.Tween;
import mx.transitions.easing.*;
var oListener:Object = new Object();
home_txt.onLoad = function() {
home_txt._visible = true;
myTweeningY = new Tween(home_txt, "_y", Bounce.easeOut, 0, 250, 2, true);
myTweeningY.FPS = 40;
myTweeningY.onMotionFinished = function() {
trace("Y motion is finished");
};
};
home_txt._visible = false;
stop();

Tween Class Help
Hello,

I am working on understanding the Tween class, and was wondering whether somebody could explain something to me. I wrote the code below with the expectation that the image (1.jpg) would fade in, and then fade out. In fact what happens is that the image fades out only. For some reason it does not fade in, but just appears.

Could somebody please explain why this is so and how I might go about getting the desired fade in, fade out?

Thank you in advance.

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

createEmptyMovieClip("test_mc", getNextHighestDepth);
loadMovie("1.jpg", test_mc);

var photoFadeIn:Tween = new Tween(test_mc, "_alpha", Strong.easeIn, 0, 100, 1.5, true);
var photoFadeOut:Tween = new Tween(test_mc, "_alpha", Strong.easeIn, 100, 0, 1.5, true);

[AS3] Tween Class Bug?
I have a problem with the Tween Class that I do not understand.

If I put several tweens in a loop - rewind and start them again -
they suddenly stop(!!) after a while (about 10 sec).
http://www.coldminer.com/nwf/test/test1.php

But when I put the code in an extended Sprite Class with the
DisplayObject everything works as expected.
http://www.coldminer.com/nwf/test/test2.php

Ok, "problem solved", but why is this? I don't understand.
Is it a bug, or am I doing it wrong?
It works in AS2 (Test 3).
http://www.coldminer.com/nwf/test/test3.php

Code is available on the examples

Anyone?

Tween Class = AS1 Or AS2?
Hi everyone... I hope this is a simple question...

Is the Tween class an AS1 or AS2 codeset? It works fine when I publish to 1, but there's been some debate in our office. Specifically I'm talking about the sort of code used here:

http://www.kirupa.com/developer/actionscript/tween.htm

Thanks,
Dan P.





























Edited: 06/10/2008 at 03:13:19 PM by dmperkins74

Tween Class
I am using the new flash Class easing tweens.
I imported the classes and then I made a function to take care of all my slides.

Code:
function slideMe(mc:MovieClip, prop:String, begin, finish, spd:Number) {
var tw = new Tween(mc, prop, Elastic.easeInOut, begin, finish, spd, true);
}
Then on my Button I call the function with this.

Code:
_root.slideMe(sectionPanel_intro, "_y", sectionPanel_intro._y, 443, 2);
This all works but the only parameter I can’t pass is the function, which would be easIn, easeOut, Strong.ease ect.
When I pass this it works but not with ease why is this.

Also is this the best way to approach this or is there a better way.

If I’m going to do it this way by having a wrap around function that takes care of the new class Tween then is there a way in this code of tweening the x and y at the same time without setting up another slideMe function for
x to be called at the same time as y.

Thanks,
Eric

Tween Class
hey guys
got a question... im getting into using the tween classes in mx 2004, and im havin a bit of a problem. im not sure why this code isn't working

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

box.onEnterFrame = function(){
var myTween:Tween = new Tween(box,"_xscale",Elastic.easeOut,100,400,1,true );
}

what im trying to do is to have the box scale to a certain size once the player enters that frame... am i missing something, because i thought i was doing it correctly. this action is on a frame and not on the movieclip itself. any help would be great. thanks in advance.

Kurve

Using The Tween Class Help?
on the home page of kirupa there is a tuturial for this but for some reasons i keep getting earrors when i do it. I think there is a mistake on it cuz i even get an error on the zip file that was provided? is it the rigth action script does anyone know?

Tween Class
I searched for this and didn't find what I was looking for so I hope it hasn't already been addressed.
I'm following the Kirupa Tween Class tutorial and I think I actually understand it. So I went to apply it to one of my movie clips. When I check the syntax it said there was an error with both of these:

Quote:




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




Any ideas why that would come up?
Also, I have 18 movie clips. Would I need to apply the tween class to each one individually if I want them to do the same thing?
Thanks in advance!!!

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