Is it flash bug? Tween Class

I've been working on a bit big project. I've some components on the stage. There are basically 4 frames. Each frame has some components. What I've done is, I've used tween class. Workflow is something like this:
Frame 1:
--used Tween class to get fade effect for List component.
--used Tween.MOTION_FINISH event to fire an event when it is finished.
--when it is finished, applied eventListener
--on Change event, remove eventListeners and use Tween class again to get reverse fade effect.
--again used Tween.MOTION_FINISH event to fire an event when finished.
--in that evenHandler, gotoAndStop(2);
Frame 2:
//similar
Frame 3:
//similar
and so on.. now, what happens, is, if i play with my scene, sometimes tween class failed to work. sometimes it does not display List component, sometimes it displays List component with alpha 0.2. sometimes it happens with movieClip also. Is it flash bug or problem with my code?

probably a coding problem.  the most common error that seems like a flash bug would be to define a tween within a function body allowing flash to gc that tween, possibly before it starts and/or completes.

Similar Messages

  • Is there a bug in the as3 tween class

    Is there a bug in the as3 tween class that causes tweens to stop before completing. I read that there is and that a 3rd party tween class should be used. I'm just starting out learning as3 and experimenting but this would be good to know when I move onto more complex projects.
    Also the solution for this was to make your function global. Does this simply mean place your function in the top level of your movie.
    I have done research on this topic but I found many conflicting answers.
    Any assistance is welcome thanks in advance.

    the tween declaration (if you need one) must be placed within the scope of the function.  so, if the below function f() is defined in a movieclip, you can use any of the 3 (but don't use the last):
    ///////// most common use ////////////////////////////////////////
    var t:Tween;
    function f(){
    t=new Tween(...)
    /////// next most common use /////////////////////////////////////////
    //no declaration needed because the tween is not referenced anywhere outside the function so need not be assigned a variable
    function f(){
    new Tween(...)
    /////////// least common, not good coding, but possible ////////////
    // var t:Tween;  // declared on the root timeline, for example
    function f(){
    MovieClip(root).t=new Tween(...)
    p.s.  please mark correct/helpful answers

  • Tween Class - calling Function

    What am I doing wrong?  I have been using the Tween Class in AS2 for years.  This is how I have been using it.
    //Beginning of my Flash file
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    function fadeon(mcname:String) {
        new Tween(mcname, "_alpha", Strong.easeOut, 0, 100, 1.5, true);
    //This is placed on Frames where I want to call this particular Tween
    fadeon(mymovieclipsname);
    Similiar setup for AS3 with no errors when I run it.  The only problem is it doens't work. 
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    function fadeon(mcname:String):void {
        new Tween(mcname, "alpha", Strong.easeOut, 0, 100, 1.5, true);
    //on Frames where I want to call this particular Tween
    mymovieclipsname.fadeon();
    if I run this portion the same as AS2 I get this lovely Compiler Error message.
    1067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type String.
    Any thoughts or help wold be greatly appreciated.

    Note that a better solution for AS3 is to simply create a Class that does the tween (to itself), then apply that to each bullet and leave the parent out of it. I'd probably have done the same thing in AS2 as well, but I learned As1>As3>As2, so my experience is not representative.
    Here's the Class that I use to do this (note I didn't use a Tween for this task as they have the danger to go out of memory before the tween is done unless you store a reference to them):
    package view.effects {
    import flash.display.Sprite;
    import flash.events.Event;
    //view.effects.SimpleFadeIn
    public class SimpleFadeIn extends Sprite {
      public function SimpleFadeIn() {
       super();
       addEventListener(Event.ADDED_TO_STAGE, startFade);
      protected function startFade(e:Event):void {
       alpha = 0;
       addEventListener(Event.ENTER_FRAME, doFade);
       addEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
      protected function doFade(e:Event):void {
       if (alpha < 1) {
        alpha += .04;
       } else {
        cleanUp(e);
      protected function cleanUp(e:Event):void {
       removeEventListener(Event.ENTER_FRAME, doFade);
       removeEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
    Note that the reason the path to the Class is there in a comment is so team members can copy and paste it into the Base Class for a MC they want to apply this behavior to.

  • Tween class - tweening from curent position

    Hi, I've been looking at the tween classes and I was
    wondering how I could use it to tween an object that i already
    placed on the stage? So using it's current position and tweening to
    a new position. Is there a way of doing it by simply using a term
    that flash understands (eg _xPosition)?
    Cheers
    Ray
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    new Tween(ball_mc, "_x", Elastic.easeOut, 300, 50, 3, true);
    new Tween(ball_mc, "_y", Elastic.easeOut, 100, 50, 3,
    true);

    I think I asked for help a little quick there.
    this._x
    it looks like that is what I was after.
    Ray

  • Tween class animations - modifying elasticity

    I am fairly new to Flash, and couldn't find the help I needed through a search.
    I am using the Tween class to move objects when buttons are clicked. I am using elastic easing as the animation ends, and it looks ok. But am I able to modify the elasticity at all? I like the effect, but it is a little strong and I would like to reduce the bounce at the end.
    Can I do this, or by using this method of animation am I losing the fine control that I would have by using the timeline and I just have to suck it up?

    Well the easing you provide for the tween is just a reference to a function. So you can search the web and find your own functions. Robert Penner is famous for a large number of really great easing methods. Or you can just muck a bit with the built in functions. I put two small clips on the stage, clip0 and clip1. Then this code:
    import fl.transitions.*;
    import fl.transitions.easing.*;
    var myTween0:Tween=new Tween(clip0,"x",Elastic.easeOut,100,500,2,true);
    myTween0.start();
    var myTween1:Tween=new Tween(clip1,"x",myEase,100,500,2,true);
    myTween1.start();
    function myEase(t:Number, b:Number, c:Number, d:Number):Number {
    return Elastic.easeOut(t, b, c, d, .5, .9);
    The the top one is the default and the lower one is my "modified" version. If you check out the help files for the Elastic classes easeOut method it requires the first four arguments (time, start value, end value of the prop, and duration) as do all tween functions. But the last two a and p are specific to elastic easing. The first is the amplitude of the sine wave and p is the period of the sine wave. I don't know what the units are on either of those, but I'm guessing pixels (or twips) and either seconds or milliseconds. So you could just fiddle with those numbers.
    I'm not sure if there is anyway to send those numbers directly through the Tween constructor -- regardless of whether I used the built in functions or made my own.

  • Tween Class Tuturial (k)

    I am brand new to the Tween class. Would like to use it to
    animate some
    text.
    Don't know where to start. Is there a good tuturial
    somewhere? The one
    on Adobe is complicated.
    Need a no-brainer version.
    -Kirk

    Tween class is in some ways just really verbose, so it always
    take a little bit to get into. The documentation shipped with Flash
    is a good reference to see how it works. This is the best tutorial
    I've seen:
    http://www.actionscript.org/tutorials/advanced/Tween-Easing_Classes_Documented/

  • Tween Class not working in Projector

    Hi all...
    I have a very strange problem. I have a slideshow that uses
    the Tween class to fade between jpg images. In the swf file and in
    the standalone flash player, everything works just great. However,
    when I make a projector file from the fla, either from within
    Flash, or from the standalone player, the transitions stop working.
    This behavior is identical on both a PC and a Mac.
    Does anyone have a clue why projector would behave
    differently?
    Thanks.
    Lance Ong

    In your custom UIComponent class, your never added your myAction instance. Try this for the MyUIComp constructor:
    public function MyUIComp() {
        myAction = new MyAction();
        this.addChild(myAction);
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • Problems scaling width of movieclip with Tween class

    In my app I'm scaling the width of a movieclip using the
    Tween class.
    My problem is that the new scaled width is not right.
    Is this a bug in the as3 code? Does anyone have a solution?
    trace(graphPanel.width) // 500
    scaleValue = 5;
    new Tween(graphPanel, "scaleX", None.easeNone, 1, scaleValue,
    2,
    true);
    trace(graphPanel.width) // 2494.25

    Sounds like you need to scale the star object inside of the star_mc. So you just need to make the star into a sprite/movie clip (how ever you want ot do it) then target that with the scaleX & scaleY, something like,
    star_mc.star.scaleX = star_mc.star.scaleY = 1.5;

  • Import tween class

    Hi. I am new at using actionscript, and I am having a bit of
    difficulty with Flash MX and importing tween class.
    I have typed in this code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    and this is the response I get:
    Scene=Scene 1, Layer=actions, Frame=1: Line 1: ';' expected
    import mx.transitions.Tween;
    Scene=Scene 1, Layer=actions, Frame=1: Line 2: ';' expected
    import mx.transitions.easing.*;
    Every resource I go to tells me that my code is correct. Does
    anyone know what I am doing wrong?

    What version of Flash?
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • New Flash8 Tweening Class?

    Hello Community,
    I have been using a pretty cool technique for controlling
    motion / alpha / scale of various instances on my stage with this
    technique where you read in the MX Tweening Class and then set up
    these variables that changes the motion / alpha / scale over time.
    And, if I place these variables into a function and call that
    function on an event (pushing a button, for example) the animation
    over time event happens. I cannot get this technique to work with
    (what appears new) the FP8 Tweening Matrix thingy.
    Below (first part) is some sample code of the old way, in MX,
    I did this:
    I cannot get something similar to this to work in Flash Pro 8
    (FP8) with these funky matrix thingies that this class is now built
    within.
    For example, I need to have these import (class) lines at the
    beginning, but then how do I create the same sort of animation in
    the function?
    import flash.geom.Transform;
    import flash.geom.Matrix;
    I guess, basically, what I am trying to ask here is: How do
    you create animation via the (what was formerly known as) the Tween
    Class in FP8?
    Any help/info would be appreciated.
    Thanks for your time,
    -john

    I agree with LuigiL ...you didnt set the variable fInt, so
    those wont work. I use the Tween class in Flash8 daily just
    fine.

  • Tween Class fails

    Hi,
    i was looking for some help with tween class beacuse i have a strange problem. I'm working with AS3, when i test my project, sometimes the Tween fails, sometimes it works. It's really strange, i don't know why. The animation stops before the end point. The most strange for me is why sometimes it works and sometimes no?
    My code is geting a little complex, then i tried to do the same process in a simple model, and the result was the same, i run the model many times, in 5 or 3 % the animation finished before the correct end point. Does anybody with the same problem?
    Thanks in advanced!
    Henrique.

    Thanks clbeech!
    In fact, i was using one code line (var nameTween:Tween = new Tween(...)) and calling this line many times by a Timer event. But, how can i use diferent names for the tween var? May i use a counter like var nameTween[counter]:Tween = new Tween(...)?
    My code is a little big and confuse, i'll try to solve the problem without publish the code. If i don't find a solution, i'll organize it and them put it here.
    Thanks a lot!
    H.

  • Making a complex button with the Tween class...not sure why this isn't working.

    Hi all,
    I'm trying to make a button which scales up on rollover and
    scales down on rollout and I wanted to use the Tween class to do it
    because I'm going to be making a bunch of these buttons and I want
    the code to be as efficient as possible.
    So right now I have a circle in a movie clip, and here's what
    I have on the first frame of that circle's actions layer:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    function grow(who) {
    var tw:Tween = new Tween(who, "_xscale", Strong.easeOut,
    100, 400, 1, true);
    var tw2:Tween = new Tween(who, "_yscale", Strong.easeOut,
    100, 400, 1, true);
    function shrink(who) {
    var tw3:Tween = new Tween(who, "_xscale", Strong.easeOut,
    400, 100, 1, true);
    var tw4:Tween = new Tween(who, "_yscale", Strong.easeOut,
    400, 100, 1, true);
    this.onEnterFrame = function() {
    trace(rewind);
    if (rewind == true) {
    shrink(this);
    this.onRollOver = function() {
    rewind = false;
    grow(this);
    this.onRollOut = function() {
    rewind = true;
    The circle scales up just fine but when I rollout it doesn't
    scale back down. I did a trace to see if my tween was being called
    and sure enough it was. So I did another trace to see if the
    _xscale or _yscale was changing and they both were going down to
    around 290 on rollOut although there's no noticeable difference in
    the size of the button, it just looks like it's sitting there.
    I was also wondering if importing the whole class library
    will add very much to my file size?
    Also, since I'm going to have a lot of these buttons on the
    stage at the same time (these buttons will be like markers all over
    a map so there'll probably be around 50+) would it be a bad idea to
    have that many onEnterFrame checks running simultaneously? Is that
    going to slow the user's CPU way down?

    Thanks for the suggestions guys.
    I tried your code and got the rollOut to work but the button
    blinks rapidly if the user rolls out and then rolls back in
    quickly. Here is a link to the swf:
    http://www.stationarynotes.com/studioI/buttonTest.swf
    It also has to reach a complete stop the first time the
    button expands or else it won't run the shrink function on rollOut.
    I put all of my code on the first frame of the movie clip's
    actions layer so here's what mine looks like:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    function grow(who) {
    var tw:Tween = new Tween(who, "_xscale", Strong.easeOut,
    100, 400, 1, true);
    var tw2:Tween = new Tween(who, "_yscale", Strong.easeOut,
    100, 400, 1, true);
    tw.onMotionFinished=function():Void{
    who.onRollOut = function() {
    shrink(who);
    function shrink(who) {
    var tw3:Tween = new Tween(who, "_xscale", Strong.easeOut,
    400, 100, 1, true);
    var tw4:Tween = new Tween(who, "_yscale", Strong.easeOut,
    400, 100, 1, true);
    this.onRollOver = function() {
    grow(this);

  • Adobe air 2.6 iPhone animation tween class vs onEnterframe

    Hi,  Does anyone knows what's better to create alpha or slide animations on iPhone applications, using a tween class like Tweener or use the classic onEnterframe.  What's the better choice, who's the better performance .  Thanks,  Nuno

    Use Tween Class,
    http://www.greensock.com/tweenlite/

  • External swf and the tween class

    i have an external swf which i import into my main swf using
    the loadMovie command. my external swf has some tween class
    animations in it. if i run the main movie, the external swf movie
    runs fine of course...but the tween classes are not loaded. am i
    missing somthing?
    here is the code from the external swf file which is applied
    to a clickable movie clip of course.
    this.onRollOver = function() {
    rewind = false;
    play();
    var squaretween = new mx.transitions.Tween(previewthumb,
    "_xscale", mx.transitions.easing.Elastic.easeOut, 0, 1200, .5,
    true);
    var squaretween = new mx.transitions.Tween(previewthumb,
    "_yscale", mx.transitions.easing.Elastic.easeOut, 0, 1200, .5,
    true);
    squaretween.onMotionFinished = function() {
    loadMovie("hotairlarge.swf",
    "_root.homecontainer.printworkcontainer");
    any help would be great!

    try inserting the following to line 1,frame 1 your main swf:

  • Serious Flash bug?

    Hello. I am a newbie to this forum, so I am sorry if this
    message is off-topic. If it is, I would be obliged if anyone could
    direct me to the correct place.
    I am a veteran programmer but I am new to actionscript. I
    have come across some strange behavour which is driving me mad.
    Following is a part of my code :
    ...[snip]...
    private var pnt:Point = new Point();
    private var dirp:int;
    private var fastp:int;
    private var i:int;
    private var pathB:Array;
    ...[snip]...
    for (dirp=fastp; dirp<=i; dirp++) {
    // BUG!!! If I UNCOMMENT 1 of the 2 following lines, code
    gets mixed up.
    // pnt.x=pathB[dirp][0].x+pathB[dirp][2].x;
    // pnt.y=pathB[dirp][0].y+pathB[dirp][2].y;
    pnt=new
    Point(pathB[dirp][0].x+pathB[dirp][2].x,pathB[dirp][0].y+pathB[dirp][2].y);
    if (addElement(pnt, dirp, pathB[dirp][2], pathB[dirp][3]+1))
    return pathF;
    As I mention above, if I uncomment //pnt.x=... or //pnt.y=...
    or if I even replace them with something like pnt.x=pnt.x+1 ;
    then my code gets mixed up and returns wrong results.
    This is driving me nuts because these two lines shouldn't
    have any effect since right below them there is
    pnt=new Point(...);
    which supposedly "cancels" the 2 previous instructions.
    Right?
    Could anyone, please, show me the obvious that I can't see?
    Many thanks in advance,
    Bill Kotsias

    it's not necessarily a flash bug. there are situations where
    assigning your pnt's x and y properties may trigger some other code
    to execute and re-assigning those properties immediately afterwards
    does not stop the other code from executing.
    you need to isolate the minimum code needed to display the
    issue before anyone will check it. you're nowhere close to that
    now:
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Maybe you are looking for

  • Is there any way to make a backup of my Leopard installation disk?

    I have always hade a habit of keeping a copy of my software media ... Just in case. Is there a way Of making a copy of my Leopard install disk? My wife has already thrown out my snow Leopard install dusk... 8-( I am running both os on my MacPro but m

  • Does DML error logging work only on local DB and not remote DB?

    (A) does not log the errors but (B) does log the errors. Does the LOG clause work only on a local database and not a remote database? A) begin INSERT INTO "PRISM"."TARGET"@"DBLINK" (INVOICE_NUM ,INVOICE_AMOUNT) VALUES ('GHI' ,'GI') LOG ERRORS INTO "P

  • Object variable or With Block variable not set

    Hi - We have saved a working input schedule to a new name and modified it to use for another company.  There is a report tab to bring down the historical units from BPC, a tab to trend the history, and a tab that references the other two tabs to fore

  • New iMac 27" runs loud

    I guess loud is an overstatement, but it certainly seems as if the fan or something is running at an audible level that I haven't heard before. The only thing running right now is Firefox and Safari. The machine doesn't appear to be hot in any way. A

  • Part # for T400 ultrabay battery, and where to buy?

    The Lenovo Web site does not seem to sell an UltraBay battery that's compatible with the T400. Or maybe it's compatible with one of them, and the T400 isn't listed for some reason. What is the part number for the UltraBay battery that works with the