Solved

Setting depths in Flex 4

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

707 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

13 Experts available now in Live!

Get 1:1 Help Now