• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Movieclip to top

Participant ,
Jun 15, 2009 Jun 15, 2009

Copy link to clipboard

Copied

How do I move a movie clip to top? I have 4 clips on stage and they alpha in and out. WHen one is at alpha 100% I want it to be above all the other is this possible?

TOPICS
ActionScript

Views

758

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 15, 2009 Jun 15, 2009

Copy link to clipboard

Copied

Say your movie clips are mc1, mc2,mc3,mc4

now call following snippet...(for now say I want mc4 to be on top)

mc4.parent.addChild(mc4);

ASSUMPTION: all the movie clips are in the same container i.e. mc1.parent == mc2.parrent == mc3.parent == mc4.parent

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2009 Jun 15, 2009

Copy link to clipboard

Copied

Using addChild() will bring something to the top, so for a movieclip named "mc" (or a variable "mc" that points to the movieclip) you can say this:

mc.parent.addChild(mc);

and now mc will be on top of everything else that is in the mc's parent level.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 15, 2009 Jun 15, 2009

Copy link to clipboard

Copied

I used this code:

function
moveToTop( clip:DisplayObject ):void
{
     clip.parent.setChildIndex(clip, clip.parent.numChildren-1);     
}

    My clips exist on stage and tween in I'm not sure how the addChild would work? I prob could have set it all up differently.

    Votes

    Translate

    Translate

    Report

    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    LEGEND ,
    Jun 15, 2009 Jun 15, 2009

    Copy link to clipboard

    Copied

    There would be no difference between your setChildIndex(clip,clip.parent.numChildren-1) and just using clip.parent.addChild(clip).

    Votes

    Translate

    Translate

    Report

    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Participant ,
    Jun 15, 2009 Jun 15, 2009

    Copy link to clipboard

    Copied

    LATEST

    sweet. Thanks!

    Votes

    Translate

    Translate

    Report

    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines