Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2009
    Location
    Worcester
    Posts
    172
    Thanks
    13
    Thanked 6 Times in 6 Posts

    Passing a var from as3 class to main app???

    Hi all,

    I have a multi file upload that i have found on a tutorial website. I'm having a play and was trying to get the filename to MySQL so i can use it. So far i can reference the files name in a csv string built within the class, but my problem is getting that back to the main app so i can call a RemoteObject to send it to ColdFusion and on to the database so i can reference these uploaded files later on.

    Here's what i've got inside the class:
    Code:
     private function uploadFiles(event:Event):void{
               
                if (_files.length > 0){
                    _file = FileReference(_files.getItemAt(0));    
                    _file.addEventListener(Event.OPEN, openHandler);
                    _file.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                    _file.addEventListener(Event.COMPLETE, completeHandler);
                    _file.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorHandler);
                    _file.addEventListener(HTTPStatusEvent.HTTP_STATUS,httpStatusHandler);
                    _file.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
                    _file.upload(_uploadURL);
                     setupCancelButton(true);
    
                     var FileNames:String = '';
    				for(var i:String in _files)
    					FileNames += _files[i].name + ',';
                     Alert.show(FileNames);// This will show my csv sting fine :)
    }
    So that's all well and good, but if i try to bind FileNames to my main app it tells me it can't find it.

    I've tried
    Code:
    [Bindable]
    public var FileNames:String;
    at the top of the class and included it in my functions .as in the main app but it returns null.

    Is there any other way of passing this csv string back to the main app?

    Any pointers would be gratefully recived

    Thanks in advance all!!

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    just return the value of the string, and you can capture it when you call the function.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Regular Coder
    Join Date
    Feb 2009
    Location
    Worcester
    Posts
    172
    Thanks
    13
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by gnomeontherun View Post
    just return the value of the string, and you can capture it when you call the function.
    Yeah i figured it out now, i just called the RemoteObject from the class and passed the var from there instead.

    I used
    Code:
    Application.application.ro.UploadFiles(FileNames);
    That worked just dandy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •