[ Pobierz całość w formacie PDF ]
.This is the simplest way to use ashared object.For example, you can call SharedObject.getLocal() to create a shared object,such as a calculator with memory, in the player.Because the shared object is locally persistent,Flash saves its data attributes on the user s machine when the SWF file ends.The next time theSWF file runs, the calculator contains the values it had when the SWF file ended.Alternatively, ifyou set the shared object s properties to null before the SWF ends, the calculator opens withoutany prior values the next time the SWF file runs.To create a local shared object, use the following syntax:// Create a local shared objectso = SharedObject.getLocal("foo");Local disk space considerationsLocal shared objects are always persistent on the client, up to available memory and disk space.By default, Flash can save locally persistent remote shared objects up to 100K in size.When youtry to save a larger object, Flash Player displays the Local Storage dialog box, which lets the userallow or deny local storage for the domain that is requesting access.Make sure your Stage size is atleast 215 x 138 pixels; this is the minimum size Flash requires to display the dialog box.If the user clicks Allow, the object is saved and SharedObject.onStatus is invoked with a codeproperty of SharedObject.Flush.Success; if the user clicks Deny, the object is not saved andSharedObject.onStatus is invoked with a code property of SharedObject.Flush.Failed.The user can also specify permanent local storage settings for a particular domain by right-clicking (Windows) or Control-clicking (Macintosh) while a SWF file is playing, choosingSettings, and then opening the Local Storage panel.SharedObject class 617 The following list summarizes how the user s disk space choices interact with shared objects:" If the user selects Never, objects are never saved locally, and all SharedObject.flush()commands issued for the object return false." If the user selects Unlimited (moves the slider all the way to the right), objects are saved locallyup to available disk space." If the user selects None (moves the slider all the way to the left), all SharedObject.flush()commands issued for the object return "pending" and cause the player to ask the user ifadditional disk space can be allotted to make room for the object, as explained above." If the user selects 10 KB, 100 KB, 1 MB, or 10 MB, objects are saved locally andSharedObject.flush() returns true if the object fits within the specified amount of space.Ifmore space is needed, SharedObject.flush() returns "pending", and the player asks theuser if additional disk space can be allotted to make room for the object, as explained above.Additionally, if the user selects a value that is less than the amount of disk space currently beingused for locally persistent data, the player warns the user that any locally saved shared objects willbe deleted.Note: There is no size limit in Flash Player that runs from the authoring environment.Method summary for the SharedObject classMethod DescriptionSharedObject.clear() Purges all of the data from the shared object and deletes theshared object from the disk.SharedObject.flush() Immediately writes a locally persistent shared object to a local file.SharedObject.getLocal() Returns a reference to a locally persistent shared object that isavailable only to the current client.SharedObject.getSize() Gets the current size of the shared object, in bytes.Property summary for the SharedObject classProperty (read-only) DescriptionSharedObject.data The collection of attributes assigned to the data property of theobject; these attributes can be shared and/or stored.Event handler summary for the SharedObject classEvent handler DescriptionSharedObject.onStatus Invoked every time an error, warning, or informational note isposted for a shared object.618 Chapter 12: ActionScript Dictionary Constructor for the SharedObject classFor information on creating local shared objects, see SharedObject.getLocal().SharedObject.clear()AvailabilityFlash Player 7.Usagemy_so.clear()ParametersNone.ReturnsNothing.DescriptionMethod; purges all of the data from the shared object and deletes the shared object from the disk.The reference to my_so is still active, and my_so is now empty.SharedObject.dataAvailabilityFlash Player 6.UsagemyLocalSharedObject.dataDescriptionRead-only property; the collection of attributes assigned to the data property of the object; theseattributes can be shared and/or stored.Each attribute can be an object of any of the basicActionScript or JavaScript types Array, Number, Boolean, and so on.For example, thefollowing lines assign values to various aspects of a shared object:itemsArray = new Array(101,346,483);currentUserIsAdmin = true;currentUserName = "Ramona";so.data.itemNumbers = itemsArray;so.data.adminPrivileges = currentUserIsAdmin;so.data.userName = currentUserName;All attributes of a shared object s data property are saved if the object is persistent [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • hanula1950.keep.pl