This is a discussion on Store and retrive flash cookies within the Flash Actionscript Programming forums, part of the Web Development category; Store and retrive flash cookies Flash Cookies: Local Shared Objects Flash MX Shared objects are a new feature that allow ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Store and retrive flash cookies Flash Cookies: Local Shared Objects Flash MX Shared objects are a new feature that allow you to store information on the clients machine the same way as cookies would and retrieve it at a later time. Shared objects are stored in .sol files located in the Flash player directory of the user's profile, example: "C:/Documents and Settings/Administrator/ApplicationData/Macromedia/Flash Player", and have their own format. The amount of the information you can store in a local Shared Object from one domain is set to 100 kb by default. If you will try to store more information, the Flash player will ask the user for a permission to increase this limit. Here is an suitable sample application for Shared objects data could be to remember the Players's name, and his score or anything else you can imagine. Type in your name and score and click on "Save". Then, refresh this page to let Flash read and display the stored data. Here is the sample code. 1) Create a new Flash Document and Save. 2) Drag two textBoxes and Name it as "PlayerName_txt" and "GameScore_txt". 3) Create Button and set the Instance name as "saveBtn'. 4) Write the following codes in the Main Timeline myLocalSO = SharedObject.getLocal("Game_Data"); // create a local shared object within a Flash movie if (myLocalSO.data.PlayerName != null) { PlayerName_txt.text = myLocalSO.data.PlayerName; GameScore_txt.text = myLocalSO.data.GameScore; } else { PlayerName_txt.text = "<Type your name here>"; GameScore_txt.text = 0; } saveBtn.onRelease=function(){ myLocalSO.data.PlayerName = PlayerName_txt.text; myLocalSO.data.GameScore = GameScore_txt.text; myLocalSO.flush() } 5) Run this application, and give your name and score. Then click the save Button it will store it on your machine. 6) Close your application and then run again, now it shows the your name and score. |
| Sponsored Links |
| |||
| hi, worked on your fla, great stuff. do you have any stuff related to video streaming. iam preparing myself in that aspect.it would be great if i get some basic tutorial related to it. |
| |||
| Hi, Flash cookie is very much useful to me. Ok. Now i want to show the preloader or the percentage of the swf file is loading, when the html page is loaded. Because when i use with out the preloader it shows the blank space on this area until the flash file loaded. I tried it out but cant. I want to show them using a progress bar. First i set the progress bar _xscale to 0%. Increase the _xscale by calculating the percentage of the file and show them on the text box also. Please help me to complete this. <aramesh> |
| |||
| Hi, This sample shows a preloader when the flash file is loading. The preloader show the % of the file is loading in text box also. See the description below. 1) Create a Flash Document. 2) Create a rectangle and convert it into a MovieClip and give its instance name as "pgBar". Keep the graphics in (0,0) position. 3) Create a textbox and Give its instance name as "percentTxt". 4) Write the following code in the first frame. 5) stop(); pgBar._xscale=0; onEnterFrame = function() { LB = getBytesLoaded(); TB = getBytesTotal(); PC = Math.round((LB/TB)*100); pgBar._xscale=PC; percentTxt.text=PC+" % Loaded"; if(TB>4 && PC == 100) { delete onEnterFrame; gotoAndPlay(2); } } 6) Write your main functions and designs from the second frame. 7) Embed the flash in html page and view in browser. First it shows the percentage of loading, after it reaches the 100% it goes to the next frame.
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to create store procedure? | senraj | Database Support | 4 | 04-25-2008 06:26 AM |
| how to open and retrive text file(.txt)? | una_noche | Java Server Pages (JSP) | 1 | 08-17-2007 03:27 AM |
| how to store and retrieve data from cookies | hanusoftware | ASP and ASP.NET Programming | 1 | 08-09-2007 07:17 AM |
| How to retrive tables name with row count:(content) | kingmaker | Database Support | 1 | 07-23-2007 07:29 AM |
| Store and Retrieve the values in cookies in ASP.NET | oxygen | ASP and ASP.NET Programming | 0 | 07-20-2007 12:23 AM |