ActionScript 3 - Save and load for each level

Can someone help me
I create each level in different places.
Stage 1 for level 1,
Scene 2 to level 2... so now.

I want when player push the home button on android hardware, it will save level or charge when the player wants to play the next time.

I'm already searching the Internet and understand that I must use sharedObject to save and load. But I have found no code example appropriate for me to study.

And now I don't know how to solve this problem.

Create the SharedObject class and give it an instance in the first frame of the project:

var mySO:SharedObject = SharedObject.getLocal ("myProjectID");

var theScore:Number; It's the score of the player.

if(!mySO.Data.myScore) / / check the shared object data if there is no data in the name myScore the value to 0, because the first round will not be any data in the shared object, we will write the data later.

{

theScore = 0;

}

on the other

{

theScore = mySO.data.myScore;

}

if(!mySO.Data.myFrameNumber) / / same thing here, we will check if there are data to the name myFrameNumber, if there is no, don't do anything.

{

fake;

}

else / / if there is

{

Stop (mySO.data.myFrameNumber, mySO.data.mySceneName);

}

All code above must be in the first image.

NAW every time you want to update the data, for example when you go to the next level using:

mySO.data.myFrameNumber = currentFrame; the current frame has been preserved in the name "myFrameNumber".

mySO.data.mySceneName = currentScene.name; the current scene has been preserved in the name "mySceneName".

mySO.data.myScore = theScore; the score was kept in the name "myScore.

mySO.flush (); the new data has been written in the class of the shared object.

You can write any value in the same way

And if you want to delete the data for a use of reason:

mySO.clear ();

Tags: Adobe Animate

