Solved

Setting depths in Flex 4

Posted on 2010-09-10
4
812 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

929 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now