1 Reply Latest reply on Aug 30, 2007 4:14 PM by pzh19z

    Strange Runtime Error

    pzh19z
      I've begun creating a Class that extends panel and will create a form for uploading files. I however receive a strange error. I've done essentially this exact code in another Class file without issues.

      Here is the error;
      TypeError: Error #1007: Instantiation attempted on a non-constructor.
      at mx.core::ScrollControlBase/mx.core:ScrollControlBase::createBorder()
      at mx.core::ScrollControlBase/mx.core:ScrollControlBase::createChildren()
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::createChildren()
      at mx.core::UIComponent/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()
      at com.CanWest.File::FileUploaderForm/::createPanel()
      at com.CanWest.File::FileUploaderForm$iinit()
      at FileUpload$iinit()
      at _FileUpload_mx_managers_SystemManager/create()
      at mx.managers::SystemManager/::initializeTopLevelWindow()
      at mx.managers::SystemManager/::docFrameHandler()

      Here is the code;
      /**************************************************************
      * FileUploaderForm - created by Jeremy Foster
      *
      * This class creates a GUI for the FileUploader class.
      **************************************************************/
      package com.CanWest.File
      {
      /******************************************************
      * Imports
      ******************************************************/
      import mx.containers.Panel;
      import mx.containers.Canvas;
      import mx.containers.ControlBar;
      import mx.controls.Button;
      import mx.controls.ProgressBar;
      import mx.controls.DataGrid;
      import flash.events.Event;

      public final class FileUploaderForm extends Panel
      {
      /******************************************************
      * Constants
      ******************************************************/
      private const DEFAULT_TITLE:String = "File Uploader";
      private const DEFAULT_WIDTH:Number = 400;
      private const DEFAULT_HEIGHT:Number = 300;
      private const DEFAULT_LAYOUT:String = "vertical";
      private const DEFAULT_AUTOLAYOUT:Boolean = false;

      /******************************************************
      * Variables
      ******************************************************/
      private var _cCanvas:Canvas;
      private var _dgFiles:DataGrid;
      private var _cbMenu:ControlBar;
      private var _bAdd:Button;
      private var _bRemove:Button;
      private var _bUpload:Button;
      private var _pbUploadProgress:ProgressBar;
      private var _bCancel:Button;
      private var _bClose:Button;

      [Bindable]
      [Embed("/images/add.png")] private var _cAddIcon:Class;
      [Bindable]
      [Embed("/images/delete.png")] private var _cRemoveIcon:Class;

      /******************************************************
      * Constructor
      ******************************************************/
      public function FileUploaderForm():void
      {
      createPanel();
      }

      /******************************************************
      * Properties
      ******************************************************/

      /******************************************************
      * Functions
      ******************************************************/
      // Places controls onto Panel
      private function createPanel():void
      {
      this.title = DEFAULT_TITLE;
      this.width = DEFAULT_WIDTH;
      this.height = DEFAULT_HEIGHT;
      this.layout = DEFAULT_LAYOUT;
      this.autoLayout = DEFAULT_AUTOLAYOUT;

      _cCanvas = new Canvas();
      _cCanvas.percentWidth = 100;
      _cCanvas.percentHeight = 100;

      _dgFiles = new DataGrid();
      _dgFiles.percentWidth = 100;
      _dgFiles.percentHeight = 100;

      _cbMenu = new ControlBar();
      _cbMenu.percentWidth = 100;
      _cbMenu.autoLayout = true;
      _cbMenu.setStyle("horizontalAlign","center");
      _cbMenu.setStyle("verticalAlign","middle");

      _bAdd = new Button();
      _bAdd.toolTip = "Add File(s)";
      _bAdd.width = 26;
      _bAdd.setStyle("icon",_cAddIcon);

      _bRemove = new Button();
      _bRemove.toolTip = "Remove File(s)";
      _bRemove.width = 26;
      _bRemove.setStyle("icon",_cRemoveIcon);

      _cCanvas.addChild(_dgFiles);
      _cbMenu.addChild(_bAdd);
      _cbMenu.addChild(_bRemove);
      this.addChild(_cCanvas);
      this.addChild(_cbMenu);
      }

      /******************************************************
      * Events
      ******************************************************/

      }
      }