wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

NullPointerException in SuperTabNavigator when using NavigatorContent #295

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create SuperTabNavigator w/ tabs as NavigatorContent (Flex4)
2. Run the application
3. Get an exception:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at 
flexlib.containers::SuperTabNavigator/reorderTabList()[C:\Users\dfilippo\Desktop
\flexlibSVN\src\flexlib\containers\SuperTabNavigator.as:1183]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:11354]
    at mx.core::UIComponent/callLaterDispatcher()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:11292]

Code at SuperTabNavigator.as at line 1176:

        var child:Container = this.getChildAt(i) as Container;

        var obj:Object = new Object();
        //setting the type to an empty string bypasses a bug in MenuItemRenderer (or in 
        //DefaultDataDescriptor, depending on how you look at it). Try commenting out the
        //line and check out the menu items.
        obj.type = "";
        obj.label = (child.label != "") ? child.label : "Untitled Tab";

Explanation: NavigatorContent is not a Container so when a tab above is cast to 
Container type, child becomes null.
Workaround: let child object be an INavigatorContent.

Original issue reported on code.google.com by dasha.fi...@gmail.com on 19 Apr 2010 at 8:28

GoogleCodeExporter commented 8 years ago
Thanks for the suggested workaround:

Replace line 1174:
var child:Container = this.getChildAt(i) as Container;
with
var child:INavigatorContent = this.getChildAt(i) as INavigatorContent;

Original comment by jessewo...@gmail.com on 30 Apr 2010 at 1:34

GoogleCodeExporter commented 8 years ago
happens in flexlib 2.5. for Flex 4 as well - same line, same issues

Original comment by dasha.fi...@gmail.com on 9 Jul 2010 at 2:48

GoogleCodeExporter commented 8 years ago
How did you guys replace the code? I am not able to get the source code to 
flexlib? Any pointers, please.

Original comment by rajvbhar...@gmail.com on 7 Oct 2010 at 11:27

GoogleCodeExporter commented 8 years ago
@rajvbharadwaj

1) Download the zip file and unzip it
2) Create a new Flex Library Project
3) Copy the contents of the src directory into the project src directory. This 
includes the flexlib directory and the manifest.xml file
4) Open SuperTabNavigator.as under flexlib/containers
5) Update the line and compile
6) Copy the new swc to the lib folder of the project you're using it in.

Original comment by jessewo...@gmail.com on 7 Oct 2010 at 11:40

GoogleCodeExporter commented 8 years ago
Thanks @jessewolff. I did the same, but when I get the project into FB$, I get 
an error for undefined FLEX_TARGET_VERSION. I am wondering where I set this 
property. I am using Flash Builder 4.

Original comment by rajvbhar...@gmail.com on 8 Oct 2010 at 1:23

GoogleCodeExporter commented 8 years ago
Make sure the following is set under the 'Flex Library Compiler' project 
properties:

Namespace URL:
http://code.google.com/p/flexlib/

Manifest file:
manifest.xml

Additional compiler arguments:
-locale en_US -define+=FLEX_TARGET_VERSION::flex4,true 
-define+=FLEX_TARGET_VERSION::flex3,false

Original comment by jessewo...@gmail.com on 8 Oct 2010 at 1:34

GoogleCodeExporter commented 8 years ago
Cool, thank you very much!

Original comment by rajvbhar...@gmail.com on 8 Oct 2010 at 2:51