What to do to integrate FLASH UPLOAD WIDGET in Your Flash Project

There are two ways to use the UploadWidget in flash projects.

Using as DialogWindow:

  1. Copy the file uploadDialog.swf to the directory of your flash project
  2. Copy all the com.skurrile classes in their original folder structure to your project folder or any other place but adjust the class path in your project and! the uploadDialog.fla (if you want to recompile it) to this folder
  3. Copy the SimpleScrollPane symbol from the library in uploadWidget.fla or upload_preview.fla to your flash documents library.
  4. Create the directories 'php' and one directory as target for uploading files
  5. Copy the upload.php to -> php. Set your upload targets directory to writeable (chmod0777)
  6. Add ActionScript 3.0 code to your document:
    // this will import the necessary window class
    import com.skurrile.Dialog.InnerWindow;
    
    /* this opens up a new uploader instance as a non modal window
       with only one 'Browse' button and a width of 590px
    
       The constructor parameters
       content:MovieClip
       modal:Boolean
       initObject:Object( message:String  the initial message
                          buttons:String  okcancel or ok, will effect an Browse and Close Button, or just Browse
                          width:Number    the width of the dialog window )
    */
    var k = new InnerWindow("uploadDialog.swf", false,
                            { message:"Click Browse to select files for uploading",
                              buttons:"okstartcancel",
                              width:590 } );
    
    this.addChild(k)
    
    
  7. Edit the dialogSettings.xml file to point to your php file and the upload directory:
    <uploadDialogSettings
    imageFileDescription         = "Images (*.jpg, *.jpeg, *.gif, *.png)"
    imageFileExtensions          = "*.jpg;*.jpeg;*.gif;*.png"
    textFileDescription          = "Text Files (*.txt, *.rtf, *.doc)"
    textFileExtensions           = "*.txt;*.rtf;*.doc"
    uploadUrl                    = "./php/upload.php?uploadpath=../assets/"
    />
    
    Edit the dialog settings to adjust appearance of the widget.
    The font MUST be the linkage ID of an embed font in your library of the uploadDialog.as. backgroundGradientColors and backgroundGradientRatios are arrays to set the background color and gradient. Set to equal values if you don't want to use a gradient background.
    <dialog
    glowColor                    = "0x5CE0F8"
    textColor                    = "0xFFFFFF"
    font                         = "Aurora"
    fontSize                     = "8"
    backgroundGradientColors     = "0x333333,0x333335,0x333333"
    backgroundGradientRatios     = "0,90,255"
    windowBorderColor            = "0x000000"
    buttonBackgroundColor        = "0x222222"
    buttonBorderColor            = "0x000000"
    />
    
  8. Ready to use ;)

Drag and drop

  1. Create a new project or open your existing Flash9 AS3 project. Copy all files shown in the screenshot to your library:

  2. Copy all the com.skurrile classes in their original folder structure to your project folder or any other place but adjust the class path in your project and! the uploadDialog.fla (if you want to recompile it) to this folder
  3. Edit the dialogSettings.xml file to point to your php file and the upload directory:
    <uploadDialogSettings
    imageFileDescription         = "Images (*.jpg, *.jpeg, *.gif, *.png)"
    imageFileExtensions          = "*.jpg;*.jpeg;*.gif;*.png"
    textFileDescription          = "Text Files (*.txt, *.rtf, *.doc)"
    textFileExtensions           = "*.txt;*.rtf;*.doc"
    uploadUrl                    = "./php/upload.php?uploadpath=../assets/"
    />
    
    Edit the dialog settings to adjust appearance of the widget.
    The font MUST be the linkage ID of an embed font in your library of the uploadDialog.as. backgroundGradientColors and backgroundGradientRatios are arrays to set the background color and gradient. Set to equal values if you don't want to use a gradient background.
    <dialog
    glowColor                    = "0x5CE0F8"
    textColor                    = "0xFFFFFF"
    font                         = "Aurora"
    fontSize                     = "8"
    backgroundGradientColors     = "0x333333,0x333335,0x333333"
    backgroundGradientRatios     = "0,90,255"
    windowBorderColor            = "0x000000"
    buttonBackgroundColor        = "0x222222"
    buttonBorderColor            = "0x000000"
    message                      = "Click Browse to select files for uploading"
    buttons                      = "okstart"
    />
    
    The settings in detail:

    imageFileDescription,imageFileExtensions ,textFileDescription,textFileExtensions
    Set these variable to your needs, maybe change the filetypes to other values

    uploadUrl
    Point here to your upload php file relative to the uploadDialog. Change uploadPath in that way, that it is relative to the php file not to the uploadDialog!

    glowColor
    The color for the button glows, the upload progress bars and the scrollbar

    textColor,font,fontSize
    The color, font and fontSize for all text in the dialog, including buttons and uploadQueue.
    NOTE: The font must be embed in the uploadDialog with exact this linkage id (in this case "Aurora").
    Download Aurora for free here:http://pixelfonts.style-force.net/

    backgroundGradientColors,backgroundGradientRatios,windowBorderColor
    The colors for the dialog window

    buttonBackgroundColor,buttonBorderColor
    The colors for all the buttons.

    message
    The message displayed on start up

    buttons
    Options:
    ok: only the browse-button will appear (is not a useful option for this dialog window)
    okstart: browse and start button will appear, standard setting for standalone plugin in flash projects or html pages
    okstartcancel: a close button will appear additionally. Use it for dialogWindow applications in combination with the InnerWindow class.(See upload_preview.fla for more details)

  4. Ready to use ;)