• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

How do you set the final position for a fly transition

AS3: I can make the fly transition work but I can't find any way to set the final position for the movieclip (which is a child) when the fly finishes.

There isn't a parameter for it in the transition manager. I've try adding the child and setting the x and y but it doesn't make any difference. TM seems to have a mind of its own. If I set the position, for example, to 275/200 it flies in to about 50/50.

?????
0
chevronrod
Asked:
chevronrod
  • 3
  • 2
1 Solution
 
conagramanCommented:
as you have already noticed the transitions available in the transition manager class do not have a parameter for X and Y ending positions. the x and y position the transition will end on will be the movieclip's x and y position before the transition begins. You should also know the transition manager does not work with the sprite display object type but only Movie clip types.
i think i will need to see your file / code you are adding your child to your movielcip and the transition code you are using to go any further.
0
 
conagramanCommented:
I should also point out that an alternative I would recommend to using the transition manager would be to use the tween class instead which will give you greater control including the parameters for speed easing and your starting and ending positions. Another benefit to using the  tween class is that it does work with the sprite display object type.
0
 
chevronrodAuthor Commented:
Here is the code:

var brothers1MC:MovieClip = new mcBrothers1();
var brothers1TM:TransitionManager = new TransitionManager(brothers1MC);
function brothersAdd(e:Event):void{
      addChild(brothers1MC);
      brothers1TM.startTransition({type:Fly, direction:Transition.IN, duration:8, easing:Strong.easeOut});
}


FYI: Easing and duration do work on the Fly transition.

But I'm leaning towrd using a tween like you said....
0
 
conagramanCommented:
thank you but I am aware of the parameters of the transitions of the transition class.

ok first declare your transition manager outside of any function.  
var brothers1TM:TransitionManager;   // this line
the problem with any tween or transition is the garbage collector will sometimes remove the instance before it is complete keeping the declaration outside of any functions will keep that from happening.
Another thing that will help is to add a listener for when the transition is complete like i have below.

So i think what should work for you is  make sure your code waits till the transition is complete and declare your transitions outside of your function.


var brothers1TM:TransitionManager;   //  outside of all functions

var brothers1MC:MovieClip = new mcBrothers1();
brothers1TM = new TransitionManager(brothers1MC);

function brothersAdd(e:Event):void
{
      addChild(brothers1MC);
      brothers1TM.startTransition({type:Fly, direction:Transition.IN, duration:8, easing:Strong.easeOut});
brothers1TM.addEventListener(“allTransitionsInDone”, TransComplete);
function TransComplete(e:Event):void
{
trace(“transition complete do something else”);
}

}

Open in new window

0
 
chevronrodAuthor Commented:
I did exactly that but I still have a problem. There must be something else interfering. I'm going to keep trying but since I am giong to work with your solution as the foundation I'm closing this one.

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now