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/

Similar Messages

  • 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);

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

  • Tween Class Easing AS modification help.

    hi guys im new here in the forums, ive been searching around about tween class easing in as2 and ive found this great tutorial http://www.republicofcode.com/tutori...enclasseasing/
    i need a help though, im not really a actionscript programmer, but i wanted to modify this code:
    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var myHoriTween:Tween = new Tween (myBall_mc,"_x",Strong.easeOut,0,400,2,true);
    myHoriTween.onMotionFinished = function (){
    how would i modify the code so my objects not only goes on a straight line(_x like in the code from 0x to 400x),
    what if i wanted a diagonal direction, it will start in x and ends in y?
    hope you could show me how its done thanks in advance!!

    to tween along a diagonal, tween both the _x and _y properties at the same time:
    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var myHoriTween:Tween = new Tween (myBall_mc,"_x",Strong.easeOut,0,400,2,true);
    var myVertiTween:Tween = new Tween (myBall_mc,"_y",Strong.easeOut,0,400,2,true);
    myHoriTween.onMotionFinished = function (){ }
    if you want to tween the _x and then tween the _y, use:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var myHoriTween:Tween = new Tween (myBall_mc,"_x",Strong.easeOut,0,400,2,true);
    var myVertiTween:Tween
    myHoriTween.onMotionFinished = function (){
    myVertiTween = new Tween (myBall_mc,"_y",Strong.easeOut,0,400,2,true);

  • AS 3 Tween Class help

    I could really use some help. I'm using AS 3 and am creating a simple vertical menu where 6 buttons reside. When any of the buttons is clicked it takes you to specific frame label. On each frame label I have some actionscript that once arrived at will animate a small triangle along the y axis to rest next to the button the user has just clicked. I am trying to use the Tween Class to aminate the small triangle. Here is what I have so far:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var arrowTween:Tween = new Tween(arrow_mc, "y", Regular.easeOut, 20, 80, 2, true);
    The var created assigns the triangle a new end position. Here's where I need help. In the example above the 20 is the starting position and what I need is something that says whatever the current (this) position value is move to the desired end position value, which is 80 in the example.
    I'm up late trying to figure this one out. Any help or ideas to lead me in the right direction is greatly appreciated.

    Craig,
    Thanks for the help. I really appreciate it. However, I'm still having a bit of trouble. When I put in "current arrow_mc" I get syntax errors in the compiler errors box.
    1084: Syntax error: expecting rightparen before arrow_mc. 
    Here is the code I have put in:
    stop();
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var arrowTween:Tween = new Tween(arrow_mc, "y", Elastic.easeOut, current arrow_mc.y, 39.5, 1, true);
    Any ideas?
    Mike

  • Possible with tween class...

    Can you using the tween class have your tween go into a certain point? i.e. certain coordinates?

    What do you mean by using two tweens simulataneously...currently here is the script Im using..
    import mx.transitions.Tween;
    SceneZoomer = ;
    for (var j:Number = 0; j < SceneZoomer.length; j++) {
        SceneZoomer[j].onPress = function() {
            zoomIn(map);
        SceneZoomer[j].onRollOut = function() {
            zoomOut(map);
    function zoomIn(mc:MovieClip) {
        var xs:Tween = new Tween(map, "_xscale", mx.transitions.easing.None.easeOut, map._xscale, 275, 2, true);
        var ys:Tween = new Tween(map, "_yscale", mx.transitions.easing.None.easeOut, map._yscale, 275, 2, true);
    function zoomOut(mc:MovieClip) {
        var xs:Tween = new Tween(map, "_xscale", mx.transitions.easing.None.easeOut, mc._xscale, 100, 2, true);
        var ys:Tween = new Tween(map, "_yscale", mx.transitions.easing.None.easeOut, mc._yscale, 100, 2, true);
    It zooms into my map mc when I click on my location 1 mc, but it zooms to the center of my map, is it possible to zoom to certain coordinates rather than the center, basically to zoom to where my location1 mc is
    Thanks

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

  • How to import a class not in the package from a package

    how to import a class not in the package from a package?

    http://java.sun.com/docs/books/tutorial/java/interpack/usepkgs.html

  • A  classpath error while  importing a class with @page import property

    Hi ,
    I am using Tomcat contaniner for jsp applications. I have developed a page that i have import a class. when i use
    <%@ page import="myclass" &>
    i got an error that myclass not found. I have placed into tomcat\webapps\myproject\web-inf\classes directory. So How will I set the classpath for myclass to work?
    thanks.

    I was able to simulate your problem when I created a mismatch in the case of the name of the class.
    for example if my program is called MyClass.java
    and in the import I do <@page import="myclass" %>
    Are you sure about the case of class name that you are using? Please check that the file is called myclass.java the class defined inside it is called myclass and the class file that is copied into the WEB-INF/classes directory is also myclass.class. There should be no difference in the case of the names. like MyClass.java or MyclaSS.class
    Other things to check are
    1. If myclass is defined in a package then you have to import with the package.
    2. Make sure that your jsp is located in the myprojects directory and the class file is copied under myprojects/WEB-INF/classes.
    Let me know if things still don't work
    regards,
    Abhishek.

  • Error while importing java class into oracle forms 10g

    Hi
    I have generated a web service client using jdeveloper 10g. It consists of complex type methods. I am trying to import the class files using java importer in oracle form 10g. I am able import all of them successfully except one. That one is the main method. Please see the error and suggest me how to overcome this error.
    Exception occurred: java.lang.NoClassDefFoundError: oracle/jdeveloper/webservices/runtime/WrappedDocLiteralStub
    Thanks in advance

    Do you see oracle/jdeveloper listed in "Import Java Classes" when you try to import?
    If not, make sure you add C:\DevSuiteHome_1\jdev\lib\jdev.jar to FORMS_BUILDER_CLASSPATH in registry
    Also excetion indicates: oracle/jdeveloper/webservices/runtime/WrappedDocLiteralStub
    If you typing it - type: oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub

Maybe you are looking for

  • "class not found error" and applets ...

    To run an applet inside an html page using the embedded oc4j i have to copy the library containing the applet to the same directory as the html page. Otherwise i get a class not found error....Is there a better way of doing this? thanks in advance fo

  • Need to study the relevance & do an impact analysis for Support Pack 19

    Dear Experts , I need to study the SP 19 released by SAP wrt IS Retail & specific logistics modules . Where can i find the details of notes & enhancements associated with the SP 19 released? Regards Anis

  • Lumia 620 background change in themes

    I m using 620,i want to change my mobile themes,but its give only two option in themes -setting,white,and black. i want to change it,is there any software or setting to change it. specialy in my mobile setting of themes it appering only black and whi

  • Portal Language settings

    Hello Gurus , I am faced with a problem where in German Users using SAP portal to acces applications in English Language - which is attainable by setting the Portal Browser settings to English as default . Now it is here I am faced with issue - germa

  • [MacOSX 10.10] [RDP 8.0.12] Remote screen does not match containing window size or monitor

    Hello. I am facing a very strange issue that I have never seen before. When I connect to a remote host, the host's screen does not match my client screen, and instead spills over into two monitors. This happens in full screen mode. When switching to