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.

Similar Messages

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

  • "Open method of Workbooks class failed" when opening Excel file via Internet Explorer

    (apologies, I posted this first to the general Office 2010 forum, but then realized this was probably a better spot to post)
    We have an Excel COM add-in installed on users' PCs.  This add-in responds to workbook open events by opening a particular XLA file (also deployed to the PC) to make certain features available.  This process works flawlessly when Excel files are
    opened locally - but when a user attempts to open an Excel file from an IE link, we get the following error: "Open method of Workbooks class failed".  This is happening on the line that is trying to open the XLA file.  This only happens
    when launching an Excel link from IE - works fine in Chrome or Firefox.
    I have found several posts on this topic, but no solutions:
    1. This post (https://social.msdn.microsoft.com/forums/office/en-US/73c96005-84af-4648-b103-32b677205be3/open-method-of-workbooks-class-failed)
    is the closest to our problem.  In this case, the "answer" was that the user may not have access to the 2nd workbook being opened.  But in our case, we're opening an XLA that is on the local machine, and I've confirmed that it is not
    corrupt and accessible (read & write, just in case!) to Everyone.
    2. This (very old) post (http://www.pcreview.co.uk/forums/open-method-workbooks-fails-excel-hosted-ie-t965608.html)
    seems similar, but is talking about opening Excel inside of IE.  This is not what we're doing - the link is supposed to (and does) open Excel outside of IE.  Interestingly, Excel.exe is being launched with the "-embedded" flag, even
    though it isn't running in the IE window.  When launching Excel by opening the file locally, Excel.exe is run with the "/dde" flag instead.  Clearly the "-embedded" mode is what is causing the problem.  I could change the
    links on the web page to use some JavaScript to open Excel differently... unfortunately, the links are actually generated by SharePoint (the Excel files are in a SP repository), so this is not really an option.
    3. This Microsoft KB article (http://support.microsoft.com/kb/268016) talks about problems opening an XLA directly from IE... but this is the case of a link pointing
    directly to an XLA file, not opening a regular workbook that in turn opens an XLA, as is my case.  In fact, this article specifically points out in the "More Information" section that "End users do not normally open XLAs; instead they open
    an XLS that (if needed) loads one or more XLAs during startup." ==> precisely what I'm trying to do that is giving me the error!
    I've replicated the situation with a very simple COM add-in (created in VS2010 using VB.Net) and a very simple XLA file (does nothing, just pops up a message in auto_open).  For anyone wanting to try it out, here is the exact test case:
    1. In Excel, create a simple XLA file containing only the following code, and save it in C:\TEMP\dummy.xla:
    Sub Auto_Open()
    MsgBox "Auto Open fired"
    End Sub
    2. In Visual Studio, create a new Excel 2010 Add-In.  I created mine via Visual Basic, but I doubt the choice of language matters.  Place the following code in ThisAddin.vb:
    Public Class ThisAddIn
    Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
    AddHandler Me.Application.WorkbookOpen, AddressOf Application_WorkbookOpen
    End Sub
    Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
    End Sub
    Sub Application_WorkbookOpen(ByVal workbook As Excel.Workbook)
    On Error GoTo ErrHandler
    If (Not workbook.Name.Contains("dummy.xla")) Then
    MsgBox("Workbook open")
    Application.Workbooks.Open("C:\temp\dummy.xla")
    Application.Workbooks("dummy.xla").RunAutoMacros(Excel.XlRunAutoMacro.xlAutoOpen)
    End If
    Exit Sub
    ErrHandler:
    MsgBox(Err.Description)
    End Sub
    End Class
    3. Build & publish this add-in and install it on the same machine as the XLA created in step 1.
    4. Create and save an empty Excel workbook (I called mine WayneTest1.xlsx) - save it locally (on your desktop), and put a copy somewhere on your web server (I put mine directly in c:\inetpub).
    5. Create an HTML file with a link to that workbook, saving it to the same web server location - here is mine:
    <html>
    <body>
    <a href="WayneTest1.xlsx">Link to Excel file</a>
    </body>
    </html>
    6. Double click the workbook on your desktop (from step 4) - opens fine, I get the "workbook open" message, following by the "Auto Open fired" message.
    7. In Internet Explorer, navigate to the HTML file specified in step 5 and click on the link - when prompted, select "Open" - I get the "workbook open" message, following by the error message "Open method of Workbooks class failed".
    Here are a few things I've ruled out / tried so far:
    - Unchecked all the "Protected View" settings in Excel, made no difference
    - Unchecked all the "File block settings" in Excel, made no difference
    - Made sure dummy.xla was open for read & write to Everyone
    - Made sure the web page was in Trusted sites and set the security level to Low for those sites in IE
    - Tried making the local desktop file (step 6) readonly, made no difference (i.e. launching it locally still worked fine)
    - Tried using Excel 2013 - made no difference
    Any ideas / suggestions?

    Hello Wayne,
    Apologies for the delay.
    I went through your post and tried to reproduce the issue. I was able to reproduce it. Based
    on its complexity and as it requires more in-depth analysis, your question falls into the paid support category which requires a more in-depth level of support.
    Please visit the below link to see the various paid support options that are
    available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Thanks,
    Anush

  • 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

  • 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:

  • 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 trouble

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

    Walter,
    > When I set up a simple Tween, it works if I assign a
    specific
    > object's instance name as the object to tween. But when
    > doing it inside a for loop, it doesn't work.
    Interesting. Honestly, your code looks fine. I just
    copy/pasted,
    literally, and it worked as expected.
    I did notice one parameter that might cause some confusion.
    In this
    line:
    var letterUp:Tween = new Tween(this, "_x", Bounce.easeOut,
    this._x,
    this.startX, 2000);
    ... that last parameter, 2000, means the tween will progress
    *very* slowly,
    as it will transpire over the duration of 2000 frames. In a
    standard 12dps
    movie, the full tween would take over 166 seconds. I'm
    wondering if you
    meant 2000 in terms of milliseconds? For that, you could drop
    it to 2, and
    add one more parameter, true, to indicate you want the tween
    to transpire in
    terms of seconds (true), rather than frames.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • 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 Unreliable?

    1 out of 4 function calls from a MouseEvent results in the
    MovieClip getting 'stuck' somewhere in the tween. As if it's not
    finishing. Has anyone else experienced this? Or am I using the
    Tween class wrong?
    addEventListener(MouseEvent.CLICK, tweenStyle)
    private function tweenStyle(event:Event):void
    var scaleYTween:Tween = new Tween( MovieClip, "scaleY",
    Strong.easeOut, 0, 1, .5, true );

    Just hit this:
    Note: Consider variable scope when using the Tween class. If
    a tween is created in a function, it is important that the
    variable's scope exists beyond the function itself. If a tween is
    stored to a variable of local scope, ActionScript garbage
    collection removes the tween as the function completes, which will
    likely be before the tween has even begun.
    Yeah, after making my Tweens class members, no
    problemo!

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

    If the code is in an externally loaded Movie you need to
    determine when the frame is available and the general way to go is
    using the MovieClipLoader class.
    If the code is in a already loaded movie then follow
    naomind's recommendation

  • Tween class - yoyo()

    Hi
    I was wondering what the opposit function is of the yoyo()
    funtion.
    I now have a animation running from right to left using the
    tween class.
    Instead of running the animation at the end going
    backwardswith the yoyo() funtion (from left to right). I just want
    to start it all over again, so that it runs again from right to
    left
    gr
    Tom

    you're welcome.

  • 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 in loaded mcs

    I can't seem to find anything that says you can't use the
    tween class in movie clips that will be loaded into other movie
    clips that also use the tween class. Can anyone shed some light on
    this subject for me? My tweens are not working in my loaded swfs
    but do as stand alones. I do not have any _root references in my
    clips.

    aniebel wrote:
    > I can't seem to find anything that says you can't use
    the tween class in movie
    > clips that will be loaded into other movie clips that
    also use the tween class.
    > Can anyone shed some light on this subject for me? My
    tweens are not working in
    > my loaded swfs but do as stand alones. I do not have any
    _root references in my
    > clips.
    >
    >
    >
    There is no problem with using tweens in nested clips. Check
    that you
    use either fully qualified calls (e.g. var tween = new
    mx.transitions.Tween(...); ) or that you import the classes
    you need
    inside your clips (e.g. import mx.transitions.Tween;)
    James O'Reilly - JOR
    www.jamesor.com

Maybe you are looking for

  • Number of Songs

    Hey all, I have 2244 items in my "Music" playlist in iTunes. However, my iPod says I have 2243 songs. I do not have any "dead" songs, and all of my songs are in a format that will trnasfer to my iPod. I know this is relatively minor, but how can I fi

  • URL Pattern problem

    Hi I deployed an ear which has a web module with contextroot '/test'. It has a jsp whose url-pattern is mapped to /testjsp. From a html form i'm calling this jsp and the action attribute is /test/testjsp. But the error is resource not found /test/ser

  • Audio Interface with Seamless IMac Compatiblity?

    Dear List, I thought I submitted this question before but I couldn't find it in my stuff, and can't find exactly the same question in here by searching so here goes and sorry if it's repetitive.  I currently use an M-Audio, Fastrack Ultra as my inter

  • Database storage of value mapping information

    Hi, Wouldn't it be easier to maintain the information storage in a real database instead of value mapping? Is that technically feasable? May a Java method access such a database from a mapping? regards Yann

  • Tips for replacing DVD burners on Tecra A-series

    I think I need to replace my DVD writer. I was using a Mat****a UJ-811T that came with the laptop but it no longer burns properly, though it continues to read discs fine. I initially thought it was a problem with Nero (calibration error), but it does