views:

275

answers:

4

In my flex application, I have a custom TitleWindow that pops up in modal fashion. When I resize the browser window, I get this warning:

Warning: Filter will not render. The DisplayObject’s filtered dimensions (1286, 107374879) are too large to be drawn.

Clearly, I have nothing set with a height of 107374879.

After that, any time I mouse over anything in the Flash Player (v. 10), the CPU churns at 100%. When I close the TitleWindow, the problem subsides. Sadly, the warning doesn't seem to indicate which DisplayObject object is too large to draw. I've tried attaching explicit height/widths to the TitleWindow and the components within, but still no luck.

[Edit]

The plot thickens: I found that the problem only occures when I set the PopUpManager's createPopUp modal parameter to "true." I don't see the behavior when modal is set to "false." It's failing while applying the graying filter to other components that comes from being modal. Any ideas how I can track down the one object that has not been initialized but is being filter during the modal phase?

Thanks for reading.

A: 

Sadly I have no idea, but we're trying to track down a similar issue in ours. Maybe this will help?

http://www.mail-archive.com/[email protected]/msg48091.html

Jay Paroline
+3  A: 

This might not be the case in your application, but I have come across similar cases where a height or width of an object has been set to some unreasonable big number as the result of misuse of an unsigned integer in calculations for positioning, height or width.

Schematic code for such a scenario could be like this:

var offset:uint = 30;
var position:uint = txt.textHeight - offset;
divider.y = position;

The code wrongfully assumes that txt.textHeight will always be bigger than 30. If it is not, txt.textHeight - offset will be a negative number, that when stored in an uint will instead become a very large number.

Let's say for example that the text in txt, presumed to be a long multiline text, instead is a single line that is 20 pixels heigh. The result will then be -10, and when stored in the uint var position, the value of position will be 4294967286.

The above is crappy code, an example, but in a real world situation the uint problem can occur in some more complex way, that might be harder to spot right away. I guess it is seldom a good idea to use an unsigned integer for stuff like x and y positions, that can have negative values.

Lars
I was trying to manually center a label within a component. The component was used as a drop-in item renderer and it had a shorter height than the label. To center the label in the component, vertically, the upper-left corner of the label was at Y = -2. I was caluclating the centered X,Y coordinates with uint. Calling label.move(2, -2) (with an un-signed int) resulted in the label being place way out in no-man's land and the filter was being applied to the entire application (including the label sitting off-stage). In fact, the label was in a viewStack, but not in view, so even stranger.
davidemm
The fact that it was a move(x,y) issue made it more difficult to diagnose because there were no components that had any irregular sizing.
davidemm
+1  A: 

You could write some code to recursively step down the hierarchy of DisplayObjectContainer and DisplayObject objects and check for the large height.

Should be pretty simple to write. A function something like this should do the trick:

function RecurseDisplayObjects(DisplayObject obj):void
{
    //check for height and do a trace() or whatever here

    if(obj is DisplayObjectContainer)
    {
        var container:DisplayObjectContainer = obj as DisplayObjectContainer;
        for(var i:int=0; i<container.numChildren; i++)
        {
            RecurseDisplayObjects(container.getChildAt(i);
        }
    }
}

You would need to start this off by passing it the top level DisplayObject in your application. (possibly obtained with DisplayObject.root)

The other option you have is to get the Flex framework source and modify it to give you a more meaningful error.

DanK
This was helpful in diagnosing my problem. I found that no DisplayObjects were oddly sized because my problem was with an inline itemRenderer, which doesn't show up as a child.
davidemm
I didn't know that renderers don't show up as children in the display hierarchy - that's useful to know. Thanks for the comment.
DanK
+1  A: 

The problem is probably not in your TitleWindow, but in objects below it. The filter failing to render is probably the blur filter flash applies over everything below the modal dialog. If one of the objects on the stage is too big to apply blur on it in real time, you get the error you mentioned.

I solved that problem by applying a mask to the object below the titlewindow, set to the size of the stage. That will probably solve your problem but you should definitely look into why something gets to that size, doesn't sound healthy. :-)

jpop