Load a picture 2D from a txt file

Hi, I have a little problem on the table: /.

I'm a little game of tiles according to the coding, and I load the map from a .txt file.

The txt file is like this:

0 1 0 1 0 1 0 0 0 0 0 1 1 1 1

1 0 1 0 1 0 0 1 1 0 1 0 1 0 1

...

and I want to just use it in this loop:

for (var i: int = 0; i < mapHeight; i ++)

{

for (var j: int = 0; j < mapWidth; j ++)

{

var cell: MovieClip = new tile();

cell.gotoAndStop (map [i] [j] + 1);

If (i % 2 == 1) {}

Cell.x = 70 * j - 35;

Cell.y = 35 * i;

}

else {}

Cell.x = 70 * j;

Cell.y = 35 * i;

}

addChild (cell);

}

}

This loop works if I create the table on the map in the AS3 file, but with 10 cards, the code will be very very very long.

I tried to load the table from a txt file, but there is not a lof on internet information and I'm stuck.

To load the txt file:

var mapLoader:URLLoader = new URLLoader();

mapLoader.addEventListener (Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void {}

var maptext:String = e.target.data;

var map: Array = maptext.split("");

trace (Map);

}

mapLoader.load (new URLRequest ("map1.txt"));

But I do not understand how to use 'map' after that, I can't use it in the loop to add cell, I have an error.

I find that all it really complicated to load just a simple table 2D from a txt file.

Can't I just put all the maps in AS3 in a different txt file and load this part of code when I need it? Like this:

"var map: Array = [];

[1,0,0,1],

[1,1,1,1]

[0,0,0,0]

[0,1,0,1],

]; "

Thanks for the help and sorry for the bad English.

If I recreate the first version, I get the same result as what you show for the second version - I do not get the result snapped up as show you.  My guess is that you have the data file prepared incorrectly when you organize the data into it.

Tags: Adobe Animate

