开发者

Shared objects and related elements

开发者 https://www.devze.com 2023-04-06 04:19 出处:网络
If I\'m attempting to create a file that takes information a user inputs using input fields, save them, and then load them again later after the file has been opened and an option selected, what sort

If I'm attempting to create a file that takes information a user inputs using input fields, save them, and then load them again later after the file has been opened and an option selected, what sort of things would I need to most research? I know there's something called sharedObject I need to research开发者_StackOverflow. What else? I've been searching Google, but I'm not finding anything covering this particular aspect. Games do it, yes? So an application could do it as well, without using Flex, yes?


You need to brush up on your google-fu. I came up with 169K results on how to do what you're asking here. Here are some tutorials:

http://www.emanueleferonato.com/2008/12/28/understanding-as3-shared-objects/

http://drawlogic.com/2008/01/10/howto-sharedobjects-for-local-storage-as3/

http://www.flashdaweb.com/2008/01/tutorial-actionscript-3-using-shared-objects-to-show-the-time-of-page-browsing/

Googled "using shared objects in AS3"

Here is an excerpt from one of the sites showing how easy this is:

package {
    import flash.display.Sprite;
    import flash.net.SharedObject;
    import flash.text.*;
    public class as3_shared_objects extends Sprite {
        var shared:SharedObject;
        public function as3_shared_objects() {
            shared = SharedObject.getLocal("reloaded");
            if (shared.data.visits==undefined) {
                shared.data.visits = 1;
            }
            else {
                shared.data.visits ++;
            }
            show_text(shared.data.visits);
            shared.close();
        }
        public function show_text(str) {
            var shared_text:TextField = new TextField();
            var format:TextFormat = new TextFormat();
            format.font = "Lucida Console";
            format.color = 0xffff00;
            shared_text.width = 300;
            shared_text.defaultTextFormat = format;
            shared_text.x = 25;
            shared_text.y = 15;
            addChild(shared_text);
            shared_text.appendText("You visited this page "+str+" times");
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消