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




[CS3] A Question Involving The Tween And Transition Class.



I have a document that has thumbnail images that when you click on them a larger version of that image loads in above it. My question is if you can use the transition class to use random different transitions when loading in the different larger images. So, basically when you clicked on one of the small images the photo of the larger version would do something like fade in and then if you clicked on another image it would do something like wipe in. I'm just curious if you are capable of doing this in actionscript so it would just randomly chose a transition to apply to the images. Thank you so much!



FlashKit > Flash Help > Flash ActionScript
Posted on: 04-07-2008, 01:20 PM


View Complete Forum Thread with Replies

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

Flash Transition/tween Class
I'm making a function that can be used to tween a movie clip. I've set it up to accept multiple arguments:

code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
function slideX(mc:MovieClip,end:Number,dur:Number,et:Strin g):Void{
var x_tween:Object = new Tween(mc, "_x", et, mc._x, end, dur, true);
}


The last argument, 'et', is for the Ease type (ie - Bounce.easeOut). My problem is that Flash doesn't recognize 'et' as a String. What object type would this be for this function to work properly?

Thanks.

Edit: for those interested, it would be of type Object.

Transition Class Tween Problem
Hi all,


First I created a movieclip and took the default name Symbol 1

then on frame 1 within the clip I added the following script


Code:
// **********************************************************************
// Loads the XML file
// **********************************************************************
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/StringAboutText_XML.xml");
// **********************************************************************


// **********************************************************************
// Variables to hold the node and attribute values from the XML file.
// **********************************************************************
function loadXML(loaded) {
if (loaded) {

scrollerTxt = this.firstChild.childNodes[0].nodeValue;
// **********************************************************************


// **********************************************************************
// Create empty textfield called scroller
// **********************************************************************
createTextField("scroller",
0, // depth "leave as 0"//
0, // x position //
0, // y position //
500, // width //
60);// height //

scroller.embeded = true;
scroller.type = "dynamic";
scroller.multiline = true;
scroller.html = true;
scroller.wordWrap = true;
scroller.selectable = false;
scroller.htmltext = scrollerTxt;
// **********************************************************************


// **********************************************************************
// format the font for the scroller text
// **********************************************************************
scrollerTxtFormat = new TextFormat();
scrollerTxtFormat.font = "Microsoft Sans Serif";
scrollerTxtFormat.size = 14;
scrollerTxtFormat.color = 0x415D40;
scrollerTxtFormat.align = left;
scroller.setTextFormat(scrollerTxtFormat);
// **********************************************************************


// **********************************************************************
// create a scrollbar for the scroller text
// **********************************************************************
initialization = {_targetInstanceName:"scroller", horizontal:false};
attachMovie("FScrollBarSymbol", "scrollBar", 15, initialization);
scrollBar._x = scroller._x+scroller._width+15;
scrollBar._y = scroller._y;
scrollBar.setSize(scroller._height);
// **********************************************************************


// **********************************************************************
// Format the scrollbar
// **********************************************************************
scrollBar._width = 11;
scrollBar.setStyleProperty("arrow", 0x415D40);
scrollBar.setStyleProperty("scrollTrack", 0xffffff);
scrollBar.setStyleProperty("face", 0xffffff);
scrollBar.setStyleProperty("highlight", 0xffffff);
scrollBar.setStyleProperty("highlight3D", 0xdfdfdf);
scrollBar.setStyleProperty("shadow", 0xdfdfdf);
scrollBar.setStyleProperty("darkshadow", 0x415D40);
// **********************************************************************

} else {
trace("xml file not found!");
}
}
then going back to the main stage I gave the clip an instance name of abouttext_mc
and added the following script to frame 1


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

aboutmetextTween = new mx.transitions.Tween(abouttext_mc, "_alpha", mx.transitions.easing.Strong.easeIn, 0, 100, 1, true);
aboutmetextTween = new mx.transitions.Tween(abouttext_mc, "_x", mx.transitions.easing.Strong.easeOut, 920, 180, 2, true)

