Solved

Setting depths in Flex 4

Posted on 2010-09-10
4
820 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
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.

726 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