4 Replies Latest reply on Nov 8, 2010 4:55 PM by amandamariavoss

    Runtime Error 1007 on a simple ProgressBar in Flex 4

    Picsnapr

      This is such a simple code that compiles correctly, but I'm getting the error below when running it

       

       

      TypeError: Error #1007: Instantiation attempted on a non-constructor.

                      at mx.controls::ProgressBar/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\controls\ProgressBar.as:1110]

                      at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]

      ......

       

      Here's the code that gives this error:

       

      <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx"

         xmlns:com="com.*" xmlns:folders="services.folders.*"

         height.mini="80" height.full="400"

         minHeight.full="200" minHeight.mini="70"

         title="Upload Photos" creationComplete="initCom()"

         currentState="full" controlBarVisible="true"

         width="418" minWidth="400">

      .....
      .....

       

       

      <s:controlBarContent>

      <com:IconButton id="btnAdd" toolTip="Add file(s)" click="addFiles()" icon="{addIcon}"

                                skinClass="com.skins.IconButtonSkin" width="20"/>

      <com:IconButton id="btnRemove" toolTip="Remove file(s)" click="removeFiles()" icon="{removeIcon}"

                                skinClass="com.skins.IconButtonSkin" width="20"/>

      <mx:ProgressBar id="uploadProg" labelPlacement="center" width="100%"/>

      <com:IconButton id="btnCancel" toolTip="Cancel upload" icon="{cancelIcon}" click="onUploadCanceled()"

                                skinClass="com.skins.IconButtonSkin" width="20"/>

      <com:IconButton label="Upload" toolTip="Upload file(s)" id="btnUpload" icon="{uploadIcon}" click="uploadFiles()"

                                skinClass="com.skins.IconButtonSkin" width="20"/>

      <com:IconButton id="btnView" toolTip="Show/Hide file(s)" click="changeView()"

                                icon.full="{viewIconFull}" icon.mini="{viewIconMini}"

                                skinClass="com.skins.IconButtonSkin" width="20"/>

      </s:controlBarContent>

      </s:TitleWindow>

       

      If I remove the progressbar code from here, it runs fine. But with that one line, I get above error during runtime. With this line in, even the Design mode doesn't show-up in Flash Builder 4
      Any idea what could be the issue here?
      PS: I've tried with the normal s:Button as well, before the skinned button component. So obviously those can't be the problem.
        • 1. Re: Runtime Error 1007 on a simple ProgressBar in Flex 4
          Shongrunden Adobe Employee

          I'm not able to reproduce this error with the following sample:

          <?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">
             
              <s:TitleWindow title="Upload Photos" width="418" minWidth="400">
                  <s:controlBarContent>
                      <s:Button id="btnAdd" toolTip="Add file(s)" width="20"/>
                      <s:Button id="btnRemove" toolTip="Remove file(s)" width="20"/>
                      <mx:ProgressBar id="uploadProg" labelPlacement="center" width="100%"/>
                      <s:Button id="btnCancel" toolTip="Cancel upload"  width="20"/>
                      <s:Button label="Upload" toolTip="Upload file(s)" id="btnUpload" width="20"/>
                      <s:Button id="btnView" toolTip="Show/Hide file(s)"  width="20"/>
                  </s:controlBarContent>
              </s:TitleWindow>
             
          </s:Application>

          Can you try to simplify your application to reproduce the issue in a small amount of code like this sample so we can investigate further?

          • 2. Re: Runtime Error 1007 on a simple ProgressBar in Flex 4
            Picsnapr Level 1

            Thanks for trying Shongruden,

            But I'm sure you couldn't reproduce, 'cause it seems like a bug with Flex 4 Spark components working alongside the old mx halo components.

            It seems the issues was because of the fact that I had multiple SWF's in my project.

             

            All I did to fix the issues is to add  maskSkin="mx.skins.halo.ProgressMaskSkin" to my ProgressBar tag!

             

            It seems the absense of a skin specification on the progressbar failed to initialize it. So just giving it the default skin made it work...

             

            Anyone knows of a bug like this, with the spark components?

            • 3. Re: Runtime Error 1007 on a simple ProgressBar in Flex 4
              amandamariavoss

              I had exactly the same problem and adding the maskSkin property did the trick. Thanks so much for sharing!

              • 4. Re: Runtime Error 1007 on a simple ProgressBar in Flex 4
                amandamariavoss Level 1

                Interestingly enough, this was only an issue when I changed themes. Reverting to my original theme also made the problem go away. The two I played with

                today are the two built in Adobe Halo Themes. AeonGraphical showed the #1007 error and reverting back to Halo made the problem go away.