Solved

Setting depths in Flex 4

Posted on 2010-09-10
4
814 Views
Last Modified: 2012-08-13
Flash Builder 4 is telling me I should use setElementIndex instead of the usual setChildIndex, but that doesn't seem to be working. Any advice would be welcome.

Her is the format I would be using, when a button is pressed:

                  protected function setDepths(event:Event):void{
                        var clip = event.target;
                        this.setElementIndex(clip, this.numChildren-1);
                  }

Devin
0
Comment
Question by:devinvail
4 Comments
 
LVL 3

Assisted Solution

by:cconstable_work
cconstable_work earned 250 total points
ID: 33660071
I believe it is numElements:
this.setElementIndex(clip, this.numElements-1);
0
 
LVL 14

Accepted Solution

by:
tomaugerdotcom earned 250 total points
ID: 33831628
I'm not exactly sure what your code is trying to accomplish, but I'm guessing you want to bring whatever element has been clicked on to the FRONT of the collection within its parent visualElementContainer.

If that's the case, I'm guessing there's a slight error in your logic.

Assuming that the event listener is on one of the child IVisualElement objects within an IVisualElementContainer...

protected function bringToFront(event:MouseEvent) {
  var visElement:IVisualElement = event.target;

 // visElement.parent returns type DisplayObject, so let's cast it as an IVisualElementContainer
 // (I have not tested this)
  var parentContainer:IVisualElementContainer = IVisualElementContainer(visElement.parent);

  parentContainer.setElementIndex(visElement, parentContainer.numElements - 1);
}

So the salient difference in my code is that I'm calling setElementIndex on the parent container, not on the element that was clicked. Not sure if this aligns with the way you intended to use the event handler.

T
Hope this puts you on the right track...
 
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 34078424
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
anti-download video publishing site? 6 614
File drag and drop 6 142
free photo watermark software 5 84
deploy Adobe and Java updates to 100 workstations using LogMeIn Pro? 5 156
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question