Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:07:44+00:00 2026-05-23T11:07:44+00:00

I have made an image upload manager. I made it initially in Flash Develop

  • 0

I have made an image upload manager. I made it initially in Flash Develop as an AS class. I need to convert it to a component in Flash Builder 4.5 It works absolutely fine as a .swf, but I can’t figure out how to make the URL request work in Flash Builder. This is what I have between the tags:

<?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="init()">
<fx:Script>
    <![CDATA[
        import flash.display.MovieClip;
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;

        import flash.net.FileReference;
        import flash.net.FileReferenceList;
        import flash.net.FileFilter;
        import flash.net.URLRequest;
        import flash.utils.Timer;
        import flash.events.TimerEvent;

        public var file:FileReference;
        public var filefilters:Array;
        public var req:URLRequest;
        public var tm:Timer;
        public var speed:Number = 0;
        public var currbytes:Number = 0;
        public var lastbytes:Number = 0;


        public function init():void{
            req = new URLRequest();
            req.url = ( stage.loaderInfo.parameters.f )? stage.loaderInfo.parameters.f : 'http://www.listgiant.com/LG/upload.php';
            file = new FileReference();
            setup( file );
            select_btn.addEventListener( MouseEvent.CLICK, browse );
            tm = new Timer( 1000 );
            tm.addEventListener( TimerEvent.TIMER, updateSpeed );
        }


        public function browse( e:MouseEvent ):void{
            filefilters = [ new FileFilter('Images', '*.jpg') ]; // add other file filters
            file.browse( filefilters );
        }

        private function setup( file:FileReference ):void{
            file.addEventListener( IOErrorEvent.IO_ERROR, io_error );
            file.addEventListener( Event.OPEN, open_func );
            file.addEventListener( Event.SELECT, selectHandler );
            file.addEventListener( DataEvent.UPLOAD_COMPLETE_DATA, show_message );      
        }
        private function io_error( e:IOErrorEvent ):void{
            label_txt.text = 'The file could not be uploaded.';
            tm.stop();
        }

        private function open_func( e:Event ):void{
            tm.start();
        }

        private function selectHandler( e:Event ):void{
            file.upload( req );

        }

        private function show_message( e:DataEvent ):void{
            tm.stop();
            if( e.data == 'ok' ){
                label_txt.text = 'The file has been uploaded.';
            } else if( e.data == 'error'){
                label_txt.text = 'The file could not be uploaded.';
            }
        }

        private function updateSpeed( e:TimerEvent ):void{
            speed = Math.round( (currbytes - lastbytes)/1024 );
            lastbytes = currbytes;
        }

        private function cancelUpload( e:MouseEvent ):void{
            file.cancel();
            reset();
        }

        private function reset():void{
            select_btn.visible = true;
            label_txt.text = '';
        }
]]>
</fx:Script>



<s:Button id="select_btn" label="Upload" click="browse(event)"/>
<s:Label id="label_txt" text=""/>

I didn’t put the mxml controls but there is a browse button (id=”selects_btn”) and a label (id=”label_txt”) under the button that displays various status messages.

I tried adding the init function to the component’s creationComplete event. I receive and error saying access of a null object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:07:44+00:00Added an answer on May 23, 2026 at 11:07 am

    Maybe the stage object is null. In the <s:Application> declaration add the applicationComplete attribute and set the value to the init() method so it looks like the following:

    <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"
                   applicationComplete="init()">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a image gallery with jQuery found here: http://sarfraznawaz2005.kodingen.com/demos/jquery/image_gallery/ I just wanted
I have made a SVG image, or more like mini application, for viewing graphs
I have made a new windows service which works fine using barebone code (just
I have made a class which a form can inherit from and it handles
I have created a wordpress theme and I made it so the background image
I have a file upload script that works [finally] but want to have users
I have a PHP image upload system which allows a user to upload various
I'm designing a website and I need to: Upload the image Validate that it's
This is my first question. I have a page for image upload on my
I have made a php image gallery, which should list all the subdirectories of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.