SharedObject

I did so:
AS3::ui::flash::net::SharedObject so = AS3::ui::flash::net::SharedObject::getLocal("someLSO");
TypeError: Error #1006: value is not a function.
and
inline_as3(
          "import com.adobe.flascc.CModule;\n"
          "import flash.net.SharedObject;\n"
          "import flash.net.SharedObjectFlushStatus;\n"
        "var so:SharedObject = SharedObject.getLocal(\"someLSO\");\n"
Error: Type was not found or was not a compile-time constant: SharedObject.
How to get the "SharedObject"?
That need for listening "FlushStatus"

I use LSO VFS but i don't know how to subsribe to an event "SharedObject.Flush.Failed" if my data more 100kb.
twistedjoe wrote:
You need to compile every file with a -emit-swf or -emit-swc else you'll get this: "Type was not found or was not a compile-time constant" error.
I compile with -emit-swf and if I do
inline_as3(
    "import flash.utils.ByteArray;\n"
    "var data:ByteArray = new ByteArray();\n"
app work fine, if i trying work with "SharedObject" i have error Type was not found

Similar Messages

  • Problem with SharedObject in AIR 3.5 IOS

    Hi,
    I've been compiling my ios app with AIR 3.4 since it has been released and a week ago I downloaded AIR 3.5 and uploaded my app compiled with AIR 3.5. But I realized there has been a problem with sharedobject in AIR 3.5.
    I used var sharedObject:SharedObject = SharedObject.getLocal("myScores"); this code to save the game score and every time I uploaded my app it worked out. It has never lose the game score.
    But with AIR 3.5 all game scores are gone. I didn't change any code about sharedobject. What's going on here? Now my customers will be upset to losing their information and even money they purchased through in-app purchase.
    The thing is AIR 3.4 was fine but AIR 3.5 seems to be the problem.
    Please HELP ME!!

    We also replied in the bug report.
    It is a really serious problem.
    We experienced it also in AIR 3.7.
    It is only happening on iOS. Android works fine.
    It happens with these both methods:
    var mySharedObject:SharedObject = SharedObject.getLocal("deutscheWitze");
    FlexGlobals.topLevelApplication.persistenceManager.setProperty("soundCheck", "yes");
    Only some users experience the problem.
    We think it has something to do with the compilation or installation of the app.
    Best
    omi

  • SharedObject and Caching issues

    Background:
         I am working on a project where I am using sharedObject to store data for a favorites list. The project contains 2 swfs, one in AS 3.0 (using Flex 4.5) and the other an AS 2.0 flash 8 project.  Basically the AS 2.0 project read and writes data to the shared object and the AS 3.0 project just reads the data.
    Setup:
         OS: Windows 7
         Flash Player: 10.3     Browsers: IE 9, IE 8, Chrome 14, and some misc Firefox testing -- Chrome seems to be working the best.  
    Problems:
         First off it has been extremely hard to get consistent results across different computers so if anyone has a suggestion as to why that would be (other than different browsers, different flash player versions, different flash player settings/global settings and different OS versions) because I have been making sure all that stuff is consistent across devices for testing purposes.
         1. It appears that some computers/browers won't store the shared object at all even though everything to allow it is turned on.
         2. Some computers/browsers will store it, but won't update until I refresh the page
    General Questions:
         1. Is the storage of sharedObject object data in a .sol file configured the same in both AS 2.0 and AS 3.0 and if so, would this be a means of communicating between two swfs running off the same domain?
         2. Is it possible to have a browser cache sharedObject data(the .sol file)?
          3. I have noticed as new flash player releases are coming out(especially recently i.e. 10.3) I have had to make a lot of repairs to the actionscipt 2 stuff.  Is actionscript 2 support slowly being phased out? Is anyone else experiencing the same problems? 
    Possible Solutions/Findings:
         I am starting to believe that it has something to do with browser caching since Chrome seems to perform the best and Chrome has performed best when it comes to browser caching issues.
    ** code is available if needed but since it was working before I don't think it is relevant.

    Hello,
    #1
    are you using explicit call to flush method immediately afer you're writing data to reference to SharedObject?
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject. html#flush()
    If not you could have different data read by different browsers sessions run at the same time (e.g. IE/FireFox both hosting your test Flash movies) - as data are flushed only when given Flash runtime session is to be terminated (e.g. movie is to be unloaded) and in other cases as outlined in documentation.
    #2
    the SharedObject is reference to binary file stored on local machine by Flash runtime (Air runtime too). It has nothing similar to web-fetched content to be cached:
    http://en.wikipedia.org/wiki/Local_Shared_Object
    regards,
    Peter

  • SharedObjects environment value not updating properly in clustered environment

    Hi All,
    I have clustered UCM having two nodes. I have custom scheduler running every 5 minutes which updates some value in SharedObjects environment. I am using following code:
    SharedObjects.putEnvironmentValue("param", "val");
    the problem is that this value is updated only in one node. If Node1 picks up the scheduler job, then the value is updated only on Node1.
    Next time when Node2 picks up the scheduler job, Node2 does have have updated value and my application fails.
    Any idea why it is happening. How can I fix this issue?
    Thanks

    Hi All,
    I have clustered UCM having two nodes. I have custom scheduler running every 5 minutes which updates some value in SharedObjects environment. I am using following code:
    SharedObjects.putEnvironmentValue("param", "val");
    the problem is that this value is updated only in one node. If Node1 picks up the scheduler job, then the value is updated only on Node1.
    Next time when Node2 picks up the scheduler job, Node2 does have have updated value and my application fails.
    Any idea why it is happening. How can I fix this issue?
    Thanks

  • AS3.0 Need to Store Radio Button Value  as SharedObject

    I am under a tight deadline. Friday Aug.22!!! I am trying to
    store the value of a radio button (in a group for yes/no) when a
    'Next" button is pressed. I have a nextBtn.addEventListener(...) to
    contain a function which holds code to store the value of each
    radio button on the page into its own SharedObject. As such:
    _so.data.DrugName1 = DrugName1.selected;
    I do not know the AS3.0 code to get the value of the selected
    radio button in a grouping and then to use that value and store it
    into the SharedObject _so.data I have been banging my head for
    days. I fear I keep trying to use AS2 code for an AS3 project.
    AAAAAhhhhhhhh!
    Can someone please help me determine the value or data of a
    radio button or radio button group. Is it "selected" or
    "selectedData" or "getValue()" or "value" or "data" or what ??????
    I don't know where else to turn. :(
    alexdove at comcast.net
    Please email direct if you can help. I'll be sure to re-post
    a solution once I get it.
    Thank you in advance.
    Alex Dove

    FlashTastic, thanks for the reply. I entered the code but I
    cannot get the values to repopulate in the page when I return. I
    try to put the SharedObject data of the radio button back into the
    button on the page but it will not take. Here is my code:
    //*************code in page to load SharedObject value back
    into radio button when the page loads if a value
    exists*****************
    if((HumiraY_Row1.selected == false) &&
    (_so.data.HumiraY_Row1 != null)){HumiraY_Row1.selected = true;}
    if((HumiraN_Row1.selected == false) &&
    (_so.data.HumiraN_Row1 != null)){HumiraN_Row1.selected = true;}
    //******** Here is when the Next button is pushed to save the
    data***
    nextBtn2.addEventListener(MouseEvent.CLICK,
    mouseDownHandler2);
    function mouseDownHandler2(event:MouseEvent):void {
    if(HumiraY_Row1.selected == true){_so.data["HumiraY_Row1"] =
    HumiraY_Row1.selected;}
    if(HumiraN_Row1.selected == true){_so.data["HumiraN_Row1"] =
    HumiraN_Row1.selected;}
    Still stuck. Look forward to another post. :)
    Alex

  • Update a sharedobject again

    I'm wondering if everytime I use the function shareobject.setProperty("atribute",value) the event onSync is call , I meant this event work everytime a sharedobject it's update and a sharedobject is update with the function setProperty(),,,
    my point is that I'm using the function setProperty() to update a sharedobject everytime my event mousemove it's call and the answer is that not everytime I update the sharedobject the event onSync it's call..

    I'm wondering if everytime I use the function shareobject.setProperty("atribute",value) the event onSync is call , I meant this event work everytime a sharedobject it's update and a sharedobject is update with the function setProperty(),,,
    my point is that I'm using the function setProperty() to update a sharedobject everytime my event mousemove it's call and the answer is that not everytime I update the sharedobject the event onSync it's call..

  • SharedObject persisting between browser tabs

    I'm building an online app which opens a SharedObject at its onset to do various things, one being remember whether a user has performed a certain action(vote) before because he/she is only permitted to perform this action once. This is all working fine, until our users began opening a new tab before voting.
    If the user opens a new tab, and open the same application, this app(tab 2) needs to know if subsequently the user votes in tab 1. I thought this would be straightforward to resolve. However - for some reason, the sharedObject in tab 2 does not seem to update with updates in tab 1... if you were to refresh tab 2, it would have the updates, but while it is open, the data in the sharedobject does not seem to update.
    It all works fine in general, the only time it doesn't is when there are two instances of a flash object open at the same time using the shared object. Maybe this is expected behaviour, and two flash objects can not use the same local sharedObject? It's hard to find this info in the livedocs.
    This is the sort of code I am using to manage the SharedObject: (I know the first question anyone will have is, are you the flushing the object after setting your variable, the answer is yes!)
    // i call this function at the beginning of the app
    public function init(sharedObjectName:String):void
         sharedObject = SharedObject.getLocal(sharedObjectName,"/");
    public function getVariable(varName:String):String {
         if (sharedObject.data.hasOwnProperty(varName)) {
              return(sharedObject.data[varName]);
         } else {
              return('');
    public function setVariable(varName:String,varContents:String):void {
         sharedObject.setProperty(varName,varContents);
         sharedObject.flush();

    Thanks kglad, but unfortunately I had actually tried that out and it didn't help:
    public function init(sharedObjectName:String):void
         sharedObject = SharedObject.getLocal(sharedObjectName,"/");
         soName=sharedObjectName;
    public function getVariable(varName:String):String {
         init(soName);
         if (sharedObject.data.hasOwnProperty(varName)) {
              return(sharedObject.data[varName]);
         } else {
              return('');
    public function setVariable(varName:String,varContents:String):void {
         sharedObject.setProperty(varName,varContents);
         sharedObject.flush();

  • How do you actually SHARE a SharedObject?

    Hi, I'm writing an application in HTML / Javascript that has multiple (web) pages.  According to the documentation, all pages served from the application directory are part of the same "domain" (i.e. the same sandbox).  However, whenever I use the Local Store / SharedObjects, a new and different SharedObject is created FOR EACH PAGE!
    How do I change / fix this behavior?  What am I missing?  Why is each page being treated as a completely separate domain/sandbox?
    E.g. (on the mac)
    com.mydomain.apptest/
    /Local Store
    /#SharedObjects
    /index.html
    myLSO.sol
    /newpage.html
    myLSO.sol
    Why are there TWO myLSO.sol's?  Why isn't myLSO.sol under the com.mydoman.apptest/Local Store/#SharedObjects?
    Using app:/index.html in the url for loading the page made no difference.  Each page is navigated to with a standard anchor (just like a website)
    <a href="newpage.html">Newpage</a>
    I want to be able to share information across the pages, like a multipart form.  I could do this with session variables in a php app, but with Adobe AIR, on each page load I lose everything from the other pages.  This is very frustrating.
    I'm using Apatana Studio for development with Air 2.0?
    Thanks for any help or insight.

    I've been trying to figure this out as well, did you ever get anywhere with this?
    ~Bill

  • Using SharedObject between multiple apps

    Assuming I own and have access to two different apps' SharedObject variables ... is it possible to save settings from Game A and have it be remembered in Game B?
    Essentially, I'm just trying to bring settings from a "Lite" version of a game and if users choose to purchase and install the "Full" version, all of their settings from the "Lite" version will be remembered, saving them some hassle.
    Is this possible? Or is there a better way altogether that I just don't know about? Thanks!

    I think SharedObjects can only be seen by the app that created them. If you find otherwise, please let me know!
    I also wanted to share saved data from a lite game and a full game, but I think I would have had to use SQLite to achieve this.
    In the end I just set some of the early levels of the full version to be unlocked by default.

  • Sharing SharedObjects between multiple .swfs

    Relatively simple problem; I have a project that I think may be more manageable if I break it up into multiple small .swf files rather than having a gargantuan mega .swf.
    Now, I know that I could use a root .swf and load data from the others, but I think that it'll be a lot easier to debug and update if I'm using separate self-contained .swfs, so this is the direction I'm currently investigating.
    However, the .swfs won't really work unless I can have user-data persist between them, so I'm wondering if I can load a SharedObject saved by another .swf file? Are there any important caveats that I need to be aware of?
    In particular, can anyone give me sample code that would allow me to do this with both an online and offline copy of the files; i.e - if I run the same set of .swfs from haravikk.com, and locally, I want them to still be able to share data with one-another. In this case though I won't need to worry about sharing data between a local copy and haravikk.com, just so long as the files themselves can pass data within whatever domain they're loaded it should be fine.

    To do this I still need to make sure that all .swfs are retrieving/flushing their SharedObjects to the same domain though, right?
    I'm curious, is there a good way to work out what the right domain is dynamically?
    For example; say I have "Menu.swf", and "About.swf", both store in the same folder "MySite", so the files are located at "MySite/Menu.swf" and "MySite/About.swf" respectively. To avoid tying the files to a particular domain-name (so it can still work offline) I'd like to grab the current location of the .swf, and remove the file-name so that I have a domain containing just the enclosing folder.
    Is there a best way to do this? Basically so I can have my .swf files using a consistent domain for storing/saving, while still supporting relocating the files, so they will work offline if I copy them to my local machine for example.

  • Using SharedObjects to load and save data

    Hello, i am having troubles with using shared objects to save and load data for my highscore feature of my game i am developing in actionscript 3. This is my main code.
    I am trying to update a dynamic text field that acts as an high score function
    [as]
    package
              // initialize;
              import flash.display.MovieClip;
              import flash.utils.Timer;
              import flash.events.TimerEvent;
              import flash.ui.Mouse;
              import flash.events.KeyboardEvent;
              import flash.ui.Keyboard;
              import flash.events.Event;
              import flash.media.SoundChannel;
              import flash.net.SharedObject;
              import flash.text.TextField;
              import flash.display.Stage;
              import flash.events.ProgressEvent;
              public class Game extends MovieClip
                        public static var _stage:Stage;
                        static var so:SharedObject;
                        static var ship:MovieClip;
                        static var healthMeter:HealthMeter;
                        static var score:Score;
                        static var highScore:HighScore;
                        static var enemyShipTimer:Timer;
                        static var gameOverMenu:GameOverMenu;
                        static var startMenu:StartMenu;
                        static var helpMenu:HelpMenu;
                        static var startButton:StartButton;
                        static var returnButton:ReturnButton;
                        static var helpButton:HelpButton;
                        static var pauseButton:PauseButton;
                        static var playButton:PlayButton;
                        static var mainMenuButton:MainMenuButton;
                        public var currentValue:Number;
                        public var loadingProgress:LoadingProgress;
                        public function Game()
                                  loadingProgress = new LoadingProgress();
                                  loadingProgress.x = 550;
                                  loadingProgress.y = 500;
                                  addChild( loadingProgress );
                                  loaderInfo.addEventListener( Event.COMPLETE, onCompletelyDownloaded );
                                  loaderInfo.addEventListener( ProgressEvent.PROGRESS, onProgressMade );
                        public function showMenuScreen():void
                                  _stage = this.stage;
                                  Key.initialize(stage);
                                  ship = new Ship();
                                  healthMeter = new HealthMeter();
                                  var score:Score = new Score();
                                  var highScore:HighScore = new HighScore();
                                  so = SharedObject.getLocal("scores");
                                  if (so.data.score)
                                            highScore.bestScore.text = so.data.score.toString();
                                  else
                                            highScore.bestScore.text = "0";
                                  addChild(score);
                                  addChild(highScore);
                                  gameScore.visible = false;
                                  bestScore.visible = true;
                                  healthMeter.x = 2.5;
                                  healthMeter.y = 576;
                                  gameOverMenu = new GameOverMenu();
                                  gameOverMenu.x = 217;
                                  gameOverMenu.y = 244;
                                  addChild(gameOverMenu);
                                  gameOverMenu.visible = false;
                                  helpMenu = new HelpMenu();
                                  helpMenu.x = 480;
                                  helpMenu.y = 312;
                                  addChild(helpMenu);
                                  helpMenu.visible = false;
                                  returnButton = new ReturnButton();
                                  returnButton.x = 54;
                                  returnButton.y = 52;
                                  addChild(returnButton);
                                  returnButton.visible = false;
                                  gameOverMenu.playAgainButton.addEventListener("mouseDown", newGame);
                                  startMenu = new StartMenu();
                                  mainMenuButton = new MainMenuButton();
                                  startButton = new StartButton();
                                  helpButton = new HelpButton();
                                  startMenu.x = 151;
                                  startMenu.y = 111;
                                  startButton.x = 93;
                                  startButton.y = 426;
                                  helpButton.x = 631;
                                  helpButton.y = 386;
                                  mainMenuButton.x = 656;
                                  mainMenuButton.y = 483;
                                  addChild(mainMenuButton);
                                  mainMenuButton.visible = false;
                                  stage.addChildAt(startMenu, 0);
                                  addChild(startButton);
                                  addChild(helpButton);
                                  startMenu.visible = true;
                                  startButton.visible = true;
                                  helpButton.visible = true;
                                  startMenu.visible = true;
                                  startButton.addEventListener("mouseDown", newGame);
                                  helpButton.addEventListener("mouseDown", helpGame);
                                  mainMenuButton.addEventListener("mouseDown", mainMenu);
                                  returnButton.addEventListener("mouseDown", mainMenu2);
                                  pauseButton = new PauseButton();
                                  pauseButton.x = 896;
                                  pauseButton.y = 63;
                                  pauseButton.addEventListener("mouseDown", PauseGame);
                                  playButton = new PlayButton();
                                  playButton.x = 896;
                                  playButton.y = 63;
                                  addChild(playButton);
                                  playButton.visible = false;
                                  playButton.addEventListener("mouseDown", PlayGame);
                        static function gameOver()
                                  scoreF();
                                  mainMenuButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  gameOverMenu.visible = true;
                                  enemyShipTimer.stop();
                                  for (var i in EnemyShip.list)
                                            EnemyShip.list[i].kill();
                                  ship.takeDamage(-ship.maxHealth);
                        function newGame(e:Event)
                                  addEventListener(Event.DEACTIVATE, PauseGame);
                                  bestScore.visible = false;
                                  gameScore.visible = true;
                                  addChild(pauseButton);
                                  addChild(healthMeter);
                                  addChild(mainMenuButton);
                                  enemyShipTimer = new Timer(750);
                                  enemyShipTimer.addEventListener("timer", sendEnemy);
                                  addChild(ship);
                                  healthMeter.visible = true;
                                  startMenu.visible = false;
                                  mainMenuButton.visible = false;
                                  startButton.visible = false;
                                  healthMeter.visible = true;
                                  pauseButton.visible = true;
                                  playButton.visible = false;
                                  gameOverMenu.visible = false;
                                  helpButton.visible = false;
                                  ship.visible = true;
                                  ship.x = 367;
                                  ship.y = 542;
                                  enemyShipTimer.start();
                                  currentValue = 0;
                                  updateDisplay();
                        function mainMenu(e:Event)
                                  removeEventListener(Event.DEACTIVATE, PauseGame);
                                  bestScore.visible = true;
                                  gameScore.visible = false;
                                  removeChild(mainMenuButton);
                                  removeChild(ship);
                                  healthMeter.visible = false;
                                  startMenu.visible = true;
                                  mainMenuButton.visible = false;
                                  startButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  playButton.visible = false;
                                  ship.takeDamage(ship.maxHealth);
                                  gameOverMenu.visible = false;
                                  helpButton.visible = true;
                                  returnButton.visible = false;
                        function mainMenu2(e:Event)
                                  bestScore.visible = true;
                                  gameScore.visible = false;
                                  healthMeter.visible = false;
                                  startMenu.visible = true;
                                  mainMenuButton.visible = false;
                                  startButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  playButton.visible = false;
                                  gameOverMenu.visible = false;
                                  helpButton.visible = true;
                                  returnButton.visible = false;
                                  helpMenu.visible = false;
                        function PauseGame(e:Event)
                                  enemyShipTimer.removeEventListener("timer", sendEnemy);
                                  stage.frameRate = 0;//
                                  pauseButton.visible = false;
                                  playButton.visible = true;
                        function PlayGame(e:Event)
                                  enemyShipTimer.addEventListener("timer", sendEnemy);
                                  stage.frameRate = 30;//
                                  pauseButton.visible = true;
                                  playButton.visible = false;
                        function helpGame(e:Event)
                                  startMenu.visible = false;
                                  startButton.visible = false;
                                  helpButton.visible = false;
                                  helpMenu.visible = true;
                                  returnButton.visible = true;
                        function sendEnemy(e:Event)
                                  var enemy = new EnemyShip();
                                  stage.addChildAt(enemy, 0);
                                  addToValue(1);
                        function addToValue( amountToAdd:Number ):void
                                  currentValue = currentValue + amountToAdd;
                                  updateDisplay();
                        static function scoreF():void
                                  if (so.data.score)
                                            if (getFinalScore()>so.data.score)
                                                      so.data.score = getFinalScore();
                                                      so.flush();
                                  else
                                            so.data.score = getFinalScore();
                                            so.flush();
                        function updateDisplay():void
                                  if (currentValue>Number(highScore.bestScore.text))
                                            scoreF();
                                            highScore.bestScore.text = currentValue.toString();
                                  TextField(gameScore.getChildByName("scoreDisplay")).text = currentValue.toString();
                                  TextField(bestScore.getChildByName("bestScore")).text = highScore.bestScore.text;
                                  loadingProgress.percentDisplay.text = currentValue.toString();
                        static function getFinalScore()
                                  _stage;
                                  return;
                                  gameScore.currentValue;
                        public function onCompletelyDownloaded( event:Event ):void
                                  gotoAndStop(3);
                                  showMenuScreen();
                        public function onProgressMade( progressEvent:ProgressEvent ):void
                                  setValue( Math.floor( 100 * loaderInfo.bytesLoaded / loaderInfo.bytesTotal ) );
                        public function setValue( amount:Number ):void
                                  currentValue = amount;
                                  updateDisplay();
    [/as]
    when i run this, it crashes with this error.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at Game/updateDisplay()[C:\Users\Ben\Desktop\SFUR\Game.as:329]
              at Game/setValue()[C:\Users\Ben\Desktop\SFUR\Game.as:356]
              at Game/onProgressMade()[C:\Users\Ben\Desktop\SFUR\Game.as:351]
    help would be greatly appreciated.
    if you need any more details please ask.
    Line 329:  if (currentValue>Number(highScore.bestScore.text))
    Line 356:  updateDisplay();
    Line 351:
    setValue( Math.floor( 100 * loaderInfo.bytesLoaded / loaderInfo.bytesTotal ) );
    -Ben

    Ok, i have changed my classes a bit to try and fix the issue. I found a tutorial online called MJW avoider game or something and so i split some of my code in to seperate classes. But now the score doesnt update. I have fixed the loading issue (hopefully) i can access the main menu etc... but the highscore doesnt show at all after a game. Here are my classes.
    Document class (Game.as)
    package
              // initialize;
              import flash.display.MovieClip;
              import flash.utils.Timer;
              import flash.events.TimerEvent;
              import flash.ui.Mouse;
              import flash.events.KeyboardEvent;
              import flash.ui.Keyboard;
              import flash.events.Event;
              import flash.media.SoundChannel;
              import flash.net.SharedObject;
              import flash.text.TextField;
              import flash.display.Stage;
              import flash.events.ProgressEvent;
              public class Game extends MovieClip
                        public static var _stage:Stage;
                        static var so:SharedObject;
                        static var ship:MovieClip;
                        static var healthMeter:HealthMeter;
                        static var score:Score;
                        static var enemyShipTimer:Timer;
                        static var gameOverMenu:GameOverMenu;
                        static var startMenu:StartMenu;
                        static var helpMenu:HelpMenu;
                        static var startButton:StartButton;
                        static var returnButton:ReturnButton;
                        static var helpButton:HelpButton;
                        static var pauseButton:PauseButton;
                        static var playButton:PlayButton;
                        static var mainMenuButton:MainMenuButton;
                        public var currentValue:Number;
                        public var loadingProgress:LoadingProgress;
                        static var highScore:HighScore;
                        public function Game()
                                  loadingProgress = new LoadingProgress();
                                  loadingProgress.x = 550;
                                  loadingProgress.y = 500;
                                  addChild( loadingProgress );
                                  loaderInfo.addEventListener( Event.COMPLETE, onCompletelyDownloaded );
                                  loaderInfo.addEventListener( ProgressEvent.PROGRESS, onProgressMade );
                        public function showMenuScreen():void
                                  removeChild( loadingProgress );
                                  _stage = this.stage;
                                  highScore = new HighScore();
                                  ship = new Ship();
                                  healthMeter = new HealthMeter();
                                  var score:Score = new Score();
                                  so = SharedObject.getLocal("scores");
                                  if (so.data.score)
                                            highScore.bestScore.text = so.data.score.toString();
                                  else
                                            highScore.bestScore.text = "0";
                                  addChild(score);
                                  addChild(highScore);
                                  gameScore.visible = false;
                                  bestScore.visible = true;
                                  healthMeter.x = 2.5;
                                  healthMeter.y = 576;
                                  gameOverMenu = new GameOverMenu();
                                  gameOverMenu.x = 217;
                                  gameOverMenu.y = 244;
                                  addChild(gameOverMenu);
                                  gameOverMenu.visible = false;
                                  helpMenu = new HelpMenu();
                                  helpMenu.x = 480;
                                  helpMenu.y = 312;
                                  addChild(helpMenu);
                                  helpMenu.visible = false;
                                  returnButton = new ReturnButton();
                                  returnButton.x = 54;
                                  returnButton.y = 52;
                                  addChild(returnButton);
                                  returnButton.visible = false;
                                  gameOverMenu.playAgainButton.addEventListener("mouseDo wn", newGame);
                                  startMenu = new StartMenu();
                                  mainMenuButton = new MainMenuButton();
                                  startButton = new StartButton();
                                  helpButton = new HelpButton();
                                  startMenu.x = 151;
                                  startMenu.y = 111;
                                  startButton.x = 93;
                                  startButton.y = 426;
                                  helpButton.x = 631;
                                  helpButton.y = 386;
                                  mainMenuButton.x = 656;
                                  mainMenuButton.y = 483;
                                  addChild(mainMenuButton);
                                  mainMenuButton.visible = false;
                                  stage.addChildAt(startMenu, 0);
                                  addChild(startButton);
                                  addChild(helpButton);
                                  startMenu.visible = true;
                                  startButton.visible = true;
                                  helpButton.visible = true;
                                  startMenu.visible = true;
                                  startButton.addEventListener("mouseDown", newGame);
                                  helpButton.addEventListener("mouseDown", helpGame);
                                  mainMenuButton.addEventListener("mouseDown", mainMenu);
                                  returnButton.addEventListener("mouseDown", mainMenu2);
                                  pauseButton = new PauseButton();
                                  pauseButton.x = 896;
                                  pauseButton.y = 63;
                                  pauseButton.addEventListener("mouseDown", PauseGame);
                                  playButton = new PlayButton();
                                  playButton.x = 896;
                                  playButton.y = 63;
                                  addChild(playButton);
                                  playButton.visible = false;
                                  playButton.addEventListener("mouseDown", PlayGame);
                        static function gameOver()
                                  scoreF();
                                  mainMenuButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  gameOverMenu.visible = true;
                                  enemyShipTimer.stop();
                                  for (var i in EnemyShip.list)
                                            EnemyShip.list[i].kill();
                                  ship.takeDamage(-ship.maxHealth);
                        function newGame(e:Event)
                                  addEventListener(Event.DEACTIVATE, PauseGame);
                                  bestScore.visible = false;
                                  gameScore.visible = true;
                                  addChild(pauseButton);
                                  addChild(healthMeter);
                                  addChild(mainMenuButton);
                                  enemyShipTimer = new Timer(750);
                                  enemyShipTimer.addEventListener("timer", sendEnemy);
                                  addChild(ship);
                                  healthMeter.visible = true;
                                  startMenu.visible = false;
                                  mainMenuButton.visible = false;
                                  startButton.visible = false;
                                  healthMeter.visible = true;
                                  pauseButton.visible = true;
                                  playButton.visible = false;
                                  gameOverMenu.visible = false;
                                  helpButton.visible = false;
                                  ship.visible = true;
                                  ship.x = 367;
                                  ship.y = 542;
                                  enemyShipTimer.start();
                                  currentValue = 0;
                                  updateDisplay();
                        function mainMenu(e:Event)
                                  removeEventListener(Event.DEACTIVATE, PauseGame);
                                  bestScore.visible = true;
                                  gameScore.visible = false;
                                  removeChild(mainMenuButton);
                                  removeChild(ship);
                                  healthMeter.visible = false;
                                  startMenu.visible = true;
                                  mainMenuButton.visible = false;
                                  startButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  playButton.visible = false;
                                  ship.takeDamage(ship.maxHealth);
                                  gameOverMenu.visible = false;
                                  helpButton.visible = true;
                                  returnButton.visible = false;
                        function mainMenu2(e:Event)
                                  bestScore.visible = true;
                                  gameScore.visible = false;
                                  healthMeter.visible = false;
                                  startMenu.visible = true;
                                  mainMenuButton.visible = false;
                                  startButton.visible = true;
                                  healthMeter.visible = false;
                                  pauseButton.visible = false;
                                  playButton.visible = false;
                                  gameOverMenu.visible = false;
                                  helpButton.visible = true;
                                  returnButton.visible = false;
                                  helpMenu.visible = false;
                        function PauseGame(e:Event)
                                  enemyShipTimer.removeEventListener("timer", sendEnemy);
                                  stage.frameRate = 0;//
                                  pauseButton.visible = false;
                                  playButton.visible = true;
                        function PlayGame(e:Event)
                                  enemyShipTimer.addEventListener("timer", sendEnemy);
                                  stage.frameRate = 30;//
                                  pauseButton.visible = true;
                                  playButton.visible = false;
                        function helpGame(e:Event)
                                  startMenu.visible = false;
                                  startButton.visible = false;
                                  helpButton.visible = false;
                                  helpMenu.visible = true;
                                  returnButton.visible = true;
                        function sendEnemy(e:Event)
                                  var enemy = new EnemyShip();
                                  stage.addChildAt(enemy, 0);
                                  addToValue(1);
                        static function scoreF():void
                                  if (so.data.score)
                                            if (getFinalScore()>so.data.score)
                                                      so.data.score = getFinalScore();
                                                      so.flush();
                                  else
                                            so.data.score = getFinalScore();
                                            so.flush();
                        function updateDisplay():void
                                  if (currentValue>Number(highScore.bestScore.text))
                                            scoreF();
                                            Game.highScore.bestScore.text = currentValue.toString();
                                  TextField(gameScore.getChildByName("scoreDisplay")).te xt = currentValue.toString();
                                  loadingProgress.percentDisplay.text = currentValue.toString();
                        static function getFinalScore()
                                  _stage;
                                  return;
                                  gameScore.currentValue;
                        public function addToValue( amountToAdd:Number ):void
                                  currentValue = currentValue + amountToAdd;
                                  updateDisplay();
                        public function onCompletelyDownloaded( event:Event ):void
                                  gotoAndStop(3);
                                  showMenuScreen();
                        public function onProgressMade( progressEvent:ProgressEvent ):void
                                  loadingProgress.setValue( Math.floor( 100 * loaderInfo.bytesLoaded / loaderInfo.bytesTotal ) );
    Counter Class (Counter.as)
    package
              import flash.display.MovieClip;
              public class Counter extends MovieClip
                        public var currentValue:Number;
                        public function Counter()
                                  reset();
                        public function addToValue( amountToAdd:Number ):void
                                  currentValue = currentValue + amountToAdd;
                                  updateDisplay();
                        public function setValue( amount:Number ):void
                                  currentValue = amount;
                                  updateDisplay();
                        public function reset():void
                                  currentValue = 0;
                                  updateDisplay();
                        public function updateDisplay():void
    LoadingProgress class (LoadingProgress.as)
    package
              import flash.text.TextField;
              public class LoadingProgress extends Counter
                        public function LoadingProgress()
                                  super();
                        override public function updateDisplay():void
                                  super.updateDisplay();
                                  percentDisplay.text = currentValue.toString();
    There not all my classes, but they are the classes where the errors are coming from.
    Please remember i am an actionscript noob
    Thanks again, Nacho

  • SharedObject.getRemote secure true or false?

    Hello,
    I've been looking for answers to a problem that we are having in my project and it has been imposible to find something clear.
    Actually we have a Flash movie which is connecting to a Flash Media Server to record audio.
    We were using this
    rec_so = SharedObject.getRemote("recordings", conection.uri, true);
    to get the instance and then
    rec_so.connect(conection);
    to connect.
    We were having no problems and we  have been around 4 years working like this. From a week ago more or less this connection is not working, I tried to change the parameter "secure" to false:
    rec_so = SharedObject.getRemote("recordings", conection.uri, false);
    and then it worked.
    I took a look and this parameter theoretically should be used for SWFs under HTTPS connection, what is curious is that we haven't had HTTPs connection never, maybe the fact to use this parameter was not correct at the beginning and I was wondering why it was working before and why is not working now?
    Thank you very much for your help and greetings,

    the 3rd parameter is a persistance parameter, not the secure parameter (which is 4th and defaults to false).
    persistence:Object [optional] — Specifies whether the attributes of the shared object’s data property are persistent locally,       remotely, or both. May specify where the shared object will be stored locally. Acceptable values are:      
    null or false specifies that the shared object is not persistent on the client or server; the default      
    true specifies that the shared object is persistent only on the server      
    full or partial local path to the shared object indicates that the shared object is persistent on       the client and the server. On the client, it is stored in the specified path. On the server, it is stored in a subdirectory within the Flash Media Server applications directory. For more information, see the Flash Media Server documentation.      

  • Store a custom class in SharedObject

    According to the documentation I can do this. Flash 8.
    import myClass;
    var myObject:Object ;
    myObject = new myClass();
    Then I add in data via methods.
    Then I do this:
    var mySO:SharedObject = SharedObject.getLocal("mySO");
    mySO.theClass = myObject;
    mySO.flush();
    Now when I try to get it out again:
    theObject = mySO.theClass
    it comes up blank and won't work.
    Anybody can tell me how to pull this one off? Is it possible
    even?

    It won't work. Flash does not support saving properties of a
    Object. You can save first level of the Object, not it's methods
    and properties.

  • Storing an Array in a SharedObject

    Hello again, kind and helpful people lol
    I'm currently working towards using a SharedObject to store a player's stats in a game, such as total time played, etc and was wondering if it was possible to create an Array in the shared object in order to group collections of similar data? If so then how would I go about initializing it?
    Would this work?
    var mySharedObject = SharedObject.getLocal("sharedObjectName");
    if(!mySharedObject.data.arrayName)
    mySharedObject.data.arrayName = new Array();
    mySharedObject.data.arrayName[0] = 0;
    If so then that's a lot easier than I was expecting it to be! Thanks in advance for any feedback/advice

    Yes, that should work - and if you look in the Help for the data property of the SharedObject class,
    you will see there's an example using an array just like you're showing.

  • Error 1061 - SharedObjects

    Hello to all, I'm having some serious problems with
    SharedObjects in Flex, when I try to call the method getLocal()
    from a SharedObject it shows se following error message:
    1061: Call to a possibly undefined method clear through a
    reference with static type SharedObject.
    Here are the lines that throws the error:
    public var sharedObj:SharedObject;
    sharedObj = SharedObject.getLocal("myTasks");
    I'm using Flex Builder 3 trial, Flash Player 10 ActiveX and
    the latest 3.2.0 SDK.
    Please anyone has some clue of what may be happening??
    Thanks for your attention!

    Hi rtalton, i got the SharedObject example from the Flex
    Builder Help, you can see the full code here:
    http://learn.adobe.com/wiki/display/Flex/Shared+Objects
    I just copied and pasted in a new flex project.
    There is a sharedObject.clear() method in the
    deleteSavedTasks() function, but it didn't prevented the error... I
    don't know if it's about the sdk, the flex IDE, the flash player...
    Thanks for your help!

  • Sharing SharedObjects between Classes

    I have created a varable of Shared Object inside the Document Class
         EXAMPLE -> var so:SharedObject = SharedObject.getLocal("Barns","/");
    but inside of a movieclip class I have
         if(so.data.adams == "yes"){
              adamsHighlight.visble = true}
    and I get an error
    E:\Android 2.0\ohioMap.as, Line 12
    1120: Access of undefined property so.
    what am i missing here. I thought if it was public, it is shared throughout the project
    sorry new to classes.

    it is but so is not defined in your movieclip class unless you use:
    var so:SharedObject=SharedObject.getLocal("Barns","/");
    now, the so in your document class and in your movieclip class reference the same object.  eg,
    //doc class
    so.data.testvar="hi";
    //movieclip class
    trace(so.data.testvar);  // should trace 'hi'

Maybe you are looking for

  • Brand new Mac customer-should I get Lion?

    Hi everyone, I'm writing because I'm looking for support.  I just recently bought my first iMac (it was between this or a Mini) after having my 4th PC die on me in 10 years.  While I already have the machine ordered I have been doing extensive resear

  • Opening MS Excel file in MS Excel

    Hi, I'm trying to open an MS Excel file in Excel using Java. I've searched the forums for the answer to my question, but with no luck. I'm using the Runtime.exec() method, and have read the API but I think I may be a little confused on how to use it

  • WiFI extremely slow in Arch

    I have a new install of Arch after deciding to give it a go after 6 or 7 years on Gentoo. The only problem I am experiencing is extremely slow internet. 1.58Mbps vs 31Mbps previously in Gentoo. Google seems to indicate a lot of people have similar is

  • Error determining address for Employee

    Hi Experts, We are running SRM 5.5 (add-on) in a local scenario. We have an issue with one employee, where they won't show with a relationship to their Org unit. The employee has a current employee record, has a valid user id, is assigned in the Org

  • How to re-set rownumber on a group

    Ex: Select rownum, clientID, amt from clients group by clientID Results should be Row Client ID 1 9899 $25 2 9889 $68 1 2535 $25 1 2535 $124