Similar Questions

  • How to ignore the details of footer when loading data from a .txt file

    Hello experts,

    I import data from a txt file in my database. I jumped my header using SKIP information, but how can I ignore my footer details.
    Thank you

    Answer on your other thread:

    Txt for a required format file processing

  • How to add images and text from a txt file in Adobe Muse?

    How to add images and text from a txt file in muse

    Hello Tony,.

    At you can easily found in your text, copy and then paste in the new text box within the Muse, following a normal copy and paste.

    but images can be copied and pasted, so you need to save the images first as normal JPEG or PNG formats, and then you can import them into your file of muse.

    Best regards

    _Ankush

  • Import text from a txt file.

    Hey guys,.

    I'm looking for a way to import text from a .txt file, but I'm totally lost. If someone could point me in the right direction would be great

    Hi Prails
    This script is basically what you asked:

    #target illustrator

    main #targetengine

    function copyText() {}

    text var file is File.openDialog ('select file');.

    If (! textFile.exists | app.documents.length == 0) {}

    return;

    };

    textFile.open ("r");

    var txtContent = textFile.read ();

    textFile.close ();

    var doc = app.activeDocument;

    var textItem = doc.textFrames.add ();

    textItem.contents = txtContent

    };

    copyText ();

    Basically what you need to do is to declare the text file, open, read and close it. Then, you create a new text element in the Illustrator document and write content once caught in the text element.

    You can continue to work with the variable 'textItem' in my example script if you want to set properties such as size, text color, position and so on. Also, if you wish, replace the first line of the function var textFile = new file ("" ~ / Desktop/Test.txt ' "); textFile var = File.openDialog ("select the file"); so the script opens a dialog box asks you the file you want to copy the content.

    Hope to be helped

    Best regards

    Gustavo

    Post edited by: Gustavo Del steep

  • Read the special characters from the txt file

    Hi guys,.

    on blackberry 9000, I tried to read some special characters like this: ° ²® µ±³ ° ¯´µ±´¯® text file

    using this function:

    FileConnection fc = (FileConnection) Connector.open ("file:///SDCard/test.txt", Connector.READ_WRITE);
    InputStream is = fc.openInputStream ();
    InputStreamReader reader = new InputStreamReader (is, "UTF - 8");
    LineReader lineReader = new LineReader (is);
    line & = new String (lineReader.readLine ());

    what I get is different, I can't write it here, it is difficult to find these characters.

    I change the content of the file to:

    ddfdsfdsfdsfdsfdsf
    aaaaabbbc ° ² ° ¯´µ±´¯® µ±³®

    now I get:

    ddfdsfdsfdsfdsfdsf
    aaaaabbbc, then the same characters

    How to display the same as what I have in the text file?

    Thank you

    To add to what martijnbrinkers said, you need not to the InputStreamReader because you don't use it (and this is why your code has no idea that the file is in UTF-8 encoding).

  • SQLLDR - load only selected columns from a csv file

    Hello

    Can we charge only a few selected columns of a big (INFILE) CSV using SLLDR?

    Thank you in Advcance
    Kapil

    Hello

    You can take a look at this. It may be useful

    DECLARE
    l_start_file_name varchar2(50) := 'invoice_excel_c';
    l_end_file_name varchar2(50)   := '.csv';
    l_file_name varchar2(100);
    l_sql varchar(32767);
    refresh_cdc varchar2(5) := '00304';
    
    begin
    
    l_file_name := l_start_file_name||REFRESH_CDC||l_end_file_name;
    
     l_sql :=
    'create table exter_invoice_excel               '||
    '(                                              '||
    'Product_name                varchar2(255),     '||
    'Net_Sales                   Number,            '||
    'Net_Adjustments             Number,            '||
    'Cancels_Count               Number,            '||
    'Cancels_Amount              Number,            '||
    'Cashes_Count                Number,            '||
    'Cashes_Amount               Number,            '||
    'Claims_Count                Number,            '||
    'Claims_Amount               Number,            '||
    'Returns_Count               Number,            '||
    'Returns_Amount              Number,            '||
    'Free_Prize_Count            Number,            '||
    'Free_Prize_Amount           Number,            '||
    'Free_Promo_Count            Number,            '||
    'Free_Promo_Amount           Number,            '||
    'Promo_Credit_Count          Number,            '||
    'Promo_Credit_Amount         Number,            '||
    'Return_Commission           Number,            '||
    'Net_Discounts               Number,            '||
    'Total_Fees                  Number,            '||
    'Sales_Commission            Number,            '||
    'Cash_Commission             Number,            '||
    'Tkt_Charge                  Number,            '||
    'Subscription_Commission     Number,            '||
    'Interim_Sweeps              Number,            '||
    'Net_Due                     Number,            '||
    'Retailer_id                 Number,            '||
    'Retailer_Name               varchar2(255)      '||
    ')                                              '||
                  'ORGANIZATION EXTERNAL (                 '||
                  ' TYPE oracle_loader                     '||
                   ' DEFAULT DIRECTORY GTECHFILES          '||
                   ' ACCESS PARAMETERS (                   '||
                   '   RECORDS DELIMITED BY NEWLINE        '||
                   '      CHARACTERSET WE8MSWIN1252        '||
                   '   BADFILE ''invoice_excel.bad''       '||
                   '   DISCARDFILE ''invoice_excel.dis''   '||
                   '   LOGFILE ''invoice_excel.log''       '||
                   '   FIELDS TERMINATED BY '','' RTRIM      '||
                   '  MISSING FIELD VALUES ARE NULL        '||
                   '   )                                   '||
                   '   LOCATION ('''||l_file_name||''')    '||
                   ' )                                     '||
                   'PARALLEL                               '||
                   'REJECT LIMIT UNLIMITED ';
    
            execute immediate l_sql;
    
          l_sql:=  'INSERT INTO INVOICE_EXCEL_TEMP                '||
                      ' ( Product_name               ,            '||
                      '  Net_Sales                   ,            '||
                      '  Net_Adjustments             ,            '||
                      '  Cancels_Count               ,            '||
                      '  Cancels_Amount              ,            '||
                      '  Cashes_Count                ,            '||
                      '  Cashes_Amount               ,            '||
                      '  Claims_Count                ,            '||
                      '  Claims_Amount               ,            '||
                      '  Returns_Count               ,            '||
                      '  Returns_Amount              ,            '||
                      '  Free_Prize_Count            ,            '||
                      '  Free_Prize_Amount           ,            '||
                      '  Free_Promo_Count            ,            '||
                      '  Free_Promo_Amount           ,            '||
                      '  Promo_Credit_Count          ,            '||
                      '  Promo_Credit_Amount         ,            '||
                      '  Return_Commission           ,            '||
                      '  Net_Discounts               ,            '||
                      '  Total_Fees                  ,            '||
                      '  Sales_Commission            ,            '||
                      '  Cash_Commission             ,            '||
                      '  Tkt_Charge                  ,            '||
                      '  Subscription_Commission     ,            '||
                      '  Interim_Sweeps              ,            '||
                      '  Net_Due                     ,            '||
                      '  Retailer_id                 ,            '||
                      '  Retailer_Name               ,            '||
                      '  SOURCE                      ,            '||
                      '  INSERTED_DATE               ,            '||
                      '  CDC                         ,            '||
                      '  UPLOADED                                 '||
                      ')                                          '||
    '              select                                         '||
                      '  ltrim(rtrim(product_name)) ,             '||
                      '  Net_Sales                   ,            '||
                      '  Net_Adjustments             ,            '||
                      '  Cancels_Count               ,            '||
                      '  Cancels_Amount              ,            '||
                      '  Cashes_Count                ,            '||
                      '  Cashes_Amount               ,            '||
                      '  Claims_Count                ,            '||
                      '  Claims_Amount               ,            '||
                      '  Returns_Count               ,            '||
                      '  Returns_Amount              ,            '||
                      '  Free_Prize_Count            ,            '||
                      '  Free_Prize_Amount           ,            '||
                      '  Free_Promo_Count            ,            '||
                      '  Free_Promo_Amount           ,            '||
                      '  Promo_Credit_Count          ,            '||
                      '  Promo_Credit_Amount         ,            '||
                      '  Return_Commission           ,            '||
                      '  Net_Discounts               ,            '||
                      '  Total_Fees                  ,            '||
                      '  Sales_Commission            ,            '||
                      '  Cash_Commission             ,            '||
                      '  Tkt_Charge                  ,            '||
                      '  Subscription_Commission     ,            '||
                      '  Interim_Sweeps              ,            '||
                      '  Net_Due                     ,            '||
                      '  Retailer_id                 ,            '||
                      '  Retailer_Name               ,            '||
                      ' '''||l_file_name                           ||''', '||
                      '   sysdate                    ,            '||
                      ' '''||    REFRESH_CDC                       ||''', '||
                      '''N'''                                      ||
                      'FROM                                       '||
                      'exter_invoice_excel                        '||
                      'WHERE retailer_id is not null and ltrim(rtrim(product_name)) in (''Loto'',''Inst Tk'')';
    
            execute immediate l_sql;    
    
            l_sql :='drop table exter_invoice_excel';
            execute immediate l_sql;
    
    exception
    when others then
    rollback;
    l_sql :='drop table exter_invoice_excel';
    execute immediate l_sql;
    debug_message('INVOICE_EXCEL_UPLOAD/'||REFRESH_CDC,'Unexpected Error '||sqlerrm);
    END;
    
    --truncate table invoice_excel_temp
    

    Thank you

  • Location of the text (txt) file

    Hello world

    For some reason if I try to import data from a txt file in a folder on the same location as my video file it does not work:

    on startMovie()
      importFileInto(member "Contact", the applicationpath&"Documents\Contact.txt")
    end
    

    But if I move the txt file, next to my movie and change the jargon for:

    on startMovie()
      importFileInto(member "Contact", the applicationpath&"Contact.txt")
    end
    
    

    It does not work...

    I add this jargon to a film script.

    Any ideas?

    Thank you in advance...

    Rafa.

    you might want to use "the moviePath" instead of "applicationPath.  When you are in design mode, applicationPath will point to the executable Director, not your dir file.

  • 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.

  • Load the data from a text file into a table using pl/sql

    Hi Experts,

    I want to load the data from a text file (sample1.txt) to a table using pl/sql

    I used the pl/sql code below

    ***********************************
    declare
    f utl_file.file_type;
    s varchar2 (200);
    c number: = 0;
    Start
    f: = utl_file.fopen('TRY','sample1.txt','R');
    loop
    UTL_FILE.get_line (f, s);
    insert into sampletable (a, b, c) values (s, s, s);
    c: = c + 1;
    end loop;
    exception
    When NO_DATA_FOUND then
    UTL_FILE.fclose (f);
    dbms_output.put_line('No. deles de lignes insérées: ' || c);
    end;

    ***************************************

    and my sample1.txt file looks like

    ***************************************
    1
    2
    3
    ***************************************

    Gets the data inserted, with way below

    Select * from sampletable;

    A, B AND C

    1-1-1
    2-2-2
    3 3 3

    I want that data to get inserted as

    A, B AND C

    1 2 3

    The text file I have is to have three lines, and the first value of each line should go to each column

    Help, please...

    Thank you
    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    

    SY.

  • How can I load a. In a dynamic text box TXT file?

    I'm sure that many people know how to load a .txt file in a dynamic text box. But I did not. I want to be able to reference a txt from the server file in the text box. So that when I change the text file it changes in the flash animation without even modifying the file flash itself. Thank you.

    If you want to follow this tutorial, you should go with the LoadVars class. not loadVariablesNum()

    Linky

  • How can I down load my pictures from my camera phone?

    How can I down load my pictures from my camera phone?

    nexteli686

    Look for the instructions of the manufacturer of the phone.

  • I understand that the watch ntbtlog.txt file drivers loaded during the startup process. I'm worried when it shows driver loaded, but it is not a list.

    I understand that the watch ntbtlog.txt file drivers loaded during the startup process. I'm worried when it shows driver loaded, but it is not a list. Why is this?

    Hello

    Yes, it can be in hidden files that may cause by the virus.

    I also suggest you to see link and check.

    Show hidden files

    http://Windows.Microsoft.com/en-us/Windows7/show-hidden-files

  • 5 Lightroom sometimes fails to load EXIF GPS data from .jpg files

    Until I Lightroom, I used geoSetter to add GPS data to my .jpg files. Most of them have loaded up in LR without problem, but for some of them, Lightroom could not import the GPS data. I used to compare GPS data in the loaded files OK and those who have not noticed that some of the problem files do not have exiftool: GPS, GPS Time Stamp, dater GPS map data. I used exiftool to change these in the file, Lightroom still not managed to load GPS data.  Anyone has an idea why Lightroom 5 sometimes fails to load EXIF GPS data from .jpg file

    = P3207532.jpg - data from GPS not imported into Lightroom

    ID of the GPS Version 2.2.0.0

    GPS Latitude Ref North

    GPS Longitude Ref is

    REF Altitude GPS altitude

    Time GPS 2015:03:20 02:18:36Z

    GPS Latitude 20 deg 54' 41.68 '' N

    GPS Longitude 107 deg 0' 5.47 "E

    GPS Position 20 deg 54' 41.68 '' N, 107 deg 0' 5.47 "E

    = P3207533. JPG - Imported data GPS OK in Lightroom

    ID of the GPS Version 2.2.0.0

    GPS timestamp 02:22:26

    GPS map Datum WGS-84

    GPS Date Stamp 2015:03:20

    Time GPS 2015:03:20 02:22:26Z

    GPS Latitude 20 deg 54' 43,41 "N

    GPS Latitude Ref North

    GPS Longitude 107 deg 1 9.10 ' E

    GPS Longitude Ref is

    GPS Position 20 deg 54' 43,41 "N, 107 deg 1 9.10 ' E

    = P3207532.edited.jpg - data from GPS not imported into Lightroom

    ID of the GPS Version 2.2.0.0

    GPS Latitude Ref North

    GPS Longitude Ref is

    REF Altitude GPS altitude

    GPS timestamp 02:22:26

    GPS map Datum WGS-84

    GPS Date Stamp 2015:03:20

    Time GPS 2015:03:20 02:22:26Z

    GPS Latitude 20 deg 54' 41.68 '' N

    GPS Longitude 107 deg 0' 5.47 "E

    GPS Position 20 deg 54' 41.68 '' N, 107 deg 0' 5.47 "E

    The problem with P3207532.jpg is that it contains two sets of GPS, a values in the section of EXIF metadata in the XMP metadata section:

    $ exiftool -a -G P3207532.jpg | grep -i gps
    [EXIF]          GPS Version ID                  : 2.2.0.0
    [EXIF]          GPS Latitude Ref                : North
    [EXIF]          GPS Latitude                    : 20 deg 54' 41.68"
    [EXIF]          GPS Longitude Ref              : East
    [EXIF]          GPS Longitude                  : 107 deg 0' 5.47"
    [EXIF]          GPS Altitude Ref                : Above Sea Level
    [EXIF]          GPS Time Stamp                  : 02:22:26
    [EXIF]          GPS Map Datum                  : WGS-84
    [EXIF]          GPS Date Stamp                  : 2015:03:20
    [XMP]          GPS Date/Time                  : 2015:03:20 02:18:36Z
    [XMP]          GPS Version ID                  : 2.2.0.0
    

    But the XMP section contains an incomplete set GPS fields. Note that XMP:GPSDateTime specifies a time other than EXIF:GPSTimeStamp.

    I don't know which of your programs may have created these XMP values false, incomplete, but they confused LR.  According to the specifications of the Working Group of the metadata, which accepted LR, LR, choose the EXIF GPS values and false XMP values should not confuse it. But LR is preferring the XMP values and then conclude it is not all the GPS coordinates.

    You can work around this bug in LR by doing:

    ExifTool - xmp: gpsdatetime = - xmp: gpsversionid = file

  • How you load in an external text (txt) file using edge animate CC?

    Hello

    Does anyone know how to load in an external txt file using edge animate? I think you have to make ajax calls, but I am a totally newbie here.

    Would be grateful for the help.

    Thank you and best regards,

    James

    Use a JSON file. Ingestion of external data | Learn edge CC animated | Adobe TV

  • I can't import pictures from a card file or anything like that.  I get "could not copy a file at the location requested.  It's never happened before.

    I can't import pictures from a card file or anything like that.  I get "could not copy a file at the location requested.  I've never had this happen before.  I use a MacBook Pro

    well, I understood my question, maybe the same thing for you...    The catalogue was somehow the problem, I created a new catalog and everything works well again.  I assumed that the catalog has been damaged during the import failed because the network connection.   hope that helps

Maybe you are looking for

  • Tecra M3 works very noisy

    My Tecra M3 PTM30E is 4 months old and I'm starting to find it unbearbable to use. The fan noise is a source of irritation for all meetings and is almost as strong as the overhead projector. He never stops despite all my efforts to resign from all th

  • OfficeJet Pro 8500 has more: Scanner has stopped working

    Scanner no longer works. Printer turned on and outside, missed scan printer Dr, which did not work, pulled the power cord, checked the wireless network, turn off router then return. Never had this much trouble getting scanner to work. Ideas.

  • My DV8Pro 5830 will take a 128 micro SD?

    I have a 64 GB DV8Pro 5830 running Win8.1 and I'm slowly coming to grips with it! I am currently using a SanDisk Ultra 64 GB MicroSD for memory additional but want to use a 128 GB card if possible.Does anyone know if it will be to: -. (1) a Samsung 1

  • Which JVM is used?

    Hi friends, Which jvm is used in BB for running our application? and if you know it please explain to me how the application will run... ?

  • Clouds and sky Texturepack

    where to find in photoshop cs4 thanks!Dimitrios