Open a file in Flex?

By googling, I can find lots of examples of opening a local
file in Flash, but none of them work with Flex (for instance,
import flash.filesystem.*; )
I can get the target object by using the FileReference, but
OnSelect, how can I open that file for reading?
Please note: I do not need to upload it to the server, I only
need that data on the client side, and it would be a real pain to
have to send it to the server just so that the server could echo it
back.
Any help would be appreciated.

As I understand it, for security reasons, local files cannot
be accessed with Flash. You need to use AIR to access the local
file system. Assuming you are creating an AIR app, importing the
flash.filesystem.* and mx.events.FileEvent; you would do the
following...
[Bindable]
private var myFile:File = new File;
myFile.browseForOpen();

Similar Messages

  • Open pdf file in flex

    Hi Guys,
    I want to open pdf file in Flex (Web Application). I am unable to open it, Please guide and help me.
    Thanks in advance..
    Rangrajan.

    Rangrajan,
    If you have the complete URL to the file; for example http://forums.adobe.com/filename.pdf
    or C:\users\yourname\filename.pdf
    Although I have not used it, you can pass the URL to Drumbeat Insight iFrame
    You can try their product, get prices for source code or library here: http://drumbeatinsight.com/products
    They offer email support for their products.
    You can make your own iFrame, with several sources.  Here is some background.
    http://www.ozzu.com/flash-forum/targeting-iframe-from-flash-t30013.html
    Let me know if this solves your file issue.
    I need to write a server-side app to listen to my web service, upload the PDF, then write a temporary file.pdf to the server,
    before my web app can load the PDF into a web hosted iFrame.
    Adobe needs to make this easy (and I even know some developers in the San Jose Adobe headquarters).
    Bruce

  • How to open user file in Flex Application

    Hi forum,
    I develop flex2 application where user can browse and open
    XML file: the file should be loaded to text area.
    Could you, please, advice me how to browse and open user
    file?
    I found FileReference class but it looks that it can only
    upload file to a server. I need to open the file in flex
    application.
    Thanks for your help.
    Smoke007

    The issue isn't Flex, but the Flash Player. It is too much of
    a security risk to allow SWFs running in the Flash Player to open
    local files. Imagine going to a web site that has a SWF banner ad -
    but that banner ad opens local files and sends them to a remote
    system - all of your personal and financial information transfered
    without your consent.
    Flex apps running in the AIR player are different - the end
    user must launch them explicitly, just like any other local
    program.

  • Open PDF file into flex mobile app

    Hy,
    I use this method to open a web page into my flex mobile application and I want to now if is possible to make the same for an PDF file.
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Test">   <fx:Script> <![CDATA[ import flash.net.URLRequest; import flash.net.navigateToURL; import flash.display.MovieClip; import flash.media.StageWebView; import flash.geom.Rectangle; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.desktop.NativeApplication; import mx.events.FlexEvent; private var browser:StageWebView;
    protected function onButtonClicked(event:MouseEvent):void { browser = new StageWebView(); browser.viewPort = new Rectangle(0, 0, 100, 200); browser.stage = this.stage; browser.loadURL("http://adobe.com"); }  ]]> </fx:Script> <s:Button x="209" y="67" label="test" click="onButtonClicked(event)" /></s:View>

    Rangrajan,
    If you have the complete URL to the file; for example http://forums.adobe.com/filename.pdf
    or C:\users\yourname\filename.pdf
    Although I have not used it, you can pass the URL to Drumbeat Insight iFrame
    You can try their product, get prices for source code or library here: http://drumbeatinsight.com/products
    They offer email support for their products.
    You can make your own iFrame, with several sources.  Here is some background.
    http://www.ozzu.com/flash-forum/targeting-iframe-from-flash-t30013.html
    Let me know if this solves your file issue.
    I need to write a server-side app to listen to my web service, upload the PDF, then write a temporary file.pdf to the server,
    before my web app can load the PDF into a web hosted iFrame.
    Adobe needs to make this easy (and I even know some developers in the San Jose Adobe headquarters).
    Bruce

  • Error Opening File in Flex Builder 3

    I'm getting the attached error when I try to open a file in
    Flex Builder.
    The base error states "Error opening the editor". I can open
    other files without a problem. It is just this one file I am having
    a problem with.
    I can open the file with no problem in Notepad. I renamed the
    file and tried to create a new MXML file with its original name and
    copy the code from Notepad, but when I try that I get this error:
    "Paste" did not complete normally. Please see the log for
    more information.
    String index out of range: -1
    Please help me.
    Thank you.

    The only thing I can think of that could have caused this was
    this line of code:
    <mx:Button label=">" />
    Would that do it? If so, shouldn't Flex Builder simply show
    me a warning instead making the file completely
    inaccessible?

  • Loading pdf file in flex application (not in AIR)

    Hi,
    Could any one suggest opening pdf file within flex application with blazeds.
    we have used the following code to open pdf file in the same window
    navigateToURL( new URLRequest( "http://localhost:8080/PdfSample/jsp/PdfContent.jsp" ),"_self");
    But we want to load the pdf file in a vbox.Similary to the below image
    Is it is possible to load pdf file in flex application,if so how can we achieve it

    Hello Mariush,
    I have to display the content of the PDF in the flex application. If not PDF directly, is there other workaround for this. Or can I display the content of the MS word file, if not PDF.
    Thanks and Regards
       Khalid Chaudhary

  • Adobe reader issue there was an error opening this file. the file cannot be found. How to fix this?

    We are opening pdf file in flex air application. but for some user we are facing this issue.

    Problem is not being able to open pdf attachments.  Get this error message:  "There was an error opening this document. The file is damaged and could not be repaired."
    I searched on the web and in the context of a discussion I located, an Adobe professional posted this solution: HKCU\Software\Adobe\(product name)\(version)\AVGeneral\bValidateBytesBeforeHeader=dword:00000000.
    I am accustomed to attempting to fix things myself, but I am not a computer science person so it's always a stretch for me. If I get a little guidance I can usually make necessary corrections.  I hope that I can with this issue..
    Still hoping that someone will know how to fix the error problem which according to what I read is a software issue having to do with the program not understanding something in the pdf header...

  • How to open pdf files in browser using flex

    hi,
    my project is having a Document explorer wchich contains pdf
    files,iwant to open it in the browser.can any one tell me how to
    open pdf documents using flex programming(i tried with different
    thing like swf's but my client wants only pdf formatt).

    Another option is by calling a JSP page. This example will
    open a pdf file into a new browser without displaying the download
    "save" prompt.
    Function to call the JSP:
    private function downloadFlyer(event:Event):void {
    var jspLink:URLRequest = new
    URLRequest("jsp/downloadpdf.jsp?fileName=Fundraiser_flyer_2008.pdf");
    navigateToURL( jspLink, "_blank" );
    JSP code:
    <%@ page errorPage="error.jsp" %>
    <%@ page import="java.io.*" %>
    <%
    //Get the parameters
    String downloadFileName=request.getParameter("fileName");
    String fileName = application.getRealPath("/downloads/" +
    downloadFileName);
    File file = new File(fileName);
    if (!file.exists()) {
    throw new IOException("File does not exist.");
    // Get the size of the file
    long length = file.length();
    // You cannot create an array using a long type.
    // It needs to be an int type.
    // Before converting to an int type, check
    // to ensure that file is not larger than Integer.MAX_VALUE.
    if (length > Integer.MAX_VALUE) {
    throw new IOException("File too big.");
    response.reset();
    response.resetBuffer();
    response.setContentType( "application/pdf" );
    response.setHeader ("Content-Disposition", "filename=" +
    downloadFileName);
    //Prevent the Java error: "getOutputStream() has already
    been called for this response"
    out.clear();
    out = pageContext.pushBody();
    InputStream in = new FileInputStream(file);
    OutputStream output = response.getOutputStream();
    try {
    int curByte=-1;
    while( (curByte=in.read()) !=-1){
    output.write(curByte);
    } catch (IOException ioe) {
    ioe.printStackTrace(System.out);
    } finally{
    output.flush();
    in.close();
    response.flushBuffer();
    %>

  • How to open pdf or word doc or notpad file in flex

    hai friends,
           how to open pdf or word doc or notpad file in flex. i am doing flexcoldfusion project. now i reterive data(notpad or worddoc or pdf file path) from database using coldfusion.now i want to open that file content .if i reterive notpad file .that will show in notpad. if it is possible. give example.
    regards,
    welcomecanv

    Hi WelcomeCan,
    Try this...
    var urlRequest:URLRequest = new URLRequest();
        urlRequest.url = "http://www.yourdomain.com/notepad.txt";
        //urlRequest.url = "http://www.yourdomain.com/FlexComp.pdf";
        navigateToURL(urlRequest,_blank);
    Thanks,
    Bhasker Chari

  • Opening a file in its native application from Flex.

    Is it possible to open a file on whatever native application the user runs it as?  Or even, at that, to simply open the directory it's in, in an explorer window?
    We have a search application and the frontend is in Flex, and I'm trying to find a way to do this, such that when a use double clicks on a result (in a datagrid - but that's trivial), it opens the file or at least the location of the file on the OS.
    Any system call where I can say system("explorer.exe " + filepath); or something?
    Any help would be appreciated.

    Dear BillBlalock ,
    thank you for answer!! You are very kind and helpful!! I would like to inform everybody that I have finally find another way of soilving my problem and I announce it to the forum in case somebody else encounters the same problem. Well, I soved the nproblem by using the following code:
        excelButton.addActionListener(new ActionListener()
           public void actionPerformed(ActionEvent e)
             String filePath = "\""+saveFileName.toString()+"\"";
             System.out.println(""+filePath);
             try
               String cmd="explorer "+filePath;
               Process p = Runtime.getRuntime().exec(cmd);
             }catch(IOException ec){}
         });I hope it can be useful to somebody!! By this code, I can make a button (in my case the excelButton) to open any file in its default application. Keep up the great work you are doing guys!!

  • How to open InstallAnywhere Self Extractor file of Flex Builder

    Hi,
    I have downloaded the InstallAnywhere Self Extractor file of flex builder as a trial version ...but am not able to install it on my system ..as am using windows xp operating system...could anyone please guide me about how to install this file...
    it is the file that i downloaded from adobe trials product for flex 3 ....at my system its fully and completely downloaded ...but file type is showing as just file...dont know how to open it ..?
    Sanjay.

    installAnywhere is asking to choose another path to decompress, in spite of specifyng different path, the installation is stuck there !! How do i proceed?

  • False File.exists; flex cannot open SQLite.db file

    I have a program that uses an SQLite database. Instead of creating and importing the database, the sqlite databse already exists, with the data.
    I am trying to open it and read the information (select* from table - for example); But nothing i do seems to work.
    The error I am getting is: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'. I have checked the path repeatedly, The file exists. I run flash builder as administrator (win7).
    code:
    I have moved the database file all around. In the final version of the program, the database will be stored in a seperate drive on a network (Z:/database.db, for example) So i need to use the absolute path; although i have tried others (application storage directory, etc)
    var dbFile:File = new File("C:\Users\Public\Documents\graduates.db");
    trace('exists:' + dbFile.exists);
    //above being the important bit.
    dbStatement = new SQLStatement();
    dbStatement.itemClass = Grad;
    aluDB = new SQLConnection();
    dbStatement.sqlConnection = aluDB;
    aluDB.addEventListener(SQLEvent.OPEN, onDatabaseOpen);
    aluDB.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    aluDB.open(dbFile);//error occurs here, of course.
    can anybody help me figure out why this error is occuring? Or even just a different method of opening the file?

    Hello,
    I have an Oracle Express Edition 10g running on
    Redhat Enterprise Linux 4 server.
    I have an Oracle database file which is 2.1 GB in
    size. I am not able to open this file using the
    application or the Oracle sql developer. The error
    message that I get is:
    ORA-01110: data file 5:
    '/usr/lib/oracle/xe/oradata/XE/service_3_0.dbf'
    ORA-27041: unable to open file
    Linux Error: 13: Permission denied
    I think this has to do with the fact that since it is
    not a 64-bit Linux but a 32-bit Linux, it does not
    support files larger than 2GB. What do you think I
    should do to tackle this problem?
    Best Regard
    ThayalanThat's interesting! I had no problems with opening files 32767MB in size on the very same 32 bit RH EL 4.0. How did you conclude that your file is too large, based on the error message which reads "Linux Error: 13: Permission denied"? Have you tried reading the manual page for the "open" system call and see when does it return EACCESS (error 13), found in /usr/include/asm-i386/errno.h. My man page for open says the following:
    ERRORS
    EACCES The requested access to the file is not allowed, or search per-
    mission is denied for one of the directories in the path prefix
    of pathname, or the file did not exist yet and write access to
    the parent directory is not allowed. (See also path_resolution(7).)
    What lead you to the conclusion that your file is too big? Do you have an access to a system administrator who knows how to use "strace"? If your system admin doesn't know how to use "strace", he too deserves waterboarding.

  • Opening file in flex

    Is it possible to open a file using relative/absolute path..I do see ways to browse/load the files but not to open a file with the given path..
    Thanks in advance

    The Adobe Flash player operates in a sandbox. This means it can't access files on the users's machine without explicit permission. You can do this by, as you said, browsing for a file using a FileRef (file reference).
    You can, however, access data placed on a server machine (relative to where your swf is stored), or across domains (swf on one server, data on the other). To access data across domains, you need a crossdomain.xml file placed on the server containing data that tells Flash what it can and cannot access.

  • How to display pdf file in flex application

    hi,
    I am Ibran, I am using Flex4.5, in that i want to display a pdf file like images.
    How can i do it please anyone tell me.
    I have used navigateToURL(url),but this was going into navigation and i can't see my textfield and buttons.
    So without this  navigateToURL(url) how can i display a pdf file in flex without navigation so that i can see my textInputs and buttons.

    Flash does not have the ability to load/display/manipulate PDF files, so you can't open it directly in the flex application.  With clever HTML and javascript, you can make it appear that it is in the same window, but it will actually be in a separate window/div in the browser.  And yes, this has always seemed absurd to me that Adobe doesn't support PDF's......
    Mark

  • Creating an xdp file from flex/java application

    Hi,
    I have an application in Flex 4  and As 3.When I click a button in flex application I have to generate a file in java with
    extension xdp.When I try this locally(Run as java application) the file is generating  correctly.When i compile the applic
    ation and try it, the file is not writing correctly.Do someone have any idea about creating an xdp file from flex application?
    i am using blazeds to connect java and flex4.When i opens the file in notepad the file is writing correctly.There is only problem in openig an xdp file...
    please help me.

    specifically:
    Runtime.getRuntime().exec("filename.exe")

Maybe you are looking for

  • Problem updating HP Laserjet P1102w Firmware

    In order to make airprint work with my macbook running OS 10.10, and with my iphone running iOS 8, I tried to update firmware from 20130703 to 20150114 released a few days ago.  First of all I have had a lot of troubles opening the app HP_Firmware_Up

  • Error reporting in BAPI_BILLINGDOC_CREATEMULTIPLE

    Hi there, I've adapted parameters via customizing to take an orders as reference documents when creating invoices.  The thing is that when I create invoices using deliveries with VF01 I can figure out that I did it wrong cause I get an error message

  • Calling a business service based on operation-soap action in Proxy service

    Hi, I have a requirement in which I have to call a business service based on operation-soap action defined in Proxy service wsdl. Like in below mentioned wsdl GetPartCostDelta and GetCurrencyList operations are there.But which ever operation I select

  • Write text out of bean into textfield/combobox

    hy @ all! i hope somebody can help me! for better understanding i try to explain the logic behind my question: on my login-page the user has to fill out the form with his/her username and password! after clicking on the "login" button i want to show

  • What is the proper role of OLAP meta-data?

    One basic feature continues to confuse me with regards to the Oracle OLAP option. What is the proper role and/or purpose of creating OLAP meta-data? Since you can now use the Analytic Workspace Manager to create multi-dimensional OLAP objects, doesn'