stop();
what this does is creates a text box with a load of text and a scrollbar.

The tween sends the textbox and scrollbar in from the right onto the stage from postion 920 to position 180 on the _X axis.
that works fine, but the _alpha tween only adjust the opacity to the scrollbar only and not the text box.

does anybody know why this is??

if I were to create a text box and paste in the text so it's static it all works perfectly, it slides in from the right and appears gradually as it comes in, which is the effect I'm after.

cheers Rob.

Tween/Transition Class Tutorial
FYI




MM - DEVNET Using the Tween and Transition Classes in Flash MX 2004 by Jen deHaan.

http://www.macromedia.com/devnet/mx/...ing_print.html

Xml Slideshow With Tween Class And Transition Manager
I need an xml slideshow with tween class and transitionmanger.
But i am novice in this field
please help

How Do I Do AColor Transition And An Alpha Fade Using Tween Class?
Hi All,

Got a few questions relating to the tween class.
Basically I have 3 circles using 1 instance of my circle mc. Within this there is a background mc which is the circle.
What I want to do, is make it so that when the user hovers over a circle that circle changes colour and fades and when they rollout it goes back to norm.

I've taken code from by TheCanadian from this post and adapted it for my task, but I can't get it fully working.


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

function colorFade(object_mc:Color):Void {
var trans:Object = object_mc.getTransform();
//fade to orange
var rb:Tween = new Tween(trans, "rb", Strong.easeOut, trans.rb, 0xFF, 3, true);
var gb:Tween = new Tween(trans, "gb", Strong.easeOut, trans.gb, 0x99, 3, true);
var bb:Tween = new Tween(trans, "bb", Strong.easeOut, trans.bb, 0x33, 3, true);

trace("offsets "+trans.ra + " " + traces.ga + " " + trans.ba);

rb.onMotionChanged = function():Void {
object_mc.setTransform(trans);
};
};

// Aspiration Cirlc
aspiration_mc.onRollOver = function():Void {
var colorVar:Color = new Color(aspiration_mc.circleColor_mc);
colorVar.setRGB(0x003399);
colorFade(colorVar);
};
So my first question is, am I going the right way, trying to use the function like that. And second, is it possible to control the fade within the one statement? or will I need to do that separately?

Many Thanks,
Rich

AS 2.0 Class Question Involving RemoveMovieClip()
Ok I created a class called lazer. This class is registered to my lazerBeam movieclip. Basically the class moves the beam across the screen.

The problem is, when the beam reaches the end of the screen I want to remove it, but saying 'this.removeMovieClip()' does not work from inside the class. It says removeMovieClip is not a method of the class. Is there a way to make it realize I want it to call the removeMovieClip() function of the movieclip class?

I suppose I could extend the lazer class from the movieclip class but I was hoping to extend from something else.

Need Urgent Help How To Combine Transition Class Tween Animation And Keyframe Animation?
Hi! I have a transitional tween class animation assigned to "mc_logo" on frame 1. However on frame 100, I have "mc_logo" animated on the timeline by regular keyframe animation.
I have assigned the tween class animation to "mc_logo" on frame 1 and the regular timeline animation starting on frame 100 does not execute now when I test the movie...why?

Do I need to end/clear the tween class animation so the regular timeline animation will work again?

Here is the code on frame 1 so far:

import mx.transitions.*;
import mx.transitions.easing.*;
import flash.filters.*;
var LogoTweenY:Tween = new Tween(mc_logo, "_y", Bounce.easeOut, -120, 171, 30, false);

Thank you in advance for your help.
Attila

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?

Mx Transition Tween
I have a ton of code on a single frame which requires some easing. I put the import mx.utils.Delegate;
import mx.trasitions.Tween;
import mx.trasitions.easing.*;

I keep getting an error -
The class or interface 'mx.trasitions.Tween' could not be loaded.

Is this a plug-in or a download? Does anyone know how to fix this?

Tween Transition Help
Hi, Im trying to accomplish a very simple flash intro and cant seem to get it to look professional...

