talhatima / flexlib

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

Error #1007: Instantiation attempted on a non-constructor. at flexlib.containers::WindowShade/createOrReplaceHeaderButton()[/Users/groumly/Development/workspace-3.5-flex4/FlexLib/src/flexlib/containers/WindowShade.as:258] #357

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When swf file is loaded in top of mainApplication Swf (or Wrapper file) file.
2. When moving from Flex 3 to Flex 4
3.

What is the expected output? What do you see instead?
 We should be able to see the window shade component ( button) .
 We are not able to see the button 
  Error message is displayed

      TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at flexlib.containers::WindowShade/createOrReplaceHeaderButton()
    at flexlib.containers::WindowShade/createChildren()
    at mx.core::UIComponent/initialize()
    at mx.core::Container/initialize()
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()
    at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()
    at mx.core::Container/addChildAt()
    at mx.core::Container/addChild()

What version of the product are you using? On what operating system?
 Flex builder 4.0 and SDK 4.1.0

Please provide any additional information below.

My Wrapper file (Main Application.mxml )

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="actionScriptFunction()" >

    <fx:Script> 
        <![CDATA[ 
            import flash.external.*; 
            import mx.controls.Alert;
            import mx.core.FlexGlobals;

            public function init(event : Event):void 
            { 

                myLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); 

            } 

            private function ioErrorHandler(event:IOErrorEvent):void { 
                trace("ioErrorHandler: " + event); 
            } 

            public function actionScriptFunction():void 
            { 

                myLoader.source = FlexGlobals.topLevelApplication.parameters.automationswfurl; <!-- + "?" + urlVars.toString();--> 
            }             

        ]]> 
    </fx:Script> 

    <mx:SWFLoader  id="myLoader"   width="100%" height="100%" loadForCompatibility="true"
                   preinitialize="myLoader.loaderContext = new LoaderContext(false, ApplicationDomain.currentDomain)"> 
    </mx:SWFLoader> 

</s:Application> 

Original issue reported on code.google.com by siddh...@gmail.com on 25 Apr 2011 at 5:31

GoogleCodeExporter commented 9 years ago
I had this problem and i solved it defining and setting the style "windowsShade"

Original comment by lgiu...@gmail.com on 27 Jun 2011 at 3:59

GoogleCodeExporter commented 9 years ago
I had to add a style like this in order to get WindowShades working:

flexlib|WindowShade {
    headerClass:ClassReference("mx.controls.Button");
}

Original comment by amigaaba...@gmail.com on 11 Aug 2011 at 3:25

GoogleCodeExporter commented 9 years ago
Just setting the style won't fix the real issue. The problem is that the code 
(see snippet below) that initialize the default styles in 
WindowShade::constructClass isn't being executed correctly. Adobe changed the 
getStyleDeclarations and setStyleDeclarations in 4 so the full package name is 
now required. So all the calls to these 2 methods in FLexLib need to be updated 
to include the full package.

You must specify package names when using the StyleManager APIs 
getStyleDeclarations or setStyleDeclarations    This was allowed: 
StyleManager.getStyleDeclarations
("TextInput")   This is the new syntax: 
StyleManager.getStyleDeclarations
("mx.controls.TextInput")   Anyone using these StyleManager APIs    

        private static function constructClass():Boolean {

            var css:CSSStyleDeclaration = StyleManager.getStyleDeclaration("WindowShade")
            var changed:Boolean = false;
            if(!css) {
                // If there is no CSS definition for WindowShade,
                // then create one and set the default value.
                css = new CSSStyleDeclaration();
                changed = true;
            }

            // make sure we have a valid values for each style. If not, set the defaults.
            for(var styleProp:String in styleDefaults) {
                if(!StyleManager.isValidStyleValue(css.getStyle(styleProp))) {
                    css.setStyle(styleProp, styleDefaults[styleProp]);
                    changed = true;
                }
            }

            if(changed) {
                StyleManager.setStyleDeclaration("WindowShade", css, true);
            }

            return true;
        }

Original comment by am...@comcast.net on 15 Sep 2011 at 10:10