Component and tween class help

Hi All,
I have a simple component which is dynamically added to a
movieClip (‘parent_mc’) and is then made a listener of
that movieClip. I’m creating 5 different component instances
and each one is given a unique ‘id_number’. The
component uses a tween calss function for moving to a different x
position. The ‘parent_mc’ broadcasts a message
(this.broadcastMessage("moveComp", compId, newX); and only the
component with the matching id moves to the new position.
Everything works as expected but the problem I’m having
is trying to call a function to let the 'parent_mc' know when the
tween has finished. Can anyone help??
Thanks,
Ty
This is a cut down of the components script.

You didn't explain the 'obj' bit and how I define it.
Anyway, I have done a work around by placing a movieClip in
the component to handle the tween and call the moveFinished
function in the component when it's done.
There must be a way to call the same moveFinished function
from within the moveComp.myTweenX.onMotionFinished function.
Thanks for the responses.
Ty
The movieClip code is this:

Similar Messages

  • 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

  • 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

  • Glow filters and tween class does not work!!

    hi!!!! this is my problem...
    I have inserted on stage through attachmovie a mc and copied
    6 times through the cycle for. . now through the class filter I
    have assigned for everyone the effect always through the cilo for,
    but I do not succeed to assign transition that is to the effect
    movement of the filter glow to all the mc
    for all the rollOut and rollOver works (this is looked at
    from the small hand and trace) but the every time that step small
    hand on whichever only mc to a part the transition of the
    effect…
    now i show the code of my fla files that is in first frame...
    quote:
    import flash.filters.GlowFilter;
    /*import flash.filters.*;*/
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    //imposto le variabili posizione
    var posX:Number = 80;
    var posY:Number = 370;
    //creo l'array di testo delle icone e del numero delle icone
    var testoIco:Array = new Array ("VIDEO","MOTION
    GRAPHICS","WEB SITES","ILLUSTRATIONS","BRAND","PHOTO");
    setUpButtons();
    function setUpButtons()
    var gf:GlowFilter = new GlowFilter(0x000000, 100, 0, 0, 3,
    3, false, false);
    //dichiaro gli effetti e li imposto
    var blurXTween:Tween = new Tween(gf, "blurX",
    Elastic.easeOut, 5, 5, 1, true);
    var blurYTween:Tween = new Tween(gf, "blurY",
    Elastic.easeOut, 5, 5, 1, true);
    //imposto il valore btnCnt
    var btnCnt = testoIco.length;
    /*ciclo for per attaccare il simbolo item dalla libreria e
    per moltiplicarlo
    sullo stage e dargli l'effetto*/
    for(var i=0; i < btnCnt; i++)
    //attacco l'icona dalla libreria
    var icon:MovieClip = this.attachMovie("icon","icon" + i,
    i+1);
    var temp = this["icon"+i];
    temp.icona.testo.textButton = testoIco
    temp._x = (127*i) + posX;
    temp._y = posY;
    temp.ref.setMask(temp.mask);
    var glow:Array = this["gf"+i];
    temp.filters = [gf];
    /*applico l'effetto alle icone rollOver rollOut*/
    temp.onRollOver = function ()
    blurXTween.continueTo(20, 2);
    blurYTween.continueTo(20, 2);
    temp.onRollOut = function ()
    blurXTween.continueTo(5, 2);
    blurYTween.continueTo(5, 2);
    blurXTween.onMotionChanged = function ()
    temp.filters = [gf];
    i need help!!!
    sorry for my bad english....

    Thanks jtahlborn for this fast reply.
    Unfortunately it doesn't work, if I change the code of WebServiceBean to the following:
    @Stateless
    public class WebServiceBean
         @EJB
         ControllerBean controller;
         @EJB
         JPAServiceLocal jpa;
    }Error message:
    javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: com.x.y.z.ControllerBean
    Do I have to define any parameter with the @EJB annotation, like name or bean-name or put something into ejb-jar.xml?
    The second idea is not an option for me, I don't wanna make ControllerBean a POJO
    Cheers

  • No vídeo in my TV with original cable component and Ipad air, help please.

    How can I see my Ipad air and moviles in my TV with the original component cable, at the moment no works.
    Help please.

    Hey adbridge683,
    This is usually in reference to USB issues. This article has great step by step troubleshooting, so you can see the steps first hand yourself to try. http://support.apple.com/kb/ts3694#error50
    There's really only about 7 things to look for in there, and I hope that one of them helps you out!
    Let me know.
    -Regards

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

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

  • [svn] 3787: Added FxTextArea, FxTextInput, and TextView class-level examples to the Component Explorer.

    Revision: 3787
    Author: [email protected]
    Date: 2008-10-21 12:16:28 -0700 (Tue, 21 Oct 2008)
    Log Message:
    Added FxTextArea, FxTextInput, and TextView class-level examples to the Component Explorer.
    Modified Paths:
    flex/sdk/trunk/samples/explorer/explorer.xml

    One workaround is to turn off automation:
    File-->Options, Advanced tab, General Section, uncheck "Enable Automation Events"
    However, you will loose the ability to configure callouts, and all of the commands in the Process Engineering tab.
    Another workaround is to change the loop number of the shape you are editing before changing its type. Then change the loop number back to the correct loop number.
    This is another example of the pernicious philosophy of trying to help the user do what the programmers think the user is trying to do that started in Excel 2000 (where you can no longer tell excel that you want a scatter plot - it will force the plot
    to be a line plot under certain circumstances).
    I suppose another option would be to modify the master and swap the text and subtype shapes in the indicator to use the subtype property for the loop number and then use the text for the instrument type. I guess this is what MS was trying to implement, but
    didn't explain it well enough to their programmers.

  • Need help with AS 2 Tween class

    Hi,
    I'm using the tween class just fine, but I want my tween to
    move on a curve.
    I can't seem to figure out how to achievve this.
    I get the math to do this sort of thing, and I think I could
    manage it with
    AS3, but the project requires the use of AS2. I'm having
    issues
    transitioning what I know to what I need.
    Can anyone help??
    Thanks,
    KB

    you can use the tween class to update an object property and,
    if you have a parametric equation for your curve, you can use your
    tween's onMotionChanged event to update your object's _x and _y
    properties.

  • Class ALV in Edit mode and F4 Value help

    I am displaying Customer Information in ALV Grid with class method. Customer Number is editable mode and having search help. When user F4 on Customer Number and select any value from search help. This selected new value is not passing to ALV grid in Customer number column. I tried with on_f4 method, but it is not working or something i doing incorrect.
    Can any one help to solve this problem ?
    Many thanks

    Hi.
    try with method check_changed_data in after event.
    CALL METHOD go_grid->check_changed_data
          IMPORTING
    or implement a local_event_class to handle F4 event and Change event.
    The demo program "BCALV_TEST_GRID_F4_HELP" can help you tu find the correct code.

  • Component and Class ?!

    Dear all,
    Call for answers and discussion!!!
    1. Component has a clear seperation between the specification and implementation? I can't understand here.The interface define some operations,but eventually we need coding to realize it. Where is the speration?
    A class also has methods and coding to realize it. But why we never say a class has a seperation between the specification and implementation?
    2. Component has interface; Java has interface. Are they the same idea or different?
    Call for answers.
    Thanks

    dunno what your meaning of "general component" is, but the interface goes as follows
    if you write code that calls methods in another class you MUST have a variable that is an instance of that class (except for some static and abstract classes that can return an instance, but lets not go that far yet)
    consider though that you want 2 different classes (which dont share any usefull inheritance for what you want to do) to have some behaviour that is the same
    the way you do this is by interfaces
    you define the 2 classes to implement the interface you want, then when you can use the interface class name as the type of the variable you want to handle
    example (not a great one but..)
    2 classes Cat and Dog
    and a Vector of Cats and Dogs (you dont know what order)
    you could define Cat and Dog to implement an inteface called Speak with methods talk() and shout()
    when you retrive an instance of Cat or Dog from the vector (in order to get it to talk) the you could write
    Speak anAnimal=(Speak)vectorOfAnimals.elementAt(index);
    anAnimal.shout();
    not a great example since you could write a super class of Cat and Dog called Animal that has these methods
    but consider if you mix up a few Computers in there
    there are very few similarities between Animal, Cat and Dog that warant a super class to implement them. how ever you may well want a Computer to talk()

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

  • I'm trying to reinstall Logic Pro 9, and it says It's already installed. I have a project due for class and I need help asap. Please help!!!

    I'm trying to reinstall Logic Pro 9, and it says It's already installed. I have a project due for class and I need help asap. Please help!!!

    Yea I am. I deleted Logic Pro 9 and moved the App to the Trashcan like normal. Then when I go to install it, it says its already Installed. When I do this with other apps; it works fine, the install thing comes back up like it should once you have deleted the app

  • Tween class and using variables

    I'm having trouble using a variable as the 1st paramenter in
    the Tween class.
    // f2_mc is the name of the clip to be tweened
    on (press) {
    _global.mcName = MovieClip;
    _global.mcName = f2_mc;
    _root.setXposition();
    function (setXposition) {
    var moveIn:Object = new Tween(_global.mcName, "_x",
    Strong.easeOut, 600, 50, 2, true);
    moveIn.onMotionFinished = function() {
    }

    cl...
    That was great! Works perfectly now. I never would have
    figured out the (_parent.f1) thing. I worked for hours on it and
    was about to adopt a new design approach. This makes it easy...
    thanks a lot!

  • HT4061 My Ipad was part of my tuition. My school "IIN" loaded all my audio and video classes on it. I diseabled it by entering the wrong passcode it says connect to Itune. How do I make sure I do not lose my classe recording by doing so? please help. Than

    Hello, I am and IIN Intitute of Integrative Nutrition in New York student. My iPAD 2 is part of my school material and was uploaded with all Videos and Audio classes for the whole program. I recently typed in my passwork incorrectly and disabled my iPad it is giving me the message " connect to i-tunes". I am afraid to loose my lectures. Could anyone help me with some information please? Thank you very much. Wouga22

    If you do not have a backup you are going to lose everything on your iPad and even if you do have one, you may still be out of luck.
    You have to restore the device within iTunes. You want to use the same computer that you always sync with so that you can restore your app data and settings. You can restore with any other computer, but you will lose everything on the iPad.
    Read this very carefully before you proceed. Sometimes iTunes will allow you to restore the iPad without having to use recovery mode, but if you need to use recovery mode and don't have a backup, that is where you may have a problem.
    http://support.apple.com/kb/ht1212
    If you need recovery mode ....
    Recovery Mode Instructions
    Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
    Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
    If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
    If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
    Use iTunes to restore iPad.

Maybe you are looking for