Vector Shape on Stage Appears Over Dynamic Textfield

The subject pretty much explains it all. I start on frame one of a MovieClip with just a Bitmap covering the whole stage.

Then when a user clicks a button, it goes to frame two and a vector shape is on the stage covering part of the image. At the same time, through code, I place an input Textfield on the stage.

Problem is, the dynamically created Textfield is appearing UNDER the vector shape (which was drawn on the stage)! This seems to be a problem that is new to ActionScript 3, as I did not have this problem with Flash CS3 and ActionScript 2.

I've tried putting the Textfield on different layers, but to no avail. How do I get the Textfield to appear over the vector shape?


Put the vector shape inside a movieclip. Then call:

setChildIndex(myTextField, numChildren - 1);

I've already tried that. It's wacky stuff like this that's keeping me from migrating my frameworks to AS 3.

I have determined that the issue somehow lies in the way that Flash renders what is on the stage. When calling; introduces new objects to the stage -- while at the same time programmatically placing other objects on the stage -- the objects that were hand-placed on the stage will always render directly on top of any programmatically created objects. This might not be everyone's experience, but that is what I am seeing.

My solution: call;, wait 10ms and then place other objects on the stage.

You can try adding the vector shape through code and then add the textfield.

var vectorShape:Sprite = new Sprite();  

var textField:TextField = new textField();  

That would put the vector shape below the textfield.

It sounds like your trouble arises because the design-time vector and the runtime text field come into existence in the same frame, so it's a timing issue where they appear and when you can move them.

The easiest thing might be to avoid this problem. One way would be to create an empty movie clip (on the stage, at design time) to be a holder for the text field, layer it wherever you want, and create the text inside of it at runtime. Another solution would be to create either the vector or the text field (or both) in frame 1, but keep it/them invisible until necessary.

Need Your Help

What's the difference between Matcher.lookingAt() and find()?

java regex

I am looking at Java regex tutorial, the title pretty much explains itself. It looks like Matcher.lookingAt() is trying to match the entire String. Is that true?

Threading issues using Ping to map active IPs - C#

c# .net multithreading backgroundworker ping

I am trying to create a simple Network Tool to ping all possible IPs on your local subnet and provide a list of such IPs in a DataGridView. I am new to having to consider threading which is a good...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.