EasyCFM.COM ColdFusion Forums / Flash Development / Flash file IO

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Flash file IO

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

Epidemik
04-23-2008 @ 1:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 42
Joined: Nov 2007

import flash.net.FileReference;

stop();

var fr:FileReference;

function addListener(listener:Object) {
     getReference().addListener(listener);
}

function browse(typelist:Array) : Boolean {
     if (typelist instanceof Array) {
          return getReference().browse(typelist);
     } else {
          return getReference().browse();
     }
}

function cancel():Void {
     getReference().cancel();
     fr == undefined;
}

function download(url:String, defaultFileName:String):Boolean {
     if (typeof(defaultFileName) == "string") {
          return getReference().download(url, defaultFileName);
     } else {
          return getReference().download(url);
     }
}

function removeListener(listener:Object):Boolean {
     return getReference().removeListener(listener);
}

function upload(url:String):Boolean {
     return getReference().upload(url);
}

function getReference():FileReference {
     if (fr == undefined) fr = new FileReference();
     return fr;
}


What I am trying to do is understand what I have to make the buttons and text area in flash do, or label them as.  Can anyone help me out?

kicker
04-23-2008 @ 4:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 717
Joined: Oct 2004

Looking over the code and your question about it makes me believe you copy and pasted and removed the markers that would make sense only in a class. (ie private/public)

That said put it back into a class, the functions that are there will not accept a button event as written. For example:

function buttonClick(evt:MouseEvent):void
{
       //some action
}
would accept mouse clicks on a button where as

function browse(typelist:Array) : Boolean

Will never accept a mouse event/ button press

The way you would call these if they were back in a class file with a button press would be:

var file:myFileClass = new myFileClass();

function buttonPress(evt:MouseEvent):void
{
    switch (evt.target.name)
    {
       case "my_btn1":
          var myArray:Array = [new FileFilter('FileType','*.jpg')];
          file.browse(myArray);
        break;
     }
}


hope that helps.

Craig


Website Designed and Developed by Pablo Varando.