1. Its taking forever to load
2. The tweens are rough

The example I was asked to imitate is here:
www.thepreserveatcinnamonridge.com

Here's mine:
www.tomesrabold.com/levy/index.html

Any suggestions?

Mx.transition.Tween
All I am trying to do is fade one movieClip out, fade another movieClip in and then move on down the timeline.

I can fade things up and down no problem, but when I enter the "gotoAndStop();" into the equation it overrides the fading process and simply kicks me into the next label/frame on the timeline. In this example everything works beautifully until you get to the line: gotoAndStop(10); - can someone shed some light on this...? This example is just for fadingOut...

stop();
import mx.transitions.Tween;

img2_mc._alpha = 100

btn_click.onRelease = function(){
//fadeIN(0, 100);
fadeOUT(100,0);
gotoAndStop(10);

}
function fadeIN(startAt:Number, endAt:Number):Void {
var myTween:Tween = new Tween(attachMovie("img1_mc", "img1_mc", 10), "_alpha", mx.transitions.easing.None.easeNone, startAt, endAt, .25, true);
}
function fadeOUT(startAt:Number, endAt:Number):Void {
var myTween:Tween = new Tween(img2_mc, "_alpha", mx.transitions.easing.None.easeNone, startAt, endAt, .25, true);
}

Tween/Transition Swf
Can u apply transition manager codes like this to an externally loaded SWF?

mx.transitions.TransitionManager.start(img1_mc, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});

Smooth Tween Transition
Ok, I feel kind of stupid because I have done this before. I even have the file to prove it, but I can't get it to work right again. When creating a motion tween, let's say red box to green box for 15 frames. What I am getting right now is red box for 14 frames and then a quick blip of the green box. I want to slowly transition from red to green. I know there is some button or something that I am not pushing, because as I said, I have done it before. I am pretty new to this prog, so sorry for the ignorance. Can anyone help?

Thanks

[F8] Tween Transition Combine?
Ive made this code:


Code:
function zoom(){
tween1 = new mx.transitions.Tween(balloon1,"_xscale",Strong.easeOut,this._xscale,this._xscale*5,10);
tween2 = new mx.transitions.Tween(balloon1,"_yscale",Strong.easeOut,this._yscale,this._yscale*5,10);
tween3 = new mx.transitions.Tween(balloon1,"_x",Strong.easeOut,167,-1000,1,true);
tween4 = new mx.transitions.Tween(balloon1,"_y",Strong.easeOut,244,500,1,true);

}
But after a while I realised why this isnt working right. I call the function from a button incidently, but its scaling and THEN moving, but I want it to scale and move at the same time. Which Im not sure how to combine so Im hoping someone can help me out.

Thanks very much

Tween Transition Uses Too Much Memory
Hello list,

In one of my projects i need something to set the focus on some screenshot location. At the moment i'm using the builtin tween transitions to accomplish this.
The problem however is that every time the function (see below) is called the memory keeps building up.
Typically it adds about 3 MB to the RAM every time the function is called.

Since it's an application that will be looping this is unacceptable, the memory quickly raises to 1 GB and more until windows runs out of memory.

I'm using flash 8, any ideas how I can fix this problem ?
I also tried using the onenterframe() function with some code, but the memory usage is about the same there.
I tried deleting variables wherever I could, but this does not seem to do anything.

Thanks for the help.

--- see attached code---

Attach Code

import mx.transitions.Tween;
import mx.transitions.*;
function zetfocuszoom(xx, yy, ww, hh) {

www = int(ww)*152;
hhh = int(hh)*152;
xxx = int(xx)+(ww/2);
yyy = int(yy)+(hh/2);
startx = Math.round(FocusCircle_mc._x);
starty = Math.round(FocusCircle_mc._y);
startw = Math.round(FocusCircle_mc._width);
starth = Math.round(FocusCircle_mc._height);
//
xTween = new Tween(FocusCircle_mc, "_x", Strong.easeIn, startx, xxx, 6, false);
yTween = new Tween(FocusCircle_mc, "_y", Strong.easeIn, starty, yyy, 6, false);
wTween = new Tween(FocusCircle_mc, "_width", Strong.easeIn, startw, www, 6, false);
hTween = new Tween(FocusCircle_mc, "_height", Strong.easeIn, starth, hhh, 6, false);

}

Stoping A Transition.Tween
Basically I have a bunch of mcs defined as this["item_" + ev.index]. Each of these are draggable. If the mc is released somewhere where I don't want it, I have a motion tween move it back to where it came from. My motion tween is defined this way:

(tempX and tempY are set with an onPress function.)

Code:
new mx.transitions.Tween(this["item_" + ev.index], "_x",
mx.transitions.easing.Bounce.easeOut, this["item_" + ev.index]._x,
tempX, .75, true);

new mx.transitions.Tween(this["item_" + ev.index], "_y",
mx.transitions.easing.Back.easeOut, this["item_" + ev.index]._y,
tempY, .75, true);
I want to stop the tween when the onPress function is called again for that particular mc. All the examples I can find are done the other way where you actually create a tween variable and then simply stop that variable. Is there a way to stop the tween the way I am doing it? Thanks.

Jason

Pause Mx.transition Tween?
I need to pause this tween after it reaches 100% _alpha. Any recommendations?


Code:
function fadeImage() {
myFade = new mx.transitions.Tween(box, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 1, true);
myFade.onMotionFinished = function() {
this.yoyo();
}
}
Thanks!

Color Transition/Tween
I've been trying to figure this out for a while now, but I'm about at my wits end trying to understand it. I'm attempting to make a function that takes two arguments, 1) the mc whose color you want to change and 2) the hex value of the destination color. Then, the existing color of the passed movieclip should gradually transform into the destination color over a duration of x frames (specified elsewhere).

From what I've run across so far, it seems like I need to get the rgb values. I found this bit of code to convert hex to rgb:

Code:

var r = hex >> 16;
var temp = hex ^ r << 16;
var g = temp >> 8;
var b = temp ^ g << 8;
I'm thinking I need to use the colorTransform or something similar, but could someone show me how to do this over a controlled period of time?

Lost With Mx.transition.Tween
just a little frustrating , look at AS


Code:

import mx.transitions.Tween;
#include "mc_tween2.as"

MovieClip.prototype.checkMe = function() {
if (this._currentframe == 6) {
this.btn.enabled = true;
this.gotoAndPlay(7);
}
};

btn_mc3.btn.onRelease = function() {
gotoAndPlay('gallery')
_root.bg.gotoAndPlay('gallery')
_root.my_mc.tween(["_y","_alpha"],[545,0],2)
var myTween:Tween = new Tween(_root.mc_bg, "_xscale", mx.transitions.easing.Regular.easeOut, _root.mc_bg._xscale, 150, 0.1, true);
btn_mc3.btn.enabled = false;
btn_mc4.checkMe();
};
btn_mc4.btn.onRelease = function() {
gotoAndPlay('contact')
_root.bg.gotoAndPlay('contact')
_root.my_mc.tween(["_y","_alpha"],[398,100],2)
var myTween:Tween = new Tween(_root.my_mc, "_xscale", mx.transitions.easing.Regular.easeOut, _root.my_mc._xscale, 100, 0.1, true);
btn_mc4.btn.enabled = false;
btn_mc3.checkMe();
};
the mc_bg is my little bg on stage which on btn press it resizes, the resize tween works great however the btn_mc4 on release doesn't bring my mc_bg back to 100% am I missing something?

Pause Mx.transition.Tween ?
I need to pause this tween after it reaches 100% _alpha, before it uses the "yoyo" to fade back to 0% _alpha. Any recommendations?


Code:
function fadeImage() {
myFade = new mx.transitions.Tween(box, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 1, true);
myFade.onMotionFinished = function() {
this.yoyo();
}
}
Thanks!

