Flashack #978

Posted by Matt

Recently, while programming a little RSS feed Flashlet, I came across a bug in Flash involving the MovieClip.createTextField() method. A bug that felt strangely familiar.

I originally ran into this bug while programming the McDougal-Littell “Take-Home Tutor” a couple of years back (in my previous life) and had pretty much forgotten all about it…until now (glad to know the old noodle’s still working).

I’m loading the RSS feed from a blog and dynamically creating textfields using the MovieClip.createTextField(…) method to house the content from the feed within container movieclips. When I would try to lay these clips out they would end up overlapping a few ten or twenty pixels or so. On a whim I tried calling “._height” on the container clip I was using for layout just before placing the next clip and low and behold that seemed to do the trick.

The code looks something like this:

// is this is a Flash bug?
// force prevClip to recalc its height
prevClip._height;
nextClip._y = prevClip._y + prevClip._height;

I’m assuming the call to prevClip._height forces the movieclip to recalculate its height before continuing on with the layout.

Hooray for trying random stuff!

Comments are closed.


©2006 Delicious Mission, Inc. All rights reserved. RSS Feed RSS IconRSS XHTML Validation IconXHTML