• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save the value of a Boolean variable

Explorer ,
May 26, 2016 May 26, 2016

Copy link to clipboard

Copied

How can I be saving the value of a Boolean variable, so that when I open the file, it can be with the settings in which I left?

I created the variable to the top of the frame:

var audio:Boolean = true;

And I added the conditions for the buttons:

if(audio == true) {

    Sound.play();

  }

But every time I have to open the application preference is reset to true, wanted to leave with that preference be saved in the case of boolean, true (on) or false (off).

can anybody help me? Please.

Thanks in advance!

TOPICS
ActionScript

Views

686

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 30, 2016 May 30, 2016

A sharedObject is still appropriate for a local application. The only reason to use anything else would be storage size requirements.

Votes

Translate

Translate
LEGEND ,
May 26, 2016 May 26, 2016

Copy link to clipboard

Copied

How / where is this application implemented?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 26, 2016 May 26, 2016

Copy link to clipboard

Copied

Hello Ned!

A button created from the addEventListener...

Let's say X button:

function X (Event:MouseEvent):void

{

     if(sound == true) {

         som = false; // bool

     }

     trace("mute")

}

Is something like this could help me?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 27, 2016 May 27, 2016

Copy link to clipboard

Copied

What I meant was... is this a web interface or a local application only on the user's machine?  For the web use a Shared Object.  For a local application you might want to look into utilizing a data file to store information you wish to retain

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 29, 2016 May 29, 2016

Copy link to clipboard

Copied

Local application, the second option in case.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 30, 2016 May 30, 2016

Copy link to clipboard

Copied

LATEST

A sharedObject is still appropriate for a local application. The only reason to use anything else would be storage size requirements.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 26, 2016 May 26, 2016

Copy link to clipboard

Copied

Use the SharedObject class.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines