Photoshop Tutorials, Flash Tutorials, 3Ds Studio Max Tutorials, Web Design Tutorials |
Home | Submit Tutorial | Top Sites | Free Templates (NEW) | Website templates | Privacy Policy | Link Exchange | Contact Us |
|
Welcome To ProDesignHost.com Flash Tutorials Area - SharedObject and YouHi
and welcome to this tutorial. This tutorial covers SharedObject.
SharedObject is a kind of cookie for Flash. Though, SharedObject is
much more powerful. SharedObject isn't just a way of saving mere
strings on the client's hard disk, you can store texts, strings,
numbers and even objects. For instance, if you want to save a date
object in JavaScript you would have to go though a whole encoding
process, with SharedObject you just save it, and be ready. myOjbect = SharedObject.getLocal("test"); //Get the 'test' SharedObject and save it in myObject myObject.data.myName = "Mark"; //Save the value "Mark" in the myName variable in the SharedObject Now that the variables are created, there is one more thing you need to know. When you edit the object, the SharedObject isn't saved. If Flash would do that, it would be very inefficient, and would take up a lot of system resources. That's why Flash only saves the SharedObject when you tell it to. You can do that with the flush() function. When you call this function, all the values are saved: myOjbect = SharedObject.getLocal("test"); //Get the 'test' SharedObject and save it in myObject myObject.data.myName = "Mark"; //Save the value "Mark" in the myName variable in the SharedObject myObject.flush(); //Save the values Now all the values are saved. Calling works in exactly the same way.
You've now basicly grasped sharedObject. All that remains are a few little leads. First is that you can check if you've allready defined a variable or not by comparing it to undefined: if (myOjbect.data.myName == undefined) { //Variable doesn't exist so define it... myObject.data.myName = "Mark"; } else { //Do stuff with the existing variable... trace(myObject.data.myName); } Or saving objects to the sharedObject...: myObject.data.myArray = new Array(); myObject.data.myObject = new Object(); myObject.data.myObject.myFunction = function () { trace("function called!"); } The possibilities are endless :) Author: MicrOchip
|
|
Premium Partners | |||||
|
|||||
Free website templates and paid web templates are great tools to make your websites look perfect! You will save time and money with our flash templates and free website templates
Our visitors are satisfied with the quality of our free and paid website templates! Please visit our free website templates and paid website templates sections. We offer free web templates, free web layouts, free web page templates and other stuff for free download. All templates come with the html and external css file so you may easily edit HTML with your favorite HTML editor. Feel free to download our free web templates for your personal websites. Terms of use depend upon the website template vendor. |
Home | Submit Tutorial | Top Sites | Free Templates | Website templates | Privacy Policy | Contact Us |