• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

SWAP IMAGES...

Explorer ,
May 11, 2009 May 11, 2009

Copy link to clipboard

Copied

Hi all,


I have 3 images...

I created 3 movie clips for each one (a_mc, b_mc, c_mc). It shows up as one behind the other, but what I want is to: click on the  movie clip that is shown as the last one (or the second one) and have it appear at the front (a swap with the first) with a nice transition.
 
Thank you all.

swapimages.jpg

Kglad answer:

var mcA:Array=[a_mc,b_mc,c_mc];

for(var i:uint=0;i<mcA.length;i++){

mcA.addEventListener(MouseEvent.CLICK,f);

}

function f(e:Event){

setChildIndex(e.currentTarget,numChildren-1);

}

// and you'll need to create your transition.

My Reply

Hi, Kglad...

thank you for you Help. I think that I should not have post it this under AS3... because the answer to my question  actually is:

swapDepths

on (press, dragOver) {
    startDrag(_root.c_mc);
}
on (release, rollOut, dragOut) {
    stopDrag();
}
on (press, release, dragOver, dragOut) {
    _root.x +=2;
    _root.c_mc.swapDepths(_root.x);
}

I'm still looking for the way to do it with a transition or effect.

(The effect I want is to see the transition from behind to front....)

TOPICS
ActionScript

Views

586

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 ,
May 12, 2009 May 12, 2009

Copy link to clipboard

Copied

I'm not completely sure what you're after here, but have a look at this example. Each of the movieClips stay in the same location, they just change depth. I added a simple fade animation for the transition. Feel free to adapt as needed.

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 ,
May 12, 2009 May 12, 2009

Copy link to clipboard

Copied

Or you could look at this file: http://www.ddg-designs.com/downloads/changeDepth.zip

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
Explorer ,
May 15, 2009 May 15, 2009

Copy link to clipboard

Copied

LATEST

Thank you, Rob. That's perfect!

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
Community Expert ,
May 12, 2009 May 12, 2009

Copy link to clipboard

Copied

or check into a carousel effect.  a narrow (or 0-width) carousel would make a nice transition.

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