Setting depth of movie clips

I have 4 movie clips on the stage. They are named logo1,
logo2, logo3, logo4. I have them set out cascading. So the only
clip that is fully visible is the front clip but the top of the
other clips can still be seen. When a user clicks on one of the
back clips i want it to appear in front of the clip that is
currently at the front.
Can someone help me out?
Thanks.

You can use swapDepths() (look it up in the Help Reference
for more info - it's a movieclip method). Putting something like
this in each clips onPress handler, or whatever you are using....
this.swapDepths(this._parent.getNextHighestDepth()-1);
However, if you have components, something, I think
"focusManger" is created at the highest possible non-reserved depth
and things can get kinda funny... can't remember all the details
exactly.

Similar Messages

  • Changing depths of movie clips

    Hi Everyone,
    I have 8 square movie clips in two rows of 4, all on the same
    layer. When
    you click on them they become draggable. The problem is that,
    depending on
    where they are located within the layer, sometimes a dragging
    movie clip
    appears beneath the other 7 movie clips. Is there a way to
    make the selected
    movie clip that is being dragged, appear above or on top of
    the other seven,
    no matter which one is selected and being dragged?
    Thanks for any insight,
    Doug

    "kglad" <[email protected]> wrote in message
    news:ghrojd$ssl$[email protected]..
    > use the swapDepths() method of movieclips to move the
    clicked movieclip to
    > the topmost depth.
    Thanks kglad =
    on (press) {
    this.swapDepths(_root.getNextHighestDepth());
    startDrag("", true);

  • Changing depths of movie clips with button clicks

    Hello all,
    I've got a file on working on that has 4 different movie clips on one layer that, when clicked, will zoom in (made with tweens in the timeline).
    The issue I'm having, is that when I click one of them, they are arranged in a way that won't work for what I need. I click one, and it works, but it is hidden by the movie clip that is on top of it in the heirarchy. Click another, zooms in, but is partially hidden by another one.
    My question is: Is there anyway in AS2 to code these so that when one is clicked, it will the top spot in the heriarchy? So that I can code them all like this so that whenever one is clicked, it goes to the top so it is not hidden?
    Thanks

    Correct me if I'm wrong, but isn't that just used to swap 2 movie clips?
    Or is there a number I can input instead of the movie clip name that will change all of them?

  • Movie clip needs to change alpha of another movie clip

    In frame 3 of my Flash animation, I make a graph animate
    using a mask. At the end of that animation I want a button in frame
    3 whose alpha is set to 0 to become visible so it can be clicked.
    So, within the movie clip of the graph, on the last frame I
    have:
    mc_temp.alpha = 1;
    stop();
    But I get an error stating "Access of an undefined property
    mc_temp"
    The button (set as a movie clip) is named "mc_temp". I don't
    understand why I can't call it directly from the timeline of a
    movie clip.

    because its not on the movieclip's timeline. if your graph
    movieclip is on the same timeline as mc_temp, try:
    MovieClip(this.parent).mc_temp

  • Using cue points to acrivate movie clips

    I'm trying to write a simple piece of ActionScript that I can
    adapt and re-use easily. (I'm not very good at programming and I've
    been finding the "help" information very confusing.) I've devised
    quite an elegant solution, if only I could get it to work!.
    I'm using a single frame loop with an onEnterFrame
    construction that deletes itself when the flv has finished playing.
    I've set up a movie clip with various start points for animations
    to be activated at cue points. I'm testing for the cue points in
    the same frame, storing previous cue point names so that each cue
    point triggers the corresponding animation once only. I know the
    main logic works because I've tested it with trace statements to
    prove that the cue points are actually being reached. The problem
    is that the goToAndPlay instructions don't seem to activate the
    movie clip as intended.
    My best guess is that the stop action on the self-looping
    frame is also stopping the movie clip as soon as it starts. Even if
    that is true, I don't know how to solve the problem. And I'm sure
    one of you much more clever people will know better. Here's the
    code. Any suggestions?

    You can build out a menu by reading the cuePoints array in
    the NetStream.onMetadata handler, or by using the MetadataEvent
    with the FLVPlayback component (AS3). The simple thing for me to
    say is to refer to Chapter 9 of my new Flash Video book. :) (see
    link in my signature below.)

  • Auto hide (movie clip) task bar

    How do I make a auto hide task bar (which is a movie clip)?
    auto hide bar similar to windows task bar, when move mouse to
    bottom of screen, the task bar come up, else task bar auto hide.
    http://www.oniva.com/upload/1356/hide.jpg
    I try to set code in movie clip (task bar) but don't work
    well
    =====================
    on (rollOver)
    _root.top._x = 400;
    _root.top._y = 220;
    on (rollOut){
    _root.top._x = 400;
    _root.top._y = 150;
    }

    just found here is the trick
    ==========
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    function tweenY(mc, newLoc) {
    var myTween = new Tween(mc, "_y", Strong.easeOut, mc._y,
    newLoc, 0.5, true);
    var mouseListener = new Object();
    mouseListener.onMouseMove = function() {
    if (_ymouse > 394) {
    tweenY(taskBar, 360);
    } else if (_ymouse < 360 &&
    !taskBar.hitTest(_xmouse, _ymouse, true)) {
    tweenY(taskBar, 400);
    Mouse.addListener(mouseListener);

  • Targeting movie clips

    Hello everyone,
    I've worked on some code with a little help from some people
    here and I've gotten everything to work. The problem I am having
    right now is getting my cross fading images to sit inside separate
    movie clips that are on my home .swf. The code I have so far is as
    follows:
    var showTime:Number = 5000 // milliseconds the picture shows
    at 100% alpha.
    mc_Mon1 = createEmptyMovieClip("img1_mc", 0);
    loadMovie("images/home/image01.jpg", img1_mc); // load
    picture from the file directory that your .swf is in.
    mc_Mon1 = createEmptyMovieClip("img2_mc",
    getNextHighestDepth());
    loadMovie("images/home/image02.jpg", img2_mc);// load picture
    from the file directory that your .swf is in.
    img2_mc._alpha = 0; // hide 2nd picture
    var duration:Number = 30; // milliseconds per alpha change
    (framerate).
    var count:Number = 0;
    var alphaPhase:Number = 1;
    var alphaCount:Number = 0;
    function picSwap():Void {
    count++;
    if(count >= (showTime/duration)) {
    alphaCount += alphaPhase;
    img1_mc._alpha = 100-alphaCount;
    img2_mc._alpha = alphaCount;
    trace("img1 alpha: " + img1_mc._alpha);
    trace("img2 alpha: " + img2_mc._alpha);
    if(alphaCount >= 100 || alphaCount <= 0) {
    count = 0;
    alphaPhase *= -1;
    var intervalId:Number = setInterval(picSwap, duration);
    // End of script.
    I am trying to make img1_mc and img2_mc sit inside mc_Mon1.
    So I am thinking that I would need mc_Mon1 to
    "createEmptyMovieClip" named "img1_mc and img2_mc. I thought thats
    what I did with the code but so far my cross fading images just sit
    up on the top left of the screen. Does anyone have any idea how to
    set the target movie clip to load the other movie clips?
    Thanks,
    Kyle

    hi,
    you should make few changes in your code for it to work,
    starting with this:
    instead of - "mc_Mon1 = createEmptyMovieClip("img1_mc", 0);"
    and the
    following line, try - mc_Mon1.createEmptyMovieClip("img1_mc",
    mc_Mon1.getNextHighestDepth());
    mc_Mon1.img1_mc.loadMovie("images/home/image01.jpg");
    and then -
    mc_Mon1.createEmptyMovieClip("img2_mc",
    mc_Mon1.getNextHighestDepth());
    mc_Mon1.img2_mc.loadMovie("images/home/image02.jpg");
    mc_Mon1.img2_mc._alpha = 0;
    and then in picSwap function, it should be -
    mc_Mon1.img1_mc._alpha = 100-alphaCount;
    mc_Mon1.img2_mc._alpha = alphaCount;
    that should do it i think.
    just so you'd learn, in your original code, 'mc_Mon1'
    actually is variable
    reffering to 'img1_mc' (which, if i'm not mistaken, is
    created in _level0),
    but then 2 lines later you overwrite the refference to
    'img1_mc' with a
    refference to 'img2_mc' (which is also created in _level0).
    one more thing which i didn't check - when you declare you
    'intervalId',
    don't u need to use 'showTime' instead of 'duration'?
    good luck,
    eRez
    "kypsul" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hello everyone,
    >
    > I've worked on some code with a little help from some
    people here and I've
    > gotten everything to work. The problem I am having right
    now is getting my
    > cross fading images to sit inside separate movie clips
    that are on my home
    > .swf. The code I have so far is as follows:
    >
    > var showTime:Number = 5000 // milliseconds the picture
    shows at 100%
    > alpha.
    > mc_Mon1 = createEmptyMovieClip("img1_mc", 0);
    > loadMovie("images/home/image01.jpg", img1_mc); // load
    picture from the
    > file
    > directory that your .swf is in.
    >
    > mc_Mon1 = createEmptyMovieClip("img2_mc",
    getNextHighestDepth());
    > loadMovie("images/home/image02.jpg", img2_mc);// load
    picture from the
    > file
    > directory that your .swf is in.
    >
    > img2_mc._alpha = 0; // hide 2nd picture
    >
    > var duration:Number = 30; // milliseconds per alpha
    change (framerate).
    > var count:Number = 0;
    > var alphaPhase:Number = 1;
    > var alphaCount:Number = 0;
    >
    > function picSwap():Void {
    > count++;
    > if(count >= (showTime/duration)) {
    > alphaCount += alphaPhase;
    > img1_mc._alpha = 100-alphaCount;
    > img2_mc._alpha = alphaCount;
    > trace("img1 alpha: " + img1_mc._alpha);
    > trace("img2 alpha: " + img2_mc._alpha);
    > if(alphaCount >= 100 || alphaCount <= 0) {
    > count = 0;
    > alphaPhase *= -1;
    > }
    > }
    > }
    > var intervalId:Number = setInterval(picSwap, duration);
    > // End of script.
    >
    > I am trying to make img1_mc and img2_mc sit inside
    mc_Mon1. So I am
    > thinking
    > that I would need mc_Mon1 to "createEmptyMovieClip"
    named "img1_mc and
    > img2_mc.
    > I thought thats what I did with the code but so far my
    cross fading images
    > just
    > sit up on the top left of the screen. Does anyone have
    any idea how to set
    > the
    > target movie clip to load the other movie clips?
    >
    > Thanks,
    >
    > Kyle
    >
    >

  • As 2.0 class objects- how to swap depths of a movie clip

    How do you bring an object to the top? if it's just a movie
    clip, I could do a swapdepths, but if it's a movieclip that's part
    of an AS 2.0 object, how do you swap depths of the whole object?
    I create 2 objects (same class) which each have a movieclip
    within them. The movie clip is created on a unique level with
    getNextHighestDepth().
    I have a button which tries to swapDepths of the 2 objects,
    but I can't get it to work. Can anyone help?
    here's the detail:
    1. create a symbol in the library called "someShape_mc" and
    put some shape in it - a circle, a square, whatever - this symbol
    is exported for action script, and has an AS 2.0 Class of
    "ClassObject" ( I also put a dynamic text field in the shape to
    display the current depth - it's called "depth_txt")
    2. create a button called "swap_btn" on the stage.
    Frame 1 has the following actionscript:
    var BottomObject:ClassObject = new ClassObject(this,100,150);
    var topObject:ClassObject = new ClassObject(this,110,160);
    // for the button add this:
    Swap_btn.onRelease=function() {
    // try it with the full path:
    _root.BottomObject.__LocalMovieClip.swapDepths(_root.topObject.__LocalMovieClip);
    // try it with with just the objects:
    BottomObject.__LocalMovieClip.swapDepths(topObject.__LocalMovieClip);
    // try it with the object as a movieclip
    BottomObject.swapDepths(topObject);
    trace("Did it Swap?");
    // try it with a method in the class....
    BottomObject.swapIt(topObject.__LocalMovieClip);
    BottomObject.swapIt(topObject);
    trace("nope... no swapping going on...");
    ================================
    here's the AS file: "ClassObject.as"
    class ClassObject extends MovieClip{
    var __LocalMovieClip;
    var __Depth;
    function ClassObject(passedIn_mc:MovieClip,x:Number,y:Number)
    __Depth = passedIn_mc.getNextHighestDepth();
    __LocalMovieClip =
    passedIn_mc.attachMovie("someShape_mc","__LocalMovieClip",__Depth);
    trace("made a shape at " + __Depth);
    __LocalMovieClip._x = x;
    __LocalMovieClip._y = y;
    __LocalMovieClip.depth_txt.text = __Depth;
    public function swapIt(targetMc) {
    __LocalMovieClip.swapDepths(targetMc);
    __LocalMovieClip.depth_txt.text =
    __LocalMovieClip.getDepth(); // no difference.
    trace("Tried to swap from within the class...");
    ========================
    so- the goal is to bring the "bottom" Class object on top of
    the "top" object. The button tries various methods of swapping the
    depths of the movie clips - but there is not one that works. What
    am I missing?
    tia
    ferd

    Thank you for your response - and here I have included the
    code I reworked to show how it works, and doesn't work. you're
    right about not needing the extra containers, but this example is
    part of a bigger thing...
    I'm confused - it works ONLY if I attach the movie outside
    the class, even though the "attachment" occurs, I'm thinking, at
    the same scope level, that is, _root.holder_mc, in both examples.
    it seems that the advantage of having a class is defeated
    since I have to do the extra coding for each object that will be
    created. It's like the class can only have a reference to the
    movieclip outside itself, and not have a clip INSIDE that is fully
    functioning. am I right about this? Is there someplace good I can
    learn more about class objects and movieclip usage?
    also, my class object IS a movieclip, but " this.getDepth() "
    is meaningless inside the class object. hmmm...
    This one works..... attaching the movies at the root level
    (to a holder_mc)
    // Frame 1
    tmp1 =
    holder_mc.attachMovie("someShape_mc","tmp1",holder_mc.getNextHighestDepth());
    var BottomObject:ClassObject3 = new
    ClassObject3(tmp1,100,150);
    tmp2 =
    holder_mc.attachMovie("someShape_mc","tmp2",holder_mc.getNextHighestDepth());
    var topObject:ClassObject3 = new ClassObject3(tmp2,110,160);
    // for the button add this:
    Swap_btn.onRelease=function() {
    BottomObject.swapIt(topObject);
    trace("clicked button");
    // ClassObject3.as
    class ClassObject3 extends MovieClip{
    var __LocalMovieClip:MovieClip;
    function
    ClassObject3(passedInMovieClip:MovieClip,x:Number,y:Number) {
    trace(" this class object is at ["+this.getDepth()+"]");
    __LocalMovieClip = passedInMovieClip;
    __LocalMovieClip._x = x;
    __LocalMovieClip._y = y;
    public function swapIt(targetMc:MovieClip):Void {
    trace("do the swap in the class");
    trace("===========================");
    trace("target type :" + typeof(targetMc));
    trace("__LocalMovieClip type :" + typeof(__LocalMovieClip));
    __LocalMovieClip.swapDepths(targetMc.__LocalMovieClip);
    This one does NOT work..... attaching the movies within the
    class object...
    // Frame 1
    var BottomObject:ClassObject2 = new
    ClassObject2(holder_mc,100,150);
    var topObject:ClassObject2 = new
    ClassObject2(holder_mc,110,160);
    // for the button add this:
    Swap_btn.onRelease=function() {
    BottomObject.swapIt(topObject);
    trace("clicked button");
    // ClassObject2.as
    class ClassObject2 extends MovieClip{
    var __LocalMovieClip:MovieClip;
    function
    ClassObject2(passedInMovieClip:MovieClip,x:Number,y:Number) {
    __LocalMovieClip =
    passedInMovieClip.attachMovie("someShape_mc","stuff1",passedInMovieClip.getNextHighestDep th());
    __LocalMovieClip._x = x;
    __LocalMovieClip._y = y;
    public function swapIt(targetMc:MovieClip):Void {
    trace("do the swap in the class");
    trace("===========================");
    trace("target type :" + typeof(targetMc));
    trace("__LocalMovieClip type :" + typeof(__LocalMovieClip));
    __LocalMovieClip.swapDepths(targetMc.__LocalMovieClip);

  • HT3775 I can not open a video movie clip, the system ask for a codec, how can a set up that automatlicly

    I can not open a video movie clip, the system ask for a codec, how can a set up automatlicly?

    The problem was resolved a small manipulation - on stage Basic Configuration,
    point 3 "Configure CA Introscope"
    I forgot to add to the list of CA Introscope Enterprise Managers link to my manager.
    Thus it is necessary to take into account that the path should be correct (usually for linux - /usr/sap/ccms/apmintroscope) and the directory should be applied appropriate privileges.
    Then in paragraph "Byte Code Adapter Installation" - there are all the necessary data, and it starts to work correctly

  • How do I use a variable to set movie clip properties?

    I'm building a simple contact page that allows users to
    select a city from a comboBox. I'd like to pass the selected
    comboBox data through a variable that controls a movie clip with
    the same name. (already on the stage)
    locationListener.change = function (loc_obj:Object) {
    var loc_mc = loc_obj.target.selectedItem.data;
    loc_mc._visible = true;
    So far this hasn't worked. I've tested hardcoding the movie
    clip instance name (Atlanta._visible = true) and it works, but I
    can't figure out why using the variable loc_mc won't trigger
    interaction with the movie clip.
    Something simple, I assume. Thanks in advance for any
    help.

    clbeech:
    I tried using your suggestion, but for some reason it doesn't
    recognize it as naming the movie clip instance. I traced the
    variable and confirmed that the correct value (Atlanta) is being
    passed.
    I assume this is because the variable is not declared as a
    MovieClip, but I can't figure out how to convert it inside the
    function.

  • Movie Clips vs the Stage help me out plz

    Before i start i currently am taking a class on flash and i
    dont think we have gone terribly in depth.
    I have 2 sets of Code one in a Movie Clip and another on the
    Stage.
    the issue i have is neither one can see variables from the
    other. is there some special syntax or notation i need to pass the
    variables
    I cant see the Current Unit in the Button

    Syntactically your code is just fine. I didn’t receive
    any errors when I checked it. However I would rearrange some things
    in it. The 2 eventhandlers in the onEnterFrame function, I would
    pull these out and put them outside of the onEnterFrame function
    but on the same frame.
    “the issue i have is neither one can see variables from
    the other. is there some special syntax or notation i need to pass
    the variables”
    Inside that mc, the code that you have below “//Code in
    Button”, it is typically recommended that you don’t
    reference other movieclips by using ‘_levelX’. Use a
    relative path, such as ‘this._parent” or
    “this._parent._parent” depending on how many movieclips
    are nested into it. Also note, when you reference a movieclip from
    inside an eventHandler (onPress, onRelease, onEnterFrame, etc.) you
    are already within an object. So to reference something on the same
    tier you should use ‘this._parent’. Once you find the
    correct tier by using the code I mentioned in the last sentence,
    you then need to attach the instance name of the movieclip you are
    trying to access (that is if you are trying to access a movieclip).
    For an example, ‘this._parent.currentguy’.
    I hope this helps, I understand it may be hard to grasp
    however give it a shot and post back.
    You may be interested in this link that is from the livedocs;
    http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00001220.html

  • Disabling all movie clips that are on lower levels

    Hello
    I have a movie clip that pops up over all other movie clips.
    But it is still possible to interact with these movie clips that
    are beneath the mc that has popped up. Is there any way to disable
    all of the movie clips that are beneath the one that popped up?
    thanks

    Typically the way to do this is simply create a large
    invisible MovieClip which covers everything, and give it a an
    interactive event. I often use:
    on(rollOver){
    useHandCursor = false;
    This way not only does it steal interaction from anything
    below it, it makes it so the cursor doesn't turn into a hand making
    the user think there's something clickable.
    You could also make a loop which checks getDepth() and if
    it's below a specified depth, set enabled = false, but there's
    really no reason in doing that.

  • Move clip to top level

    I've got a movieclip containing another movieclip which acts as a button. The movieclip has a drag function added to it.
    function onBoxPress( event:MouseEvent ):void
                        var boundsRect:Rectangle = new Rectangle(event.currentTarget.x,0,0,stage.height);
                        event.currentTarget.startDrag(false, boundsRect);
              function onBoxRelease( event:MouseEvent ):void
                        event.currentTarget.stopDrag();
                        sortBoxes();
    On the stage I've got several copies of this clip. It works ok: when I click and drag, the clip drags vertically. However, each clip has its own depth and sometimes a clip will drag beneath another clip. So upon clicking and dragging the clip should be moved to the top level of all duplicate clips.
    How do I move it to the front of all other clips?
    I've tried using:
    function onBoxPress( event:MouseEvent ):void
                        setChildIndex(event.currentTarget.parent,0)
                        var boundsRect:Rectangle = new Rectangle(event.currentTarget.x,0,0,stage.height);
                        event.currentTarget.startDrag(false, boundsRect);
    I use event.currentTarget.parent here because the clip to have it's index set is the parent clip. Remember, the button which starts it all is inside that parent clip.
    But then I get an error 2025:
    Error #2025: The supplied DisplayObject must be a child of the caller

    The parent is not the child of the child. Call setChildIndex on an object that is the parent of the parent.
    The whole reason you're having this problem is because you're violating good Object Oriented Design by having the child manage too much. The grandparent should be listening for the MouseDown and then managing the drag. You could have a single event handller that checks for the MouseDown and checks the Class of the target (set mouseChildren to false on the button, so the target won't be its label, for example.

  • Resize attached movie clip

    Hi,
    I have a movie clip to which I attach several others always
    at the same depth so one replaces the other. I was trying to change
    the size of the attached movies by setting the ._width and ._height
    properties and also by using the xscale without any luck. I finally
    experimented with a tutorial example and got it to work and saw
    that the only difference between the code in the example and my own
    was the depth which I had set to 1 and the tutorial had set to 0. I
    changed my depth to 0 and it worked.
    I didn't see anything specifying that the depth had to be 0
    and believe I am still missing something. If anyone cna help me
    figure out what's going on I would appreciate it.
    Thanks
    Chris

    From the location of the code, the relative path to newSlide
    is
    full_mc.newSlide as newSlide is in full_mc.
    Thus you want:
    function updateStage() {
    full_mc.attachMovie(mySlide, "newSlide", 0);
    full_mc.newSlide._width = 561;
    full_mc.newSlide._height = 421;
    full_mc.newSlide._x = 0;
    full_mc.newSlide._y = 0;
    Also note that you can do:
    full_mc.attachMovie(mySlide, "newSlide",
    0,{_x:0,_y:0,_width:561,_height:421});
    Look up attachMovie for the optional initObect
    parameter.

  • Unable to Sync Quicktime Movie Clips with IPOD

    I am a new ipod user having difficulty syncing Quicktime movie clips to IPOD.
    Clips are saved as .mov files and Itunes will play.
    However I cannot get them to sync woth IPOD.
    Any ideas - Do I need to convert to annother format?

    First you need to import your movies into iTunes. Do this by opening iTunes <File> <Import> <Movies> then choose the movie you want to put on your iPod. Make sure the movie has .mov at the end otherwise it won't be set up the way it's supposed to be.
    Once the movie is imported into iTunes right click on it so a pull down menu appears. Click on <Convert Selection for iPod/iPhone>. It should begin converting it on its own and when it's done you'll hear the typical sound that happens after importing a cd, telling you the operation is complete.
    After it's converted, you will have 2 identical movies in your menu. If you <Get Info> on each, you should be able to see which is newest version; that is the movie you are going to want to sync.
    Then plug your iPod in to iTunes, go to the movie tab in iPod summary and check off the converted movies you want to sync to your iPod. Press <Sync> and that should add your movies to your iPod.
    Hope this helps.

Maybe you are looking for