22 Replies Latest reply: May 9, 2013 7:38 PM by duzhiwei RSS

    How to debug this?

    BurtJ Community Member

      Under Flash Player 10.1 on Windows, we are suddenly getting an error that did not occur under player 9 or 10, and does not appear in any version of player on Mac.  The biggest problem is that the entire error stack is inside the Flash framework, initiated by a callLaterDispatcher.  Flash complains that an index is out of bounds, but gives zero information on what the parent or child object is, or what the index number is that is being passed.

       

      I have all bug given up trying to find the source of the problem in our code, which runs for several thousand lines, covering half a dozen internally created classes.  I see a 'hook' at (C:\autobuild\3.2.0\frameworks\...), but cannot even see that folder on my system? (yes, I have 'show invisible' set for my file system -- this is Windoze XP, for what it's worth).

       

      Any suggestions on how to track down a problem like this?

       

      RangeError: Error #2006: The supplied index is out of bounds.
          at flash.display::DisplayObjectContainer/getChildAt()
          at mx.core::Container/getChildAt()[C:\autobuild\3.2.0\frameworks\project s\framework\src\mx\core\Container.as:2334]
          at fl.managers::FocusManager/addFocusables()
          at fl.managers::FocusManager/addFocusables()
          at fl.managers::FocusManager/addFocusables()
          at fl.managers::FocusManager/addFocusables()
          at fl.managers::FocusManager/addFocusables()
          at fl.managers::FocusManager/activate()
          at fl.managers::FocusManager()
          at fl.core::UIComponent/createFocusManager()
          at fl.core::UIComponent/initializeFocusManager()
          at fl.core::UIComponent/addedHandler()
          at flash.display::DisplayObjectContainer/addChild()
          at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::createContentPane()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Contai ner.as:4665]
           at  mx.core::Container/createOrDestroyScrollbars()[C:\autobuild\3.2.0\fra  meworks\projects\framework\src\mx\core\Container.as:4410]
          at  mx.core::Container/createScrollbarsIfNeeded()[C:\autobuild\3.2.0\fram  eworks\projects\framework\src\mx\core\Container.as:4359]
          at  mx.core::Container/createContentPaneAndScrollbarsIfNeeded()[C:\autobu  ild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:4175]
          at mx.core::Container/validateDisplayList()[C:\autobuild\3.2.0\framework s\projects\framework\src\mx\core\Container.as:2691]
           at  mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\f  rameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
           at  mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0  \frameworks\projects\framework\src\mx\managers\LayoutManager.as:695]
          at Function/http://adobe.com/AS3/2006/builtin::apply()
           at  mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\framew  orks\projects\framework\src\mx\core\UIComponent.as:8628]
          at  mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\framewo  rks\projects\framework\src\mx\core\UIComponent.as:8568]

        • 1. Re: How to debug this?
          Flex harUI Adobe Employee

          Not sure why you are having version-specific problems.  This call stack is

          typical of mixing Flash fl.. components with Flex components.  They are

          incompatible.

          • 2. Re: How to debug this?
            BurtJ Community Member

            What do you mean that flash and flex are not compatible?? Can you elaborate on that statement?

             

            This is a program with over 1 million users already, and we have had no problems with it until Flash 10.1 was released. Suddenly we got user complaints about it no longer working.  When we tested, we discovered this stack dump on launching if Flash 10.1 was running on a Windows XP machine (I am not sure about Vista or 7, but I do know it still works on Mac 10.1).

             

            This was originally developed under Flash 9, then later migrated to 10, at which point we added more improvements.  All was well in Leapfrog-land until 10.1 came out...

            • 3. Re: How to debug this?
              George I Flex

              Try launching this from the debugger. When the app breaks you can look into the variables/expressions panel and find which component is throwing this. Then look at what children is that component adding/removing.

              • 4. Re: How to debug this?
                BurtJ Community Member

                uhhh... I AM using the debugger, or I wouldn't be seeing the stack at all.  I can't look at the variables though, because the

                crash does not occur anywhere in my code.  As my original post noted, the entire stack trace is inside the

                Flash framework.  It starts with a callDelayed method and burrows into the frame

                work.

                 

                There is nowhere to put a breakpoint in my code...

                 

                Or is there a way to get the source code for Flash and actually break in there??

                • 5. Re: How to debug this?
                  George I Flex Community Member

                  Yeah, I think I misunderstood.

                   

                  Normally when you have a flex app, even if breaks in the flash player code, you can still see the debugger freezing and you can find the causing component. When you have a flash component acting as a flex one I think that might not work anymore.

                  • 6. Re: How to debug this?
                    Flex harUI Adobe Employee

                    fl.. components and mx.. components cannot co-exist. It works sometimes,

                    but often you will hit these issues with the fl FocusManager.

                    • 7. Re: How to debug this?
                      BurtJ Community Member

                      Ouch!  We use both extensively in this app.  We have 9 inherited classes that we import, that I will have to investigate yet.  However, the top of this particular app has the following imports.  Looks like I'm got my hands full with a lot of rewriting stuff that has been working for more than a year.  This was NOT in our schedule, either for development or SQA...

                       

                      BTW, thanks for giving me a direction to look, even if it wasn't the type of answer I was hoping for...

                       

                      import flash.display.DisplayObject;
                      import flash.display.MovieClip;
                      import flash.display.Shape;
                      import flash.events.Event;
                      import flash.events.IOErrorEvent;
                      import flash.events.MouseEvent;
                      import flash.events.TimerEvent;
                      import flash.filters.ColorMatrixFilter;
                      import flash.geom.Point;
                      import flash.utils.Timer;

                       

                      import mx.controls.Alert;
                      import mx.controls.Image;
                      import mx.events.CloseEvent;
                      import mx.events.ResourceEvent;
                      import mx.events.StyleEvent;
                      import mx.rpc.events.FaultEvent;
                      import mx.rpc.events.ResultEvent;

                      • 8. Re: How to debug this?
                        Flex harUI Adobe Employee

                        flash.. is not fl..

                         

                        You can use all the flash.. stuff you want.  Somehow, a fl.. component

                        got into your app.  You can use link-reports to find out how if it isn't

                        apparent.

                        • 9. Re: How to debug this?
                          BurtJ Community Member

                          THANK YOU for that clarification.  I was tearing my hair out, since everything I read told me that Flash and Flex were fine partners.

                           

                          No idea what a fl* component is, or how it got in there.  Several of the inherited classes were written by engineers no longer with the company, so I will have to search those, now that I know it is 'fl.*'

                           

                          Unfortunately I got this message just as I got home, so I will have to wonder all night if this solves the problem or not...

                          • 10. Re: How to debug this?
                            Flex harUI Adobe Employee

                            The fl.. components come with the Flash IDE in the CreativeSuite.  And

                            even older versions before that.

                             

                            If someone starts using the built-in components from the Flash IDE in a Flex

                            app, trouble like this occurs.  The call stack listed an fl.. class which

                            is why I am offering this as the root cause of the problem.  I still don't

                            see how changing player versions could really cause it unless there was a

                            subtle timing issue.

                             

                            You can create your own components in Flash and use them in Flex via the

                            Flex/Flash Component Kit, but you can't use fl.. components in those

                            components.

                             

                            If you don't want to wonder all night, you can always load up on caffeine,

                            get back in your car and head back to the office.  However, if it helps, the

                            call stack is like a fingerprint.  It has implicated the fl.. components.

                            They will need to be removed at some point.

                            • 11. Re: How to debug this?
                              BurtJ Community Member

                              Unfortunately, when I do a search on "fl." in the entire project (in FlexBuilder 3), there are no hits.  It does not appear to be in our Flex code.

                               

                              Searching for 'fl.' on the web looks to me like it is a Flash component used for lists and tweening (at least those were the two most common Google hits).  Is that true?

                               

                              We are using a SWFLoader to load up 4 Flash SWF files that animate on this page (the page lists games the user can play, each with its own 2" X 3" animated index, showing 4 at a time).  Those animations were created by an outside contractor, and I do not have the source code for them.

                               

                              Is it possible that a Flash animator would have used a fl.* component, which would then choke when we display that animation on a Flex Canvas?

                               

                              (I am trying to find a hook in our code now, that would allow me to place a PNG in place of the SWF, to see if that stops the crash, which would then let me point the finger there for sure)

                              • 12. Re: How to debug this?
                                BurtJ Community Member

                                I have generated a link-report, and searched that XML output.  There is no "fl." in that report. 

                                 

                                Additionally, I have discovered that the sections I thought were SWF are actually just roll-over buttons (PNG files with sound that plays when rolled over).  The SWF files don't load until later, and they work flawlessly (if I dismiss the error and let things progress).

                                 

                                I would still love to find that fl component, or discover a way to set a breakpoint down in the guts of Flex mx component, where I could hopefully get a better clue of what was being asked for.  Lacking any progress in that field, I am going to start looking in a different direction though, and see if I can get the app to work despite this problem.  As is, the error is stopping the loading of subsequent resources, which causes things to appear to hang once the user presses a button.

                                • 13. Re: How to debug this?
                                  George I Flex Community Member

                                  Hi,

                                   

                                  If looking through the code didn't work try looking over the user interface for elements like: Flash Checkbox, Flash RadioButton, Flash TextInput, Flash TextArea, ColorPicker, etc. Your code breaks because of a UIComponent subclass so you can look here : http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html and go through the list of subclasses, and their subclasses, etc ... and see if your Flash components use any of them.

                                   

                                  Good luck, you're gonna need it .

                                  • 14. Re: How to debug this?
                                    Flex harUI Adobe Employee

                                    Looking at the original stack dump, it indicates that there is no debug info

                                    for the fl.. components.  So it could be in one of those Flash SWF files.

                                    • 15. Re: How to debug this?
                                      BurtJ Community Member

                                      Yeah, we stepped into mx.Container, but could not go lower. It then  crashed out of our code sight.  No joy there, with no debug info for the  fl components.

                                       

                                      I now have the code to where there is no SWF being  loaded by us.  We are using FlexBuilder 3 as our IDE.  The only SWF  currently is what gets run after FlexBuilder converts our Flex code into  a SWF.

                                       

                                      Are you saying the FlexBuilder is using illegal  fl.* components when we tell it we want an mx.* component?  How / why  would Adobe do that, if the two are not compatible?

                                       

                                      We  have a major release in 3 weeks, so I have been delaying moving to  FlashBuilder 4 until after that release.  If I were to upgrade now,  would that likely solve this problem?

                                      • 16. Re: How to debug this?
                                        Flex harUI Adobe Employee

                                        FlexBuilder won't use fl.. component unless someone has placed them in the

                                        lib-path.

                                         

                                        Did you verify the exception is the same and has fl.. in the callstack?

                                        Did you verify from the debugger console that only one SWF got loaded?

                                        If you have done both, then generate another link-report and post it.

                                        • 17. Re: How to debug this?
                                          BurtJ Community Member

                                          Sigh... Hit me with big enough 2X4 and I finally wise up.  You just hit the nail on the head  (w/ a 2X4?) ...

                                           

                                          The key was to look at the console and notice that there was another swf being loaded.  Sure enough, there was one more that I kinda knew about, but was not in the main flow of things.

                                           

                                          It is the "progress donut" used display progress as we load our resources.  The original authors put that in ages ago, and it has worked so well that we all take it for granted and haven't looked at it for at least a couple years.  It was also supplied by an outside vendor, and our internal artist doesn't understand the code, so we left it a black box.

                                           

                                          I commented out the loading of that donut, and the stack errors went away.  Our artist is now working on a new version that will be purely artwork.

                                           

                                          Our problem is now SOLVED!  Thanks for all of you Adobe folks for sticking with this until I saw the light of day.

                                           

                                          There still is the open question of why this has worked so flawlessly for 2 years, written under Flash 9, used under Flash 10, then suddenly fails under Flash 10.1?  I'm probably not going to spend more cycles trying to figure that out though.

                                           

                                          There is also another error much further in the code, where a package no longer properly loads under 10.1.  I expect it is a completely separate issue though, and will start to investigate it this morning.

                                          • 18. Re: How to debug this?
                                            Flex harUI Adobe Employee

                                            It is possible that in 10.1 or due to some other change, something is sizing

                                            slightly differently than before and causing scrollbars to show up.  The

                                            fl.managers.FocusManager can't handle the way Flex puts up scrollbars.

                                            • 19. Re: How to debug this?
                                              BurtJ Community Member

                                              That appears to be exactly what happened.  Our loading animation used a canvas that exactly filled our opening screen.  By shrinking the canvas to the size actually needed by that animation (MUCH smaller), the problem disappeared.

                                               

                                              Turned out the second "package won't load" problem was also related to this animation.  The code (which I wrote a year ago), used the animator as an integral part of the process.  When it received a message that the client process was 100% complete, it sent out a COMPLETE event, and the main code listened for that event to decide it was time to put up the new game display.

                                               

                                              Since the loading animation failed, it never reached the 100% stage, and the other software kept waiting for the go-ahead to proceed.

                                               

                                              All because a change in Flash caused a very slight redrawing size.  mumble, grumble.  I'm not sure I would have ever nailed that one without your help.  Be sure to tell your boss I said you should get a raise!

                                               

                                              Now I can get back to the release of two other products I have to ship in 3 weeks.  The clock is ticking...

                                              • 20. Re: How to debug this?
                                                duzhiwei

                                                RangeError: Error #2006: 提供的索引超出范围。

                                                          at flash.display::DisplayObjectContainer/getChildAt()

                                                          at mx.core::Container/getChildAt()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.a s:2751]

                                                          at MainApp/getChildAt()[D:\!Source\SrcClient\Main\AppMain\src\MainApp.mxml:239]

                                                          at fl.managers::FocusManager/addFocusables()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\managers\FocusManager.as:272]

                                                          at fl.managers::FocusManager/addFocusables()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\managers\FocusManager.as:274]

                                                          at fl.managers::FocusManager/addFocusables()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\managers\FocusManager.as:274]

                                                          at fl.managers::FocusManager/activate()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\managers\FocusManager.as:465]

                                                          at fl.managers::FocusManager()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\managers\FocusManager.as:178]

                                                          at fl.core::UIComponent/createFocusManager()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1621]

                                                          at fl.core::UIComponent/initializeFocusManager()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]

                                                          at fl.core::UIComponent/addedHandler()[D:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1553]

                                                          at flash.display::DisplayObjectContainer/addChild()

                                                          at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::createContentPane()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:5437]

                                                          at mx.core::Container/createOrDestroyScrollbars()[E:\dev\4.y\frameworks\projects\mx\src\mx\c ore\Container.as:5183]

                                                          at mx.core::Container/createScrollbarsIfNeeded()[E:\dev\4.y\frameworks\projects\mx\src\mx\co re\Container.as:5132]

                                                          at mx.core::Container/createContentPaneAndScrollbarsIfNeeded()[E:\dev\4.y\frameworks\project s\mx\src\mx\core\Container.as:4929]

                                                          at mx.core::Container/validateDisplayList()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Co ntainer.as:3312]

                                                          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.y\frameworks\projects\framework \src\mx\managers\LayoutManager.as:736]

                                                          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:819]

                                                          at mx.managers::LayoutManager/validateNow()[E:\dev\4.y\frameworks\projects\framework\src\mx\ managers\LayoutManager.as:878]

                                                          at mx.core::Application/resizeHandler()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Applic ation.as:1734]

                                                          at mx.core::Application/commitProperties()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\App lication.as:1086]

                                                          at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx \core\UIComponent.as:8219]

                                                          at mx.managers::LayoutManager/validateProperties()[E:\dev\4.y\frameworks\projects\framework\ src\mx\managers\LayoutManager.as:597]

                                                          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:813]

                                                          at mx.managers::LayoutManager/validateNow()[E:\dev\4.y\frameworks\projects\framework\src\mx\ managers\LayoutManager.as:878]

                                                          at mx.core::Application/resizeHandler()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Applic ation.as:1734]

                                                          at flash.events::EventDispatcher/dispatchEventFunction()

                                                          at flash.events::EventDispatcher/dispatchEvent()

                                                          at mx.managers::SystemManager/Stage_resizeHandler()[E:\dev\4.y\frameworks\projects\framework \src\mx\managers\SystemManager.as:3227]

                                                 

                                                 

                                                /////////////////////////////////////////////////////////////////

                                                 

                                                I got the Same Error

                                                My application with the layout desc bellow

                                                 

                                                [MainApp:mx:Application]

                                                --[xxxx:mx:UIComponent]

                                                ---[a_mc_like_dialog:MovieClip]

                                                -----[ctrl:fl:UIComponent] //type of fl.controls.*

                                                -----...

                                                 

                                                when MainApp handle stage resize event

                                                the application crash

                                                 

                                                 

                                                the cause is in function

                                                Container::createScrollbarsIfNeeded and it change the _firstChildIndex

                                                the local var

                                                needContentPane is true

                                                 

                                                 

                                                My solution is set MainApp's properties like this

                                                                horizontalScrollPolicy="off"

                                                                verticalScrollPolicy="off"

                                                                clipContent="false"

                                                • 21. Re: How to debug this?
                                                  Flex harUI Adobe Employee

                                                  This stack trace indicates that you are mixing components from Flash Pro in your Flex app.  The built-in components from Flash Pro were not written to be compatible with Flex.  You can create your own components that don’t use Flash Pro components and build them up out of low-level shapes and sprites and integrate them in Flex with the Flash-Integration Kit.

                                                  • 22. Re: How to debug this?
                                                    duzhiwei Community Member

                                                    My application with the layout desc bellow

                                                     

                                                    [MainApp:mx:Application]

                                                    --[xxxx:mx:UIComponent]

                                                    ---[a_mc_like_dialog:MovieClip]

                                                    -----[ctrl:fl:UIComponent] //type of fl.controls.*

                                                    -----...

                                                     

                                                    when MainApp handle stage resize event

                                                    the application crash

                                                     

                                                     

                                                    the cause is in function

                                                    Container::createScrollbarsIfNeeded and it change the _firstChildIndex

                                                    the local var

                                                    needContentPane is true

                                                     

                                                     

                                                    My solution is set MainApp's properties like this

                                                                    horizontalScrollPolicy="off"

                                                                    verticalScrollPolicy="off"

                                                                    clipContent="false"