Transition Tween Fade Out
Hey Guys, so I know if apply this script to a MC it will fade in...

mx.transitions.TransitionManager.start(wipe_mc, {type:mx.transitions.Fade, direction:0, duration:1, easing:mx.transitions.easing.None.easeOut, param1:empty, param2:empty});


Is there anyway i can have that re-written so it takes the same MC on a later frame and have it fade out?

Thanks in advance

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!!!!

Transition Tween On A Hidden Layer
I need a little help.

I cannot seem to be able to get this to work right.

When you do a mouse over it is supposed to display another picture, and I have that working right, but I want it to sloly fade in and out as you roll over the button.

I have tried using the stop action, but then it will only do it properly one time. I just can't seem to get it to work.

Take a look at it then tell me what you think. Especially check out the 5th image from the left. Thanks.

Flash

Combining The Transition And Tween Classes
I went over the article here:http://www.macromedia.com/devnet/mx/...ing_print.html
All is clear but the last example dont works:
Combining the Transition and Tween Classes

I tried to change the loaded image, but it no helped. The image will not loades.
Why?

Thank you

Tween/transition Manager FLASH 8
Can someone provide example, actionscript, etc. of how to fade in/out a mc using the tween/or transition manager in Flash 8?

Basic Motion Tween, Bad Transition
I'm creating some basic motion tweens of a few different objects. The sequence seems to tween smoothly until the second to the last frame where it jumps to it's final/destination position. Whereas flash should calculate the transition evenly between the start and end points. This is rare but not the first time I've encountered inconsistent tweening results. Anyone know what causes it, how to fix it, or how to work around it? I've tried adding frames and adding keyframes to fill in the missing transition points, but the error seems to evolve with my changes. I'm attaching fla sample. Thanks!

Check Tween Transition Completion
I was wondering. Is there some method of checking if a tween transition is complete?

Say I have this:

ActionScript Code:
new mx.transitions.Tween(my_mc, "_x",mx.transitions.easing.Regular.easeIn,my_mc._x,my_mc._x+100,2,true);

I usually check in some onEnterFrame handler if the transition has come to an end(by checking the start _x with the end _x). Then I call some function that is supposed to be launched when my transition is over.

Is there a fancier way of doing this?

Thanks guys

Error: Import Fl.transition, Btn And Tween
When I typed "import fl.transitions.tween" in actionscrip and tested it, I got an error message said that it couldn't be found. Does anyone know why it happended? I'm using flash CS3.

Here is another problem: when I create a test button called test_btn, and write a button rollover function like test_btn.onRollOver ..., after I type the "." after test_btn, the onRollOver didn't show on the property list. I define a varable Tween: var myTween:Tween; when I test it, it shows the type "Tween was not found or was not a compile-time constant" and the error for test button is "access of possibly undefined property onRollOver through a reference with static type flash.display:Simplebutton."

Please help!

Transition Tween On Movie Start
Hi

I'm developing a site using the mx transition tweens - triggered by a bt click: http://www.detkendesign.com/detken3/test3.php (still in it's early stage).

I'd like the first bt action to be triggered as soon as the movie opens - so the home bt is triggered and resets the 'holding' rectangle to it's new scale contained in the tween.

Any ideas on how this can be done - I assume changing the on(release) aspect of bt1?

Thanx for any input

Dirk


The script:




Code:
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;
MovieClip.prototype.tween = function(theProp:String, from:Number, to:Number, time:Number) {
_global.when = new Tween(this, theProp, Strong.easeInOut, from, to, time, true);
};

