#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0

    Changing z position


    Is it possible to have an object on one layer overlap an object on another layer, and then have the overlapping reverse? Like you would need to animate a moon orbiting around a planet? Also, can you have a layer be between two layers of a group without making it part of that group?
  2. #2
  3. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    Layers in ActionScript are referred to as an objects "index". Lower indexed objects are at the bottom behind other objects with higher indexes. The three functions that would be of interest to you are:
    Quis custodiet ipsos custodes?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0
    This isn't working for me. I made an instance name for the object I wanted to be in front and no matter what the value I set it's in the back. And it just stays in one place because the tween doesn't work. Do I need to apply the code to the layer instead of the object? How would I do that?
  6. #4
  7. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    You give both objects instance names, let's keep it simple so the one in the back we will call "back" and the one in the front we'll call "front" ^_^

    this.swapChildren(this.back, this.front);

    Stick that in the clip that contains them both and it should switch them. If you are doing a tween then you will have to call swapChildren at the point when you think the two should swap visually. How you do that depends on which tween system you use and even then there could be more ways than one. Two methods that come to mind are:

    1) Use two tweens, the first tweens to the midpoint, then you do swapChildren, then do the second tween that carries on the animation.
    2) Use an event handler to monitor the position of the tween and then when it's at the mid point call swapChildren.
    Quis custodiet ipsos custodes?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0
    Alright so can these actions not be done on tween layers?
  10. #6
  11. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    I don't know, I never use timeline based tweens. I use TweenMax to do them via ActionScript.

    It's easy for you to just test it out with your current tween layers though so I'd try that.

    Just to be clear, that line of code does not go inside either of the two clips, it goes on the keyframe of the timeline where you have the two clips as children and want them to switch.
    Quis custodiet ipsos custodes?

IMN logo majestic logo threadwatch logo seochat tools logo