IT Community - Software Programming, Web Development and Technical Support

Store and retrive flash cookies

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


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Flash Actionscript Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-17-2007, 12:06 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Store and retrive flash cookies

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.
Attached Files
File Type: zip SharedObject.zip (4.3 KB, 5 views)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2007, 03:58 AM
nssukumar nssukumar is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Posts: 155
nssukumar is on a distinguished road
Default Re: Store and retrive flash cookies

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-18-2007, 03:26 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: Store and retrive flash cookies

i have the stuff for video streaming.....

i will give u sooonnnnnnnn.....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-20-2007, 09:10 AM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 72
aramesh is on a distinguished road
Default Show preloader before the flash file is loading

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>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-22-2007, 11:58 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: Store and retrive flash cookies

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...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 09:09 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0