Similar Questions

  • Save and load the string table

    Hello

    is possible except an array of channel with multiple line of text file and load new file to table with the same size of array?

    Because when I use the code in the picture, initialized array is 3 x 3 but after save and load file is table 5 x 3.

    If is an option how to save this table in the file into 3 x 3 table and charge back of file as a 3 x 3 table?

    Thank your for any suggestion,.

    Petr

    Your code is loaded in 5 x 3 is because two of your cells have newline characters (\n). The reading of the worksheet VI use return or line break characters and your delimiter to figure out how to split the string into an array.

    A solution might be to replace all characters from end of line with something else, and then reinsert it after reading of the worksheet.

    It can do what you want, even if it's a bit bulky. It's a little confusing if you don't understand "------" string formatting, but it essntially replaces all '\r' and '\n' with '\\r' and '\\n', including the conversion of the worksheet does not read as an end of line character.

  • I need to use programming like ActionScript loop, trigger, and load the data in the movies.  I can do with AE?

    I have been producing auto generate and parameter based animations for an artist over the years using Flash.

    Like this: Zarah Hussain | Animation

    Someone asks now that we use After Effects, but I need to use programming like ActionScript loop, trigger and load data into the movies.

    I can do with AE?  We need the loading animation 3 data values that affect the colors in real time

    Is it: -.

    Flash = online and interactive

    AR = fixed and linear.

    Help!

    Cries.

    You cannot use AE for this kind of things. Outside very limited real-time EI functionality it has not yet officially a dynamic performance of preload beyond the evalFile() hack. None of this makes no sense at all.

    Mylenium

  • Save and load curves

    I work with PS CS4 and can't figure out how to record and curves of load, which was in the curves dialog box.  The online Help menu indicates that I need to go to the «...» Option Save preset in the Panel menu. »

    For the life of me, I can't find an option "Save Preset" in the Panel menu.

    I hesitated to post this question, because the answer is bound to be easy stupifying, but I have been struggling with this for a while and just can not understand.

    Any help would be appreciated!

    Select the icon of curves (3rd from the top left side of the Panel settings) and use the Panel (top-right bar) menu to save and load. Your saved curves will also be second in the top of the list. Simply scroll to the top where the direction of the arrow and you will see.

  • I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. Help

    I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. HELP PLEASE. previous e-mail files are under mail then mail.earthlink* .net and each of the five mail .net is an email address I have. I can't find a way to identify each file by email to the specific email address (IE mail.my E-mail name.net) so I can copy the files and emails from the past to the email addresses now under tbird. previous installed e-mail identities may not be the current configuration of e-mail files in tbird. I think that I must be sure that mail.name.net matches the previous mail.name.net to be able to copy and paste the old to the new. is there a way to find the file name correct the old email and correspond to the new? all my emails very important information are mostly in the old mail electronic id and must be available in the identification of email again (but same) how can I do this?

    http://KB.mozillazine.org/Importing_folders

    Use this module.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

  • Auto SMS sent from my iPhone 5 to this number SMS int ' l 447903553650 and loaded for free! No history of sms sent in my message box! How can I solve it?

    Auto SMS sent from my iPhone 5 to this number SMS int ' l 447903553650 and loaded for free! No history of sms sent in my message box! How can I solve it?

    Tap settings > Messages and then turn OFF send as SMS .

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • Is if possible to group files by name and display for each letter instead of "A - H"?

    Is if possible to group files by name and display for each letter instead of "A - H"?

    Hello

    I don't think that there is a way to group all the numbers/letters individually.

    Grouping like this would appear likely several empty sections, since not all files will have file names that begin with all 26 letters.

    There are several ways that you can view the files by name, for example, list, details, category, etc.

    Concerning

  • New feature: Save and load tab sets

    When firefox starts up it restore my tabs previously open, saved to the last exit. To extend facilities to restore tabs on startup, I would like the ability to save (and later) a tab by using, for example, file-> options in the menu name.
    This Installation extension would give the possibility to connect several different sets of tabs, for example when I'm working on 2 or 3 different projects and want to combine several web pages each, or for example to open a set of tab of my favorite related web-sites.
    Currently I remember sets of tabs by organizing Favorites in folders and file-> new_tab and open the contents of the folder one by one.

    It is possible with the Session Manager extension:
    https://addons.Mozilla.org/en-us/Firefox/addon/2324

  • Each scale minimum and maximum for each slide table slides

    Hello

    is it possible to set values mini/maxi different scale in a group of slides via property nodes? As far as I know that's not possible. All the slides in the table must have the same minimum and maximum value. I only find a way to change all the scales at the same time. Are there any other ideas?

    Thanks in advance

    LVW

    Hi lvw

    You are right on the table, it is not possible to have different scale values. If you don't have a small number, you may be able to use a cluster of sliders, then you can set each individually. You can use the table for cluster and cluster to table to convert data types. You can also use cluster control references to define each level individually.

    Ian

  • Please help with the oracle text and select for each word in the sentence

    Hello

    I have a problem with a query which NEEDS to be done in SQL (not pl/sql in the stored procedure):

    Suppose that a phrase such as "Church of snowboarding."

    Can I divide this by using:
    Select regexp_substr ('church snowboard', ' [^] +', 1, level) word
    of the double
    connect regexp_substr ('church snowboard', ' [^] +', 1, level) is not NULL)

    now I have words 'showboard' and 'Church '.

    So far so good.

    Now I need for each of these words, to create a list of unique IDS collected using text oracle contains the query as follows: (pseudocode)
    for SPLIT.word in "snowboarding", "Church".
    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, SPLIT.word, 1) > 0
    UNION
    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, ' SYN('||)) SPLIT.word: ', GR_THESAURUS)', 1) > 0
    UNION
    SELECT 100 AS NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE NAME LIKE '% "| SPLIT.word | '%'

    so of course I have to untangle this UNION to remove duplicates

    Anyone here sees a way out of my situation? A way to make the loop in a select (use with and such) then
    Just add a select distinct NO_MATRC, NO_NOM_ from)

    I tried, but I'm out of ideas so I thought that some guru here might have the answer ;)

    Thanks in advance for any advice

    See you soon

    You might end up with something like the XML below, ideally as binding in the query.

    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, e
    Church of snowboard

    transform ((JETONS, "{", "}", "AND"))
    transform ((JETONS, "{", "}", "OR"))
    turn ((JETONS, «SYN (",", GR_THESAURUS) ', 'AND'))
    turn ((JETONS, «SYN (",", GR_THESAURUS) ', 'GOLD'))
    transform ((JETONS, «?)) {","} "," AND"))/seq >
    transform ((JETONS, «?)) {","} "," GOLD"))/seq >



    (1) > 0

  • How to find the Maxima and Minima for each column of a 2D array?

    Hello

    I have a 2D chart and I would find the maxima and minima of each column of the 2-D table. Even though I know how to get maxima and minima for the whole picture but don't know how columnwise? Any ideas please?

    Thank you

    Rohit

    Hello

    @Smercurio-What you said is true, I should have shown using automatic indexing enabled which is really excellent choice. I just tried to show in a very simple way.

    Anyway, here's the best way

  • Many storage spaces and data for each quarter of the year files

    Hello

    I am junior DBA and I have a question about tablespace partitioning or data file sharing.

    I have a database of 10g in many storage spaces, for example:

    KER_DATA_2009_Q1

    KER_DATA_2009_Q2

    KER_DATA_2009_Q3

    KER_DATA_2009_Q4

    KER_INDX_2009_Q1

    KER_INDX_2009_Q2

    KER_INDX_2009_Q3

    KER_INDX_2009_Q4

    There is also a data file for each tablespace that is mentioned.

    But for this year 2013, only two big storage space I can get one and data KER_DATA, KER_INDX files.

    All tables and indexes in the whole database are KER_DATA, KER_INDX, tablespaces.

    I don't know any cut in two storage spaces and means of data files. Is this something like tablespace partitioning? This can be done automatically or someone needed to do it manually on the end of each quarter?

    This should be done to improve performance, several small files data instead a large?

    Can some admin explain this to me?

    The reason for this separation of database/tablespace was partitioning. There are a lot of tables partitioned by date column, and there are partitions for each quarter of the year. There are tablespace with a data file for each quarter (partition).

  • Export a document to pg 6 and change a block of text on page 1 and 6th for each 50 times

    I have these 6 brochures page and there are 50 marketing codes that should be on the first and 6 pages (different codes for each exported document). Instead of manually changing the marketing codes on the 2 pages 50 times (which takes too much time), there must be an easy way to do it. No matter who came across this?

    On the data merge, instead of selecting "Create a merged Document", choose the option "export to PDF".

    It will merge all the results into a single combined PDF.

    To merge the files into a single page PDF is something that the software can not do this by default, but I wrote a piece about this elsewhere: http://colecandoo.wordpress.com/2013/07/13/breaking-up-is-hard-to-do-indesign-files-into-i individual PDF-that-is /

  • Cannot delete items in documents and data for each application

    I want to delete unnecessary files in several applications under general > use storage and iCloud > manage storage, but the section documents and data for the respective applications will not operate.

    I have it several times but it doesn't work.

    Can someone help me?

    Thanks in advance

    Omari says:

    I want to delete unnecessary files in several applications under general > use storage and iCloud > manage storage, but the section documents and data for the respective applications will not operate.

    I have it several times but it doesn't work.

    Explain what you do and what happens when you try to delete the data.

Maybe you are looking for

  • Stopped reached log - logging file size limit

    From time to time, quite often, a pop-up box appears on my screen and said: limit size of logfile reaches - logging stopped. I can only press the "Accept" button or close it, but it rises a little later. I have not found information on the web.

  • Transfer from Windows Media Player to Zip Sansa Clip

    In the end, I am creating playlists on my Sansa Clip Zip. So I think THAT I have to create a playlist in Windows Media Player and then sync my Sansa Clip Zip. For some reason any I am only able to see 5 playlists, but I know that I have created sever

  • stupid password

    How reset you your passward 8.1 on windows, because it is a new computer, I have no recollection of losing. I hoped to reset to factory settings, I can not get the uefi to boot from my USB drive, I am not computer savy

  • How to set the Image to the title screen

    Hi I'm new to BlackBerry Forum I want to put my screen as a background Image. How to write it? must use CustomeField? Thanks in advance.

  • Log of calls to Smartphones blackBerry email inbox? How to remove?

    HI - need help! In my blackberry email inbox, my call log also shows. This is annoying - how remove? Thank you