|
From: | Andrew Sinning |
Subject: | [Swftools-common] Warning: Failed to place object at depth n |
Date: | Fri, 25 May 2012 09:18:00 -0500 |
I’ve run into a problem using my pdf-swfs in
AIR. I seem to have found a solution, so I thought I would post it here
in case anyone else has similar issues. For the purpose of testing the robustness of my application,
I am loading a single-file 500 page pdf-swf into my e-reader. The problem is that when going from page to page, I see that
some of the content from a previous page remains visible. In the debugger
I see a long list of warnings: Warning: Failed to place object at
depth 1 Warning: Failed to place object at
depth 2 Etc. I’ve stumbled upon the following work around.
Before going to a new page, I go the following: // _mainTimeline
is the movieClip of the book if
(_mainTimeline.currentFrame != targetFrameNum) { var chldCnt:int = _mainTimeline.numChildren; for (var n:int = 0; n < chldCnt; n++) { _mainTimeline.removeChildAt(0); if (_mainTimeline.numChildren
== 0) { break; } } _mainTimeline.gotoAndStop(targetFrameNum); } // NOTE, it would be short
to code the iteration as while
(_mainTimeline.numChildren > 0) { _mainTimeline.removeChildAt(0); } but I saw the program lockup when I first went to test this,
so I added the extra precautionsof only running the loop numChildren times and always
checking that there are still children left to remove. It is probably over-kill,
but better safe than sorry. |
[Prev in Thread] | Current Thread | [Next in Thread] |