btn1.onRelease = function() {
//first move to center in one second witih no delay
main_mc.tween("_x", 400, 329, 1);
main_mc.tween("_y", 100, 126, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}

btn2.onRelease = function() {
gotoAndStop("bt2");
//first move to center in one second witih no delay
main_mc.tween("_x", 0, -717, 1);
main_mc.tween("_y",0, 126, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}
btn3.onRelease = function() {
gotoAndStop("bt3");
//first move to center in one second witih no delay
main_mc.tween("_x", 0, 329, 1);
main_mc.tween("_y", 0,-632, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}

Image Disappers When In Tween Transition
Hello,

I have the code below. Problem is when I release image1_mc and then press image2_mc it works fine IF I let the transition complete.

If I press image1_mc then press image2_mc the transition starts IF I quickly press image1_mc again, it transitions back to image1Bg_mc BUT once it finishes the transition image1bg_mc disappers.

Any idea why? I can't figure it out.

thanks,
sky









Attach Code

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

image1_mc.onRollOver = function () {
arrivingOnStage = image1Bg_mc;
};

image1_mc.onRelease = function () {
bgImageSwitch(image1Bg_mc,onStage);
onStage=image1Bg_mc
};





image2_mc.onRollOver = function () {
arrivingOnStage = image2Bg_mc;
};


image2_mc.onRelease = function () {
bgImageSwitch(image2Bg_mc,onStage);
onStage = image2Bg_mc;
};



// creates the moving bg image on the stage when onRelease occurs \
bgImageSwitch = function (arrivingOnStage, onStage) {
if(arrivingOnStage != onStage){
arrivingOnStage.swapDepths(onStage);

new mx.transitions.Tween(onStage, "_x", mx.transitions.easing.Strong.easeOut, 0, 1964, 2, true);
new mx.transitions.Tween(arrivingOnStage, "_x", mx.transitions.easing.Strong.easeOut, -982, 0, 1, true);

onStage = arrivingOnStage;


}else if(arrivingOnStage == onStage){
trace("This is already on stage");
}};

Combining The Transition And Tween Classes
I went over the article here:http://www.macromedia.com/devnet/mx/...ing_print.html
All is clear but the last example dont works:
Combining the Transition and Tween Classes

I tried to change the loaded image, but it no helped. The image will not load.
Why?

Thank you

Transition Tween On Movie Start
Hi

I'm developing a site using the mx transition tweens - triggered by a bt click: http://www.detkendesign.com/detken3/test3.php (still in it's early stage).

I'd like the first bt action to be triggered as soon as the movie opens - so the home bt is triggered and resets the 'holding' rectangle to it's new scale contained in the tween.

Any ideas on how this can be done - I assume changing the on(release) aspect of bt1?

Thanx for any input

Dirk


The script:




Code:
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;
MovieClip.prototype.tween = function(theProp:String, from:Number, to:Number, time:Number) {
_global.when = new Tween(this, theProp, Strong.easeInOut, from, to, time, true);
};

btn1.onRelease = function() {
//first move to center in one second witih no delay
main_mc.tween("_x", 400, 329, 1);
main_mc.tween("_y", 100, 126, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}

btn2.onRelease = function() {
gotoAndStop("bt2");
//first move to center in one second witih no delay
main_mc.tween("_x", 0, -717, 1);
main_mc.tween("_y",0, 126, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}
btn3.onRelease = function() {
gotoAndStop("bt3");
//first move to center in one second witih no delay
main_mc.tween("_x", 0, 329, 1);
main_mc.tween("_y", 0,-632, 1);
// and in 2 seconds scale closer
main_mc.tween("_xscale", 100, 120, 2);
main_mc.tween("_yscale", 100, 120, 2);
_global.when.onMotionFinished = function() {

trace("ok");
};
}

Tween And Transition Classes In Flash Vs Fuse K
I'm wondering if there's a hughe difference between use Fuse and use the Tween and Transition Classes in Flash MX, I mean a difference in the PC of the common user of a website.
I made some tests and for example, using a tween and the easing class to move a MovieClip (ball_mc) from one point to other, its 3Kb, and using fuse it's 18 Kb.

What are you using out there?

Tween/Transition Import Code Gives A Syntax Error
Basicly, I'm using Tweens and transitions, and am having trouble making them appear in some parts.

On a multipage website, pasting in the code:
import mx.transitions.Tween;
import mx.transitions.easing.*;

Gives me a syntax error for where the two lines appear. - This will make any transitions and tweens not appear (the two lines above need to be commented out for it to compile). However, when a page is loaded that contains the code (and gives no syntax error), the transitions and tweens in the first movie as well as the loaded clip all work fine.

What would cause a synax error when trying to use the import code?
The actual site itself you can see in progress at
http://cressaid.brettjamesonline.com/us . The drop down menus just appear, until you load either the logos, corporate id or brochures section in folio. Then they smoothly roll down

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

Transition Class
i'm trying to use the transition class to create a fade out and fade in for loading in external movies. I found a tutorial on it searching through the forums on the topic. I'm having a troubles though when i click on my buttons nothing occurs. I've checked my script with the source script and its identical as far as i can see except for the slight changes i made since my buttons are inside of another movie clip and perform actions inside. Can anyone have a look and see if i have any errors or just going about all wrong.

Code:


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




//Transitions & Navigation


var mcl:MovieClipLoader = new MovieClipLoader();

var mclL:Object = new Object();

mcl.addListener(mclL);

mcl.loadClip("news.swf",holder_mc);

mclL.onLoadStart = function(){
preloader_mc.progress_mc._width = 0;
preloader_mc._visible = true;
theText._visible = true;

}

mclL.onLoadProgress = function(target,loaded,total){
theText.text = "Loading" +Math.round((loaded/total)*100) + "%";
preloader_mc.progress_mc._width = preloader_mc.base_mc._width * (loaded/total);


}

mclL.onLoadInit = function(){
preloader_mc._visible = false;
theText._visible = false;
var myTween1:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,0,100,1,true);
initButtons();

}



function initButtons():Void {
nav.b_news.onRelease = function(){
nav.gotoAndStop("Closed");
var myTween2:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,100,0,1,true);
myTween2.onMotionFinished = function(){
mcl.unloadClip(holder_mc);
mcl.loadClip("news.swf",holder_mc);

}

}

nav.b_web.onRelease = function(){
nav.gotoAndStop("Closed");
var myTween2:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,100,0,1,true);
myTween2.onMotionFinished = function(){
mcl.unloadClip(holder_mc);
mcl.loadClip("web.swf",holder_mc);

}

}
}


stop();
thanks in advance

Transition Class
I try to use this transition class to fade in and fade out 5 images (mcs) on one timeline to get nice transition btw 2 images:

This is transition for first image for first key frame:
Code:

import mx.transitions.*;
import mx.transitions.easing.*;
TransitionManager.start(img1_mc, {type:Fade, direction:Transition.IN, duration:3, easing:None.easeNone});

Than I dont know how to make transition for second image, and so on, ...
Exactly how to call the transition script for each mc repeatedly?

thanks

Squeeze Transition Class Bug?
Amidst working on a dynamic slideshow project, all was seemingly fine until I came across this nasty and inconvenient problem.

Copy and paste the following code into a frame and create a movieclip on the stage with an instance name of 'testClip' as specified in the code below:


ActionScript Code:
import mx.transitions.*;
import mx.transitions.easing.*;
//
var myTransitionManager = new TransitionManager(testClip);
myTransitionManager.startTransition({type:Squeeze, direction:Transition.OUT, duration:3, easing:Bounce.easeOut, dimension:1});
//
myLisIn = new Object();
myLisOut = new Object();
myLisIn.allTransitionsInDone = function() {
    trace("trans IN done")
};
myLisOut.allTransitionsOutDone = function() {
    trace("trans OUT done")
};
myTransitionManager.addEventListener("allTransitionsInDone", myLisIn);
myTransitionManager.addEventListener("allTransitionsOutDone", myLisOut);

In the code above, a Squeeze transition is applied to a movieclip called 'testClip'. The direction specified is 'OUT', and when the transition finishes, the text "trans OUT done" should be output, but it isn't. If you change the direction to 'IN', the respective text is traced.

The problem: Detection fails for when the Squeeze transition finishes with a direction of 'OUT'.

Very odd if you ask me.

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