This content has been marked as final. Show 4 replies
When the DOM was added to D10, they did an incomplete job. There are runtime identification problems when accessing native director objects inside LDMs and MIAWs.
Your code looks fine to me although I did not test it.
I believe the following will hack around this bug. Also un-tested.
StageRect = getLdmProp(#ldmMovie).stage.rect -- this makes things more readable/understandable
spriteRect = rect(0,0,StageRect-StageRect,StageRect-StageRect)
repeat with myChannel = 2 to getLdmProp(#ldmMovie).lastChannel
RectOb = getLdmProp(#ldmMovie).sprite(myChannel).rect
TmpRect = rect(RectOb,RectOb,RectOb,RectOb)
spriteRect = spriteRect.union(TmpRect)
An LDM doesn't really have a stage.rect as such. If you are scrolling the contents of your LDM, then I assume that you are setting its #crop property to TRUE. In this case, you can consider that its width and height of the "stage" of the LDM is the same as that of the host sprite. As for the bounding rect of its elements, will this work for you:
Thanks all. Production Monkey was right in that the LDM seems to return rect objects, not simple rectangles. This is true both in the LDM scope and the value returned to the parent. The attached code works and has been tested but note that I’ve changed some variable names for readability.
James, yeah the LDMs are set to crop and the scroll bars actually shuffle the sprites within the LDM, the stage of the LDM essentially being the view port in the parent. I couldn’t come up with a better way to scroll mixed sprite types within a window. Works well for at least 100 vector items which is about all I need. I considered using MIAWs but that introduced more problems than LDM’s. Thanks for the code, I’ll check it against what I’m using now for speed.