load an external file with urlloader doesn't work in AIR

Had some problems with the loading of an external xml file with urloader. Read somewhere to use

file.applicationDirectory.resolvePath('examplefileURL.xml');

-What is the normal way to load external xml files or indeed all files as SWFs etc... and what about mobile is that the only way?

not exactly.

1 applicationDirectory is a static property of the File class.

2. you probably don't want to use applicationDirectory and

3. you must use the file system class to load files from local file system:

var file:File = File.applicationStorageDirectory.resolvePath ('examplefileURL.xml');

var fs:FileSystem = new FileSystem();

ISA Open (file, FileMode.READ);

var XML = XML (fs.readUTFBytes (fs.bytesAvailable));

ISA Close();

trace (XML. ToXmlString());

Tags: Adobe Animate

Similar Questions

  • In the html content of dps, it has a url link to a pdf file. When click on url to load the pdf file, the zoom does not work

    I load html content in an application of dps.

    In the html page, there is a url to a pdf file. When I click on the url, the page loads a pdf file.

    Here's the question: is able to zoom in pdf?

    It's difficult because I can zoom in the first html page, but when I load a pdf file, zoom effect does not work.

    Please let me know if this is a way to make the pdf was able to zoom in.

    Thank you

    Post edited by: monsteryu

    No, this is not possible.

    Neil

  • File.upload ActionScript does not work on Air SDK for iOS devices

    I try to use the ActionScript File.upload to transfer a file on Air SDK for iOS environment, but the File.upload does not work properly. No event on the file upload handler is executed after File.upload is called, and no exception is caught. When I check the side network traffic server, I found no application http even didn't hit the server after execution of File.upload. The code is below.

    ------------------------------------------------------------------------------------------ -----------------------------------------------------------------------

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "xmlns:s ="library://ns.adobe.com/flex/spark"title ="HomeView"> "

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < fx:Script >

    <! [CDATA]

    private var file:File;

    private var dir:File;

    This method is executed to create a file and download it when you press the download button.

    protected void OnUploadButtonPressed(event: MouseEvent): void {}

    trace ("upload button clicked");

    var urlReq:URLRequest = new URLRequest ("http://10.60.99.31/MyPath/fileUploadTest.do");

    urlReq.method = URLRequestMethod.POST;

    var str:String = "this is test";

    var imageBytes:ByteArray = new ByteArray();

    for (var i: int = 0; i < str.length; i ++) {}

    imageBytes.writeByte (str.charCodeAt (i));

    }

    trace ("size =" + imageBytes.length);

    try {}

    dir = File.applicationStorageDirectory

    I also tested in several different directories

    dir = File.createTempDirectory ();

    dir = File.documentsDirectory;

    var today: Date = new Date();

    var filename:String = 'IMG' + now.fullYear + now.month + now.day + now.hours + now.minutes + now.seconds + now.milliseconds + ".txt";

    file = dir.resolvePath (filename);

    var stream: FileStream = new FileStream();

    Stream.Open (file, FileMode.WRITE);

    stream.writeBytes (imageBytes);

    Stream.Close ();

    Review the content of the file to check if the file is written successfully.

    var readStream:FileStream = new FileStream();

    readStream.open (file, FileMode.READ);

    var: string result = readStream.readUTFBytes (readStream.bytesAvailable);

    trace ("rear read result =" + result); The result is shown here as planned.

    file.addEventListener (Event.COMPLETE, uploadComplete);

    file.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    file.addEventListener (SecurityErrorEvent.SECURITY_ERROR, securityError);

    file.addEventListener (ErrorEvent.ERROR, someError);

    file.addEventListener (ProgressEvent.PROGRESS, onProgress);

    file.upload (urlReq); This line does not work. No handler is executed. No http request struck the coast server.

    trace ("after file upload test");

    } catch (error) {}

    trace (e);

    }

    }

    Complete Manager

    private function uploadComplete (event: Event): void

    {

    trace ("Upload successful.");

    }

    IOError handler

    private void ioError (error: IOErrorEvent): void

    {

    trace ("Upload failed:"+ error.text ");

    }

    Manager SecurityError

    private void securityError(error:SecurityErrorEvent):void {}

    trace ("security error:" + error.text);

    }

    Another Manager

    private void someError(error:ErrorEvent):void {}

    trace ("an error" + error.text);

    }

    Progress Manager

    private void onProgress(event:ProgressEvent):void {}

    trace ("progressHandler");

    }

    This method is executed to call the URLLoader.load when the delicate touch.

    protected void OnTrickyButtonPressed(event: MouseEvent): void {}

    var urlReq:URLRequest = new URLRequest ("http://200.60.99.31/"); This points to a server not - exist

    urlReq.method = URLRequestMethod.POST;

    urlReq.data = new ByteArray();

    var loader: URLLoader = new URLLoader();

    try {}

    Loader.Load (urlReq); This line is very important in iOS7. He decides if the latter file.upload may work.

    But in iOS8, file.upload does not work even if that line is executed.

    trace ("after urlloader load");

    } catch (error) {}

    trace (e);

    }

    }

    []] >

    < / fx:Script >

    < s:Button = "200" x = "200" width = "400" height = "200" label = "Upload" click = "OnUploadButtonPressed (event)" / > "

    < s:Button = "200" x = "500" width = "400" height = "200" label = "Tricky" click = "OnTrickyButtonPressed (event)" / > "

    < / s:View >

    ------------------------------------------------------------------------------------------ -----------------------------------------------------------------------


    When it is run on the simulator of the Air, it works very well as expectedand the file is successfully downloaded to the server. But when run on iOS devices (in my case, iPad), as I explained at the beginning, no event on the file upload handler is executed and not the http request has even hit the server. So I think that the problem may come from the client side.

    During my attempt to solve the problem, I found something complicated about this problem on iOS7. In other words, if you call the URLLoader.load method (although the URLLoader.load points to an address non-existed) before calling the File.upload method, the File.upload will work as expected on iOS7. Specifically, when the above OnTrickyButtonPressed method is run before the OnUploadButtonPressedmethod, File.upload will succeed on iOS7. But this only happens on iOS7. On iOS8, File.upload still refuses to work, regardless of knowing if the URLLoader.load is executed before.

    I think in my case, the problem is not the problem of sandbox or a session of Firefox problem described in the two links below, because not even a http request hit the side server. It seems that the Air SDK for iOS comes to fail send the http reason request any.

    http://StackOverflow.com/questions/5967382/Flex-4-FileReference-issues-with-Firefox

    http://StackOverflow.com/questions/351258/how-do-i-make-Flex-file-upload-work-on-Firefox-a nd-safari

    To make my problem clear, I list my environment below:

    • Development environment: Windows7 (64-bit) / Mac os 10.9.4 (tested on both OS platforms.)
    • IDE: Flash Builder 4.7
    • Air SDK: 3.8 / 16.0.0 (after that I have updated to the latest Air SDK 16.0.0, problem persists.)
    • Application server: Tomcat7 + spring

    Finally, I want to mention that download the file using URLLoader.load isn't an option in my case because I want to download large files in the future, which cannot be addressed with the URLLoader.load.

    I struggled with this for days. If I really appreciate it if anyone has an idea about this.

    Thanks in advance.

    Hi KA RYU.

    We have reproduced the issue successfully, our team would work on it.

    -Tushar

  • External table - load a log file with more than 4000 bytes per column

    Hello
    I'm trying to import a log file into a database table that has a single column: txt_line
    In this column, I'm trying to fill out a log by record type entry. Each log entry is normally more than 4000 bytes in the outer table, it should be a clob.
    Below is a table of external work that works, but cut all entries after 4000 bytes. How is it is possible to directly load the data into a clob column? All I've found are descriptions where I have a clob-file by file.
    Any help is appreciated
    Thank you



    Source file
    .. more than 4000 bytes...]] .. .more Quen 4000 bytes...]] .. more than 4000 bytes.

    ]] ist the record delimiter

    External table:
    create the table TST_TABLE
    (
    txt_line varchar2 (4000)
    )
    external organization
    (type
    ORACLE_LOADER
    the default directory tmp_ext_tables
    (settings) access
    records delimited by a "]]"
    fields (txt_line char (4000))
    )
    location ("test5.log")
    )
    reject the limit 0
    ;

    user12068228 wrote:

    I'm trying to import a log file into a database table that has a single column: txt_line
    In this column, I'm trying to fill out a log by record type entry. Each log entry is normally more than 4000 bytes in the outer table, it should be a clob.
    Below is a table of external work that works, but cut all entries after 4000 bytes. How is it is possible to directly load the data into a clob column? All I've found are descriptions where I have a clob-file by file.
    Any help is appreciated
    . . . E t c...

    And what did you expect if you define the field source and target column as 4000 characters?

    Try this:

    CREATE TABLE tst_table
     (
       txt_line CLOB
     )
     ORGANIZATION EXTERNAL
     (TYPE oracle_loader
        DEFAULT DIRECTORY tmp_ext_tables
        ACCESS PARAMETERS (
           RECORDS DELIMITED BY ']]'
           FIELDS (txt_line CHAR(32000))
        )
      LOCATION ('test5.log')
     )
    REJECT LIMIT 0
    ;
    

    8 2

  • Loading the XML file with the missing elements dynamically by ODI

    Hi guys,.

    I have the XML with two nodes Employee and address below. On a daily basis, sometimes the address element might not come from the source xml file, but my interface has columns mapped to the elements of the address, and that is why it may fail because of the source element is not found in the file or data could not get charged because the State 'and' in the sql query that is generated between the employee and address elements.  Is there a way where I can load the data dynamically where I can search in the file only for items (used) present and dynamically loading data only for these items?

    XML file:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < EMP >

    < Empsch >

    < employee >

    < EmployeeID 12345 > < / EmployeeID >

    < original > t < / initials >

    John < name > < / LastName >

    DOE < FirstName > < / name >

    < / employee >

    < address >

    < > 12345 as WorkPhone < / as WorkPhone >

    < WorkAddress > test 234 < / WorkAddress >

    < / address >

    < / Empsch >

    < / EMP >

    Thank you

    Fabien Tambisetty

    I managed to solve it by using left outer joins, and in referring to the structure of the table of the XSD

  • InDesign cs5 for vector files alt text doesn't work when not in interactive pdf

    I am creative and interactive pdf newsletter which must be compatible with accessibility. Text alt for jpg, psd, etc work fine, but no alt text appears for the pdf files or have. Wendeth63 asked a question similar May 13, 2013, but it refers to eps files. I have experienced by changing the background from transparent to solid, but nothing works. Now that the accessibility compliance is mandatory in many places, it is a pretty big bug.

    Without the feature changed massively in CC and CC20015, as object Export Options have been introduced, and they are now included in the object Styles which can attract this meta out of the file, making it effective to change the meta in Bridge information, place the image in a frame with a correct object style.

    But with CS5 you are out of luck and you will need to do in Acrobat.

    Here is a screenshot of the style of being in 2015 of CC:

  • Files recent Photoshop doesn't work does not correctly (PS cc2015)

    I really enjoyed the new thumbnail view of recent files in PS, but his does not work for network drives, I think that sometimes does not not (on this part, I'm not sure)

    on local disk also. Please, make sure that it works correctly. I use professional PS (the domain) CC 2015.1 (20151114.r.301 x 64) win7 64 bit

    Hi snarkysk,

    Please clarify the recent file list of file > open recent item > clear recent file list

    Let us know if that helps.

    Kind regards

    Assani

  • Problem with password doesn't work is not for the user account.

    I write my password each time, but when I use it, you say, that it is a mistake. I'm tired of having to change all the time

    Separated from -.

    https://answers.Microsoft.com/thread/e870d4be-0d99-46b3-A84D-9d8edbb0af04

    Anna,

    Please contact the community.

    I will have this article-

    http://support.Microsoft.com/kb/321305/en-us

    We know if that helps.

  • Load an external SWF file without overwriting my container SWF (AS2) file

    Hello world

    I want to load an external SWF with AS2, but file without overwriting my container file. How can I achieve this? What is the correct code?

    Here is the code I use :

    loadMovieNum ("external.swf", 0);

    countdown = function() {}

    trace ("OK");

    }

    countdownIt = setInterval (countdown, 1000);


    It works well, but as I said, it overwrites my container SWF file. If I load into level 1, my container file works but not the one I try to load... .



    Can someone help me with this, please?

    Try to use the loadMovie method... meaning container.loadMovie.  See below for an explanation: Load external in another SWF SWF

    If the loaded file does not work when you load it, it is probably because you have references to _root in there who do not find the expected _root.  You must set the file loaded _lockroot property to be true.

  • Multi load: error downloading the text file with more than 5 times

    Hi all

    I am getting below error while trying to load a text file with more than five periods of data through Multi charge.

    " File can not be treated because the number of specified periods exceeds the available periods!" ".

    FLTFILE_TO_PLANNING3
    BUDGET
    30/04/2013
    6
    Q.
    A, C, UD1 UD2 UD3, UD4, UD5, UD6, UD7, UD8, V, V, V, V, V, V
    AC_11102, CC_104204, Local, year 0, target, Final Budget, SA_000000, P_000001, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_11102, CC_104207, Local, year 0, target, Final Budget, SA_000000, P_000000, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_12542, CC_102101, Local, year 0, target, Final Budget, SA_000000, P_000000, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_11102, CC_113242, Local, year 0, target, Final Budget, SA_000000, P_002478, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_11102, CC_113243, Local, year 0, target, Final Budget, SA_000000, P_000000, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_17802, CC_113244, Local, year 0, target, Final Budget, SA_000000, P_000856, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_11102, CC_113511, Local, year 0, target, Final Budget, SA_000000, P_000000, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110
    AC_11102, CC_124111, Local, year 0, target, Final Budget, SA_000000, P_000521, HSP_InputValue, entry, 60, 70, 80, 90, 100, 110

    This file works fine with 5 periods.

    Please notify.

    APR

    Hello

    Yes, table period contol FDM was not properly defined. Now it works fine. Thank you very much.

    APR

  • Loading external files in Oracle - error (double quotes on the columns)

    I managed to successfully load some external files (Excel) in my Oracle database, but when I questioned the table, I see that some of the columns have quotation marks on them. No idea how to fix this problem?

    OPTIONALLY ENCLOSED BY quotes in your syntax to remove.
    http://www.morganslibrary.org/reference/externaltab.html

  • I have a PDF file with attachments (PDF files also) I would like to add to my site.

    I managed to main PDF hyperlink, but attachments will not open the file hypelinked. I also tried to have links to the files, rather than as attachments, but they do not always open. Is there a way to do this?

    It of a matter of your PDF structure than anything else. It seems that you speak of the linked files, attachments, after all. Attachments are integrated into the main PDF file. In case of the related files you can be faced with problems because the PDF files use absolute links, which of course can no longer be valid and correct on the server settings more security on the server and in Acrobat / Reader can prevent the loading of external files. why they do not open when you access directly is another story, but we really need to know much more.

    Mylenium

  • How to load my external Gallery.swf in Page 6. It loads the first page (HomePage_mc)?

    Hello

    The following code loads my external file "Gallery.swf" on HomePage_mc (which is Page 1). But I want to load it on Gallery_mc (which is Page-6). How can I do?

    Here is the code:

    [code] ButtonsPanel_mc. Gallery.addEventListener (MouseEvent.CLICK, GalleryClick);

    function GalleryClick(e:Event):void {}

    If (currentClip! = Gallery_mc) {}

    currentClip.visible = false;

    Gallery_mc. Visible = true;

    currentClip = Gallery_mc ;}

    var Xpos:Number = 110;

    var Ypos:Number = 180;

    var swf:MovieClip;

    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("swfs/Gallery.swf");

    Loader.Load (defaultSWF);

    Loader.x = Xpos;

    Loader.y = Ypos;

    addChild (loader); }

    [/ code]

    PS: There was a problem with a hug. Now it is fixed, but when I go to the homepage or any other page after clicking on the button of the Gallery, the Galley.swf, but continued to play on top of all these pages. How to fix?

    Thank you.

    To have the Gallery load on Gallery_mc, you would use...

    Gallery_mc. AddChild (Loader) instead of addChild (loader).  Which bind to this movieclip.

  • Need help to load an external SWF

    I'm not very proficient in Flash, so any help will be greatly appreciated. I am trying to load an external SWF with the following code:

    T1_Bttn_BloodCar.onRelease = function() {}

    (" t1_images_mc.loadMovie("images/T1_Gallery/BloodCar_SWF/T1_BloodCar.swf ");

    t1_images_mc._alpha = 0;

    It loads the SWF file, but it is not playing correctly when I test it. Here's how the loaded movie is supposed to look like:

    http://www.theroboteye.com/T1_BloodCar.html

    But instead, he plays without the transitions, like this:

    http://www.theroboteye.com/TRE2009b.html

    I tried to figure this out for a few days and have tried to add "this ._lockroot = true;" to the SWF I am trying to load, but I can't play properly. Can someone tell me what I am doing wrong? Thanks in advance.

    Try using MovieClipLoader (loadClip method) class rather than the loadMovie method.  In this way, you can have a listener who expects the movie to be loaded and then pull it in-game, by assigning actions and properties after the fact.

  • find the number of external files?

    I have a SWF mp3s to load an external file. The number of mp3s can vary from time to time. Is there a way to determine how many mp3 files in the external folder there... without the use of a data such as .xml file?

    Thanks in advance!

    You application on internet?  If so, Flash can not query the server for that information, so you'd need another file to manage this information them anyway... If it is an xml file, then a PHP (or similar) file can get this information and it echo to Flash in the form of data.

Maybe you are looking for