Skip to main content
Known Participant
February 1, 2010
Answered

why does my button end up behind xml-loaded images?

  • February 1, 2010
  • 1 reply
  • 538 views

Hi,
I am trying out an AS2 xml image gallery from a tutorial online (code attached). I have also found out how to add a button to the stage that takes the SWF-movie into true full screen (code also attached).

But the problem is that the images from the xml are placing themselves above the button so that the button can't be seen or used. I would of course like to overlay the button on top of the loaded images.

But I can't find out how to do that. Admittedly I am new to Flash. I thought that putting the button on a new layer above the first layer with the AS2 xml image gallery code would do the trick, but it did not.

How can I specify that the button should be "always on top"?

Thanks a lot!

/G

This topic has been closed for replies.
Correct answer kglad

you can assign your button's instance names (if they don't already have names) and use the swapDepths() method of movieclips to move your buttons above your images.  for example, if you images all have depths less than 1000000:

btn1.swapDepths(1000000);

btn2.swapDepths(1000001);

btn3.swapDepths(1000002);  // etc

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 1, 2010

you can assign your button's instance names (if they don't already have names) and use the swapDepths() method of movieclips to move your buttons above your images.  for example, if you images all have depths less than 1000000:

btn1.swapDepths(1000000);

btn2.swapDepths(1000001);

btn3.swapDepths(1000002);  // etc

Known Participant
February 1, 2010

Thanks a lot for that answer! Did the trick.

(For people having the same question as I had, remember to also assign a stacking value to the item/movie that is to go underneath the button.)

kglad
Community Expert
Community Expert
February 1, 2010

you're welcome.