Creation of external files (.json, .txt, etc.)

Hi all

I'm trying to learn how to create external files to a SWF/exe/app file created in Flash. Essentially, I'm building a program to create templates for the levels in a game. The SWF will be run locally (for example not online) and allows the user to add/remove objects to the level of their design. They must then be able to save the level template (ideally I need to be able to record in a JSON file *, but I'm sure I could get away with just a simple txt file) somewhere on their computer. These models will be them be imported by the game itself (not written in Flash, so why do I need to save the data in a json or txt file), then recreate the concentrations between the data contained in the registration file.

I thought it would be something that was really simple to do, but I can't seem to find tutorials or information on how to create external files. I can find many on the reading of existing external files, but nothing to really write a new file entirely. I read a few people complain that non-local Flash SWF cannot access hard drive of the user for security reasons, but can not find information about the local SWF files.

If someone could tell me roughly what I'm looking for, it would be greatly appreciated. I'm kinda stuck right now haha

* I downloaded the corelib files that allow me to work with JSON files

If the user is involved (you can't auto-save), you can use the FileReference.Save () method.

Here is the documentation for example:

http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/NET/FileReference .html #save ()

If use AIR - things can be more sophisticated.

Tags: Adobe Animate

Similar Questions

  • name of layers to export to an external file

    Hi all

    is it possible to export the names of layers ( this.getOCGs () [i] .name ) using JS in an external file (csv, xml, etc.) in order to place the names in an excel file?

    Thank you and best regards,

    Alex

    Sure. Have a look at the createDataObject and exportDataObject methods.

  • plain text files load from an external file

    I created a text file from an external load file. I am facing a problem is that the text does not load unless someone click on the button. I'd like the text is displayed as soon as someone enters the page.

    Here is the link to the website http://hitenkajal.co.uk/our_story.html

    Username: hitenkajal.co.uk

    password: sairam11

    and my screen below codes:

    Plain text files load from an external file

    var textLoader:URLLoader;
    function loadStory(evt:MouseEvent):void
    {

    textLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest ("MobyDick.txt assets/Franck"));
    trace ("hit_btn");
    }

    hit_btn.addEventListener (MouseEvent.CLICK, loadStory);


    function loadHowwemet(evt:MouseEvent):void
    {

    textLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest ("assets/pencil kajal MobyDick.txt"));
    trace ("kaj_btn");
    }

    kaj_btn.addEventListener (MouseEvent.CLICK, loadHowwemet);

    function loadProposal(evt:MouseEvent):void
    {

    textLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest("assets/proposal.txt"));
    trace ("pro_btn");
    }
    pro_btn.addEventListener (MouseEvent.CLICK, loadProposal);

    function textLoaded(evt:Event):void
    {

    Container.info_txt.text = textLoader.data;

    }

    Creation of a ScrollBar to a text field
    var dragRect:Rectangle = new Rectangle(drag.x,drag.y,0,bar.height-drag.height);
    drag.addEventListener (MouseEvent.MOUSE_DOWN, dragMouseDown);


    function dragMouseDown(evt:MouseEvent):void
    {
    drag.startDrag (false, dragRect);
    stage.addEventListener (MouseEvent.MOUSE_UP, dragMouseUp);
    addEventListener (Event.ENTER_FRAME, scrolling).
    }

    function dragMouseUp(evt:MouseEvent):void
    {
    drag.stopDrag ();
    stage.removeEventListener (MouseEvent.MOUSE_UP, dragMouseUp);
    removeEventListener (Event.ENTER_FRAME, scrolling).
    }

    function scrollText(evt:Event):void
    {
    var percentScrolled:Number = (drag.y - bar.y)/(bar.height-drag.height);
    Container.y = percentScrolled * (bar.height - container.height) + bar.y;
    }

    I do not know what Maury is trying to say, but the code is very well.  1009 error means your code is trying to target something that does not exist for as far as the code sees it.  In your function textLoaded, add the line I show below and see what appears in the output...

    function textLoaded(evt:Event):void
    {
    trace (container, container.info_txt);

    Container.info_txt.text = textLoader.data;
    }

    If the output shows undefined, then you have a problem insofar as the container or the textfield inside it sucks... most likely a naming problem.

  • Read file test.txt (binary or what?) with LabVIEW 8.6

    Dear friends!

    Please, how to read the attached file (test.txt) with LabVIEW 8.6.  In the same VI, can I convert it in a txt file real with the results presented in the rows and columns? Please, any idea? I need help!

    The rebooting of the trace file is binary.

    Unfortunately, without a description of the real file by developers RELAP format, I don't think you are going to get very far on the decoding of the file.

    You must get directly in contact with the authors RELAP.

    Here's the blurb to the RELAP Manual:

    3.1.4.2 the reboot-Plot file.

    The restart-trace file contains almost all the parameters of calculation

    (Sub fractions, pressures, temperatures, flow rates, etc.) for transient computing together.

    A common misconception is that a parameter must be specified using a minor in change request

    in order to be available in the reboot-trace file when the calculation is complete. Affects a minor change request

    only the printed output. The restart-trace file is accessible repeatedly that the new data should arise. However,.

    during a calculation, the data are written to the reboot-trace only for minor editing file (and the plot point)

    frequency. Once a calculation has been performed, it is not possible to recover data between data

    written to the file to restart-track of the points. Therefore, it is important to choose a minor edit (and plot the point)

    frequency that provides the plot to an interval appropriate to the problem is resolved. In practice,.

    the minor change (and plot point) frequency must be changed during the calculation as the product of the problem

    from one phase to the other. Common points must be selected in the phases of problem where rapid

    RELAP5-3D/2.4

    INEEL-EXT-98-00834-V5 3-18

    setting changes are expected. For the economy, less common points must be selected in the phases

    where the conditions of rest are expected.

    Calculations are usually made using several reboots. (See Volume II for the restart entry

    requirements.) For example, a new problem runs from 0 to 10 seconds. This first part is analyzed and

    Run again from time zero that errors will be corrected. When a managed to 10 seconds has been calculated, a

    restart run is made (for example, 10 to 30 seconds), and so on. RELAP5-3D

    © offers you the possibility of

    change of almost any feature of the model at any point of restart. When changes to the model are incorporated on

    reboot, reboot-plot file reflects those changes only after the decimal point in the calculation, where they have been

    implementation. In the example above, if an injection system is added to the model to 10 seconds, then data

    for added components exists only for the time after 10 seconds. Changes, deletions and additions of model

    are constantly being implemented. If a model change is done in 10 seconds, the revised model remains in

    effect unless other changes are made to subsequent restart points.

    When a calculation is completed, the restart-trace file becomes a valuable document of the

    calculation. If lost, replacement would require reperforming the calculation, usually to the considerable

    loads. At a later date, the file can be accessed and previously compressed data can be obtained as

    necessary to extend the analysis. Therefore, it is recommended that files of restart-track of the important calculations

    be protected safely and permanently.

  • On windows 7, right click - new - * file * does not appear to create folders, I see other files word, excel etc. are appearing but not "folders".

    On windows 7, right click - new - *file* does not appear to create folders, I see other files word, excel etc. are appearing but not "folders".

    When I try to create Folders by right-click - New, it does not appear.

    Help, please.

    How to remove and restore the default context Menu items 'New' in Windows 7 and Windows 8
    http://www.SevenForums.com/tutorials/28677-new-context-menu-remove-restore-default-menu-items.html
     
     

    Tip: When you save the text in Notepad, the default file format is .txt. Replace all files.
     
     
     

     
  • 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());

  • external file loading

    I created the field of plain text and managed to load them from external files using the AS3 code below. Now I want to load several text field, but this time in a button, how can I do?

    It's my button code: proposal_btn

    story_btn

    var textLoader:URLLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest("assets/welcome.txt"));

    var dragRect:Rectangle = new Rectangle(drag.x,drag.y,0,bar.height-drag.height);

    drag.addEventListener (MouseEvent.MOUSE_DOWN, dragMouseDown);

    function textLoaded(evt:Event):void

    {

    info_txt.text = textLoader.data;

    }

    function dragMouseDown(evt:MouseEvent):void

    {

    drag.startDrag (false, dragRect);

    stage.addEventListener (MouseEvent.MOUSE_UP, dragMouseUp);

    addEventListener (Event.ENTER_FRAME, scrolling).

    }

    function dragMouseUp(evt:MouseEvent):void

    {

    drag.stopDrag ();

    stage.removeEventListener (MouseEvent.MOUSE_UP, dragMouseUp);

    removeEventListener (Event.ENTER_FRAME, scrolling).

    }

    function scrollText(evt:Event):void

    {

    var percentScrolled:Number = (drag.y - bar.y)/(bar.height-drag.height);

    info_txt.scrollV = Math.round(percentScrolled * info_txt.maxScrollV);

    }

    I'm not really sure of the question, but here's an example of use of your info_txt code so that clicking on the story_btn will load it... You should be able to use it as one example to others...

    var textLoader:URLLoader;

    function loadStory(evt:MouseEvent):void {}

    textLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest("assets/welcome.txt"));

    }

    story_btn.addEventListener (MouseEvent.CLICK, loadStory);

    function textLoaded(evt:Event):void {}

    info_txt. Text = textLoader.data;

    }

  • LoadVars update of the external file

    Hello

    I don't know that it's easy. I created a loadVars that reads an external file in a [] table. It works very well.
    The external file updates every 20 seconds. My loadVars does not work.

    I don't know if I need to add a listener object or what to check the file every n seconds.

    Any idea?

    Thank you

    Sky

    Figured it out. I put it simply:

    onEnterFrame = function() {}
    my_lv. Load ("filename.txt");
    }

  • How to refresh the contents of an external file

    Hi guys.

    I need to use an external file, regardless of the extension (.xls .xml .mdb .csv (txt) of the RPD to oracle BI.
    I use this file as a centerpiece in my star schema and this file need to update frequently.

    How I can see dynamically, without changes to the file, restart the services? I tried to answer to bring up all saving the file, but if I change the contents of the file and, in response, are trying to see the content... it's the same as the first!

    Can I do something to fix this problem? or I have to use the external table?

    Thanks in advance.

    Direct them best

    have a look here: http://obiee101.blogspot.com/2008/07/obiee-changing-xls-excel-data-on-fly.html

    concerning

    John
    http://obiee101.blogspot.com

  • How can I get rid of a file e.txt which continues to appear. Is this a virus?

    I've been on google mail and open an e-mail from one of my friends to watch his reume. I transfer over to windows, and while I was going to go to indeed.com , this file e.txt keeps asking me "I want to save it default notebook or open it." It won't go away. This isn't one of the file names that I opened before and I can't find this file anywhere. Is this a Virus? How can I get rid of him?

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe

    Clear the cache and delete cookies only from Web sites that cause problems.

    "Clear the Cache":

    • Firefox/tools > Options > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox/tools > Options > privacy > "Use the custom settings for history" > Cookies: "show the Cookies".
  • How to prevent the creation of 15000 files for 300 MB each day Firefox

    Firefox creates files of 'file' in C:\Users\LeRicain\AppData\Local\Mozilla\Firefox\Profiles\dnm04rk5.default\cache2
    There are about 10,000 and 20,000 files I have to remove to get about 300 MB of space each day

    How to prevent the creation of these files in Firefox

    Here are the files from cache. Basically, it takes Web sites that access you a lot and records bits of them so they'll load faster the next time you visit them. FOR EXAMPLE if you visit Google.com much, Firefox will save some elements of this page in the cache so that the next time visit you Google.com, it will not have to re - download.

  • differences in the use of a backup Favorites file ".json" and a file of bookmarks '.html '.

    Hi all
    What is the difference between the use of a backup Favorites file ".json" and a file of bookmarks ".html"? It seems that both of them do the same job. If this is the case, then why there are two options (.json and .html) to do the same job? If this isn't the case, then what is the reason for the availability of the two options and how are they different? Although I read the material, it didn't quite clear form me again. Please be so kind enough to elaborate on the question so that I can get a clear understanding of their good use (s).
    Thank you very much in advance for your time and skills

    Hello

    See questions/684284

  • Speed/performance of my mac mini (mid-2010) is very slow. Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.

    My mac mini (mid-2010) speed/performance is very slow - think of it as a result of letting my kids do "whatever" about it in recent years.  Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.  You will also need to get data out of old PowerBook G4.

    < object edited by host >

    We are users like you.  Search locally by using something like Yelp or similar

    http://www.Yelp.com/search?find_desc=Apple+repair & find_loc = Chicago, + IT & start = 0 & ortby = rating s

    or read a few links which may be relevant on this forum about the slow mac mini

    http://BFY.tw/5C63

  • on my laptop running windows 7 more information disappeared from the window - topics (file, publishing, display, etc.), address bar and navigation buttons - everything I can see tabs - how do the lack of points to display

    Missing on my laptop running windows 7, all the info displayed at the top of the home page. All headings, i. e. file, change the view etc. disappeared. There is no address bar. There is no "home button", the button refresh, etc.. My wife was using the machine when it happened, so I don't know what she was doing. How to restore these features?

    most of the information has disappeared from the window - topics (file, publishing, display, etc.), address bar and navigation buttons

    When all the toolbars are missing, you are probably in full screen view, press F11 to toggle mode full-screen, or you can move the cursor to the top of the screen.

    The real problems you describe all set thanks to an extension and customization, see 01:10 steps later...

    You can make Firefox 5.0 looks not like Firefox 3.6.19, see numbered 1 to 10 points in the next topic difficulty Firefox 4.0 UI toolbar, problems (Make Firefox 5.0, or 4.0.1 resemble 3.6). If you make changes, you must be aware of what has changed and what it takes to use changed or missing features.

    It is much more beyond these first 10 steps in the list, if you want to make Firefox more functional.

    Toolbars and their contents have been rearranged and buttons have been merged dual-use, the net result is that I could see about 25% of what I had before and recorded about 10% of the area of the toolbar with great loss of functionality to hide things that might already be hidden and to create confusing buttons that already have keyboard shortcuts and don't need to be seen. The only good thing that has been ' Ctrl + / ' has been added to hide/show the modules bar that has not replaced the status bar.

  • I lost the toolbar that displays 'file' 'view' 'edit' etc at the top, it is impossible to follow your instructions for using the 'View' option to fix my toolbars.

    I lost the toolbar that displays 'file' 'view' 'edit' etc at the top, it is impossible to follow your instructions for using the 'view' option to fix my toolbars. I have no idea how access toolbars without this toolbar - I can't believe this allows this toolbar to delete (I did accidentally while trying to get an another toolbar restored). Thanks for any help

    Hi toby,.

    on the assumption that you always have access to the navigation bar, right click on the stop button, when the home page is loaded and check the 'Menu Bar' option in the context menu that appears.

    If you need more help see the knowledge base article the Navigation buttons such as back, home, bookmarks and recharge are missing

    Daniel

Maybe you are looking for

  • Devices do not appear in the finder sidebar

    I've been struggling with this for a while. Readers and devices appear on my desktop but not on the bar side, extremely irritating. I tried a few suggestions such as the removal of the finder.plists and sidebar.plists, but it did not work. OS X Yosem

  • Missing link in the file write Key.vi LabView after switching LV development system server to RTE

    Hello TS4.2 LV8.6.1 I have a strange behavior of TS. All of the code works well under the development system. But when I pass the server of LabView runtime LabVIEW development system then, during the call one of my screws (action step calling the LV

  • Vulnerability of visibility of the external IP

    I have a WRT1900AC and it is connected to a router to Bell using PPPoE. If I go to the external IP address it give me the Linksys login page. My old Lynksys router do not present this information. How can I do that, go away?  I don't want anyone to k

  • Can only connect wirelessly via Linux?

    I have a router Linksys/Cisco EA3500. I can connect to wireless internet, but no one else in the House can. They can connect to the router and they appear on the routing table, but they cannot connect to the internet. We tried to reset our modem and

  • My windows vista computer has the look of windows 2000?

    Hello. I have problems with my windows programs. I fell asleep last night in front of my computer, and when I woke up, I found that most of my windows programs like version of windows 2000 Microsoft word, excel and paint that old look and my scroll b