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

Similar Messages

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

  • HELP PLZ!! Array Button Menu that fades in/out content with Tweener or Tween Class...!!!

    OK.
    So I've been trying the last couple of days to make 2 different codes i had into one...
    The first on is using the Tweener class and everytime that I press a button it fades out the loaded content of the previous selection, waits for it to finish and then loads the content of the button pressed. Everything works fine with this part.
    The second code is the on that is using an Array to dynamicaly rollover, rollout and keep selected the buttons.
    It was also changing the content of the mc that everything is loaded on but without this fancy fade in - fade out...!!
    So i think its time for some code now...:
    Here are 2 different approaches:
    This is the code that uses the onMotionFinished of the Tween Class:
    var groupinfo:Array = [ {mc:about, toload:"mcHome"},
         {mc:service, toload:"mcService"},
         {mc:contact, toload:"mcContact"}];
    var activebtn:MovieClip;
    var holder1:MovieClip = _root.attachMovie("mcHome", "mcMain", 10);
    holder1._x = 0;
    holder1._y = 110;
    function doClick() {
    //          \/THE PROBLEM IS FROM HERE\/
         if (this != activebtn){
              var mcTween:Tween = new Tween(mcMain, "_alpha", Strong.easeOut, 100, 0, 1, true);
              mcTween.onMotionFinished = function() {
                   _root.holder1.attachMovie(this.p, "mcMain", 1);
                   var mcTween2:Tween = new Tween(mcMain, "_alpha", Strong.easeOut, 0, 100, 10, true);
    //          /\UNTIL HERE/\
         var prevbtn:MovieClip = activebtn;
         activebtn = this;
         this.gotoAndStop(FADEINSTOP);
         prevbtn.onRollOut();
    function init() {
       for (var element in groupinfo) { 
          // btn is a pointer to one of the nav buttons
          var btn:MovieClip = groupinfo[element].mc;      
          // have each button remember which library/mc it is supposed to load
          btn.p = groupinfo[element].toload;      
          // assign functions to each event
          btn.onRollOver = doRollOver;
          btn.onRollOut = doRollOut;
          btn.onRelease = doClick;
    init();
    And the Example:
    The onMotionTween code works ok with the tweening but doesn't change the movieclip.
    This is the code that uses the caurina Tweener Class with no onMotionFinished:
    var groupinfo:Array = [{mc:about, toload:"mcHome"},
                                {mc:service, toload:"mcService"},
                                {mc:contact, toload:"mcContact"}];
    var activebtn:MovieClip;
    var holder1:MovieClip = _root.attachMovie("mcHome", "mcMain", 10);
    holder1._x = 0;
    holder1._y = 110;
    function doClick() {
    //          \/PROBLEM FROM HERE\/
         if (this != activebtn) {
              Tweener.addTween(mcMain,{_alpha:0, time:1, transition:"easeOutQuart"});
              var holder2:MovieClip = _root.attachMovie(this.p, "mcMain2", 11);
              holder2._alpha = 0;
              holder2._x = 0;
              holder2._y = 110;
              Tweener.addTween(mcMain2,{_alpha:100, time:1, delay:1, transition:"easeOutQuart"});         
              mcMain = mcMain2;
    //           /\TO HERE!!!/\
         var prevbtn:MovieClip = activebtn;
         activebtn = this;
         this.gotoAndStop(FADEINSTOP);
         prevbtn.onRollOut();
    function init() {
         for (var element in groupinfo) {
              // btn is a pointer to one of the nav buttons
              var btn:MovieClip = groupinfo[element].mc;
              // have each button remember which library/mc it is supposed to load
              btn.p = groupinfo[element].toload;
              // assign functions to each event
              btn.onRollOver = doRollOver;
              btn.onRollOut = doRollOut;
              btn.onRelease = doClick;
    init();
    Other Example:
    The Tweener code works perfectly this first time but the second time removes the conent and does just the fade in.
    The code for the buton group i got it from                     here...
    Please could someone help me with this thing!!
    I think its a great piece of dynamic code if we can eventualy make it  work properly!!
    Thanksss!!!
    Shorten the code...  Left only the part that needs mod!!

    clbeech, Thank you but doesnt do anything either....!!It is a  bit usefull but... !!
    The problem is that the code cant give the "this.p" to the movieclip...
    Here is the mess i've made with few changes from your part... and alot of treces to wich detected that the this.p is can't get in the onMotionFinished function...
    its only the doClick function:
    function doClick() {
         trace ("---------vars after click----------")
         trace ("activebtnStart  "+  activebtn);
         trace ("this.p  OutPre:  " + this.p);
         if (this != activebtn){
              trace ("mcMainAlphaBefore:  " + mcMain._alpha);
              trace ("mcMainBefore:  " + mcMain);
              var mcTween:Tween = new Tween(mcMain, "_alpha", Strong.easeOut, 100, 0, 1, true);
              mcTween.onMotionFinished = function() {
                   holder["mcMain"].removeMovieClip();
    //               trace ("mcMainStart:  " + mcMain);
    //               trace ("mcMain2Start:  " + mcMain2);
    //               trace ("mcMainAlphaStart:  " + mcMain._alpha);
    //               trace ("mcMain2AlphaStart:  " + mcMain2._alpha);
                   trace ("this:  " + this);
                   trace ("this.p  Pre:  " + this.p);
                   holder.attachMovie(btn.p, "mcMain", 1);
                   holder.alpha = 0;
                   trace ("this.p  After:  " + this.p);
    //               mcMain = mcMain2;
                   new Tween(mcMain, "_alpha", Strong.easeOut, 0, 100, 10, true);
    //               mcMain._alpha = 100;
    //               trace ("mcMainEnd:  " + mcMain);
    //               trace ("mcMain2End:  " + mcMain2);
    //               trace ("mcMainAlphaEnd:  " + mcMain._alpha);
    //               trace ("mcMain2AlphaStart:  " + mcMain2._alpha);
         trace ("this.p  OutAfter:  " + this.p);
         var prevbtn:MovieClip = activebtn;
         activebtn = this;
         this.gotoAndStop(FADEINSTOP);
         prevbtn.onRollOut();
         trace ("this.p  "+  this.p);
         trace ("this  "+  this);
         trace ("prevbtn  "+  prevbtn);
         trace ("activebtn  "+  activebtn);    
    Pfff.....
    I think its best to Attach the .fla!!
    Please have a look on it if you have anytime..!!
    Thanks for your interest..

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

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

  • Where do Pipeline Component classes get loaded from?

    Can someone please point me to some documentation that describes where my Pipeline
    Component classes get loaded from?
    I have just wasted hours on this - to find that they are not loaded from WEB-INF/classes
    - but instead they must be available to the EJB classloader. The sampleportal
    is completely misleading in putting the classes in WEB-INF/classes - because they
    are in fact loaded from the sampleportal EJB jar!
    Did I miss something obvious?
    regards,
    Nick

    Nick
    Refer to this portal doc on dev2dev
    ftp://edownload:[email protected]/pub/downloads/webflow.doc
    -tulan
    "Nick Minutello" <[email protected]> wrote
    in message news:[email protected]..
    >
    >
    Can someone please point me to some documentation that describes where myPipeline
    Component classes get loaded from?
    I have just wasted hours on this - to find that they are not loaded fromWEB-INF/classes
    - but instead they must be available to the EJB classloader. Thesampleportal
    is completely misleading in putting the classes in WEB-INF/classes -because they
    are in fact loaded from the sampleportal EJB jar!
    Did I miss something obvious?
    regards,
    Nick

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

  • Access the property of main class in loaded swf.

    Hi
    i have one main.fla, its document class is main.as. the code in main.as is
    package
    import flash.display.MovieClip;
    public class Main extends MovieClip
    private var loading:Loading;
    public var trovami:Number=10;
    public function Main()
    stage.frameRate=31;
    loadSWF();
    private function loadSWF():void
    loading=new Loading(this);
    Loadind.as is another class where i load another swf its name is my_swf.
    the code of loading class is:
    package
    import flash.display.MovieClip;
    import flash.display.SimpleButton;
    import flash.text.TextField;
    import flash.display.Loader;
    import flash.events.*;
    import flash.net.URLRequest;
    public class Loading extends MovieClip
    private var _fla:MovieClip;
    private var url:String;
    public var val:String;
    private var loader:Loader;
    public function Loading(fla:MovieClip)
    _fla=fla;
    init();
    private function init():void
    url='my_swf.swf';
    var request:URLRequest=new URLRequest(url);
    loader=new Loader();
    initListeners(loader.contentLoaderInfo);
    loader.load(request);
    private function initListeners(dispatcher:IEventDispatcher):void
    dispatcher.addEventListener(Event.COMPLETE,completato);
    private function completato(event:Event):void
    _fla.addChild(loader);
    loader.y=10;
    val="hello"
    and the document class of loaded swf is Main2. in my_swf.fla there is one text its name is:
    a_txt.
    so i have to use property of Loading class in Main2 for text.
    code of Main.as is
    package
    import flash.display.MovieClip;
    import flash.text.*;
    public class Main2 extends MovieClip
    public function Main2()
    a_txt.text=val;
    where val is the property of Loading class.
    so how can i access.

    You have a reference to your loaded movie within your Loading class - instead of just setting val to a string - add a method in your Main2 class - and call that from Loading - passing the string to it. Push not pull...
    Main 2 becomes:
    public function Main2() {
         //a_txt.text=val;
    public function setText(val:String):void {
        a_txt.text = val;
    And then in your Loading class - when you're done loading just call setText:
    private function completato(e:Event):void
        addChild(loader);
        loader.y=10;
        MovieClip(loader.content).setText("hello");
        //val="hello";

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

  • Find out where class was loaded from

    Is there a way to find out from what resource the java runtime loaded a class from? I know that -verbose:class argument will tell where classes were loaded from during runtime for only normal sun libs (core libraries from rt.jar), but it does not say where it is loading external stuff from. Can this be found out?
    For example, if a particular third party class is available several times (through accidental redundancy in classpaths)-- find out which resource it was taken from.
    I am sure you could get down into the weeds and look thorugh all the classpath entries for which ones contain which classes-- but there has got to be a better way.

    import java.io.File;
    import java.net.JarURLConnection;
    import java.net.URL;
    import java.net.URLDecoder;
    private File getPathToClass(Class c)
         try
              URL url = getClass().getResource(c.getName() + ".class");
              if( url.getProtocol().equals("jar") )
                   JarURLConnection jarCon = (JarURLConnection)url.openConnection();
                   url = jarCon.getJarFileURL();
              File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
              return file;
         catch(Exception e)
              return null;
    }

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

  • Getting a number of class path load errors

    Hi, I'm new to jdeveloper and have been perusing the different features and sections of the IDE. When I click on the extensions tab, there are quite a few warnings stating that several class path load entries not found. Is this normal or is there something missing from the IDE?
    Edited by: 936816 on Nov 20, 2012 1:39 PM

    This kind of information probably is not published by the JVM.
    OFC you could rewrite the JVM to support this type of query.
    Maybe something in the jvmstat could help you.

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

Maybe you are looking for