A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Changing layer order onclick

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Location
    Essex, UK
    Posts
    11

    Changing layer order onclick

    Hi gang,

    Another newbie here trying to get into the wonderful world of Flash.

    As usual, nothing simple here, I think I'm trying to run before I can walk but here it goes:

    I'm trying to create a "Drag 'n Drop" flash app in a 800x600 movie, that bit is simple but the items I wish to drag onto the canvas number too many to fit the area sooooooo ....
    Is there a way of putting groups of MC's onto a layer and stack them underneath each other and get a button to bring any one of them forward to enable users to drag onto the canvas (Does that make sense?).

    I've tried making layers visible etc but then the first group of MC's dis-appear from the canvas which is not what I want.

    Any help would be gratefully accepted as my head is starting to hurt from banging on the wall

    BTW: Using Flash 8 if that makes any difference?

    Cheers

    Tigger7
    Last edited by Tigger7; 06-12-2007 at 11:08 AM.

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    Nottingham, England
    Posts
    203
    Hey there - Look at depths in more detail. Depth is a value that flash uses to determine how objects are "stacked" on the stage. Similar to how we use layers. It's hard to know exactly what you want without seeing it in the flesh.

    There are a variety of AS depths functions such as
    Code:
    getNextHighestDepth(); getDepth(); swapDepths();
    all of which may help you here.

    Possibly have an array to keep track of all objects on the "canvas" and then use a loop to check if the selected objects depth is lower than all other canvas objects using getDepth(); and if true, swap depths.

    So basically, it could be complicated but it's hard to tell without doing the whole thing myself. All.. the best? :\

    Sorry I couldn't be of more help! - Chris

  3. #3
    Junior Member
    Join Date
    Jun 2007
    Location
    Essex, UK
    Posts
    11
    Thanks for the reply Lightspeed, sorry but it would have helped if I showed you what I was using it for.
    Here is the FLA File

    I want to be able choose a set of items from the dropdown (or button if need be), and drag them onto the dashboard, then have them stay there and choose some more items from the dropdown.
    Trouble is, they way I have it at the moment, when choosing something else, the first selection dis-appears, so frustrating when your learning ain't it?

    This is still in the early stages of development so not all the item groups have been done, just the first 3.

    Cheers

    Tigger7

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Location
    Nottingham, England
    Posts
    203
    Ahh ok. I've had a quick look. When you click a component, you're dragging that actual image onto the dash which will seemingly disappear when you change the component set because it only exists on one frame. Way to solve it is to have it attach a new component from the library to drag around, instead of the actual one from the screen. I'll have a tinker for you when I have time to try and help you out.

    - Chris

  5. #5
    Junior Member
    Join Date
    Jun 2007
    Location
    Essex, UK
    Posts
    11
    Chris,

    You are a Star, thanks very much for you time

    Kind Regards

    Tigger7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center