ActionScript 2.0 :: Saving And Loading Variables Using Buttons

Jun 21, 2011

So I want to do saving and loading for variables. I.E. I want to save a variable by pressing the save button. When you use the "load" button, the variable is what it was when it was saved. I've tried this but it didn't work...

Code:
//Code on the frame
var saveState = SharedObject.getLocal("Cookie");

//Code on the save button
on (release) {
_root.save.gotoAndPlay(2);
savefile.data.blah = _root.blah;
savefile.flush();
}

//Code on the load button
on (release) {
gotoAndStop(3);
_root.blah = savefile.data.blah;
}

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Saving/Loading Variables With PHP?

Jan 26, 2005

I'm trying to save a change to a text document (In this case a variable "Title" just to test) and then view the changes from another swf movie... In the end I'm hoping to build a client updatable flash site. In particular menu items... feature items & prices.

A Recap: a client types in the items, php/flash saves the changes to the text document, and site visitors can views those changes.

Something in my code isn't clicking:

My PHP is:

Code:
<?php
$Title = $_POST['Title'];
$toSave = "Title=".$Title;

[code]....

View 1 Replies

ActionScript 3.0 :: Flash - Saving Variables?

Jun 14, 2010

Well i am trying to save variables into a file, prefirable .txt files, but i am having some troubles doing so, all the tutorials say stuff like you need to use php and java, but i am trying to save it to the client's comnputer, so you save it local.here is my script i have so far:

Code:
var sex:int;
sex = 0;

[code].....

View 1 Replies

Data Integration :: Saving Variables In Files?

Jun 18, 2008

Is it possible to make such a thing: When Button_btn is clicked (onRelease), var( var Name:String = new String("Flash MX|) ) is send to file (File.txt) and saved there.

View 1 Replies

ActionScript 3.0 :: Saving Variables To Local File?

Oct 26, 2011

I was given the task of altering a Flash animation (no AS) in a way that it would collect data from WSDL, write it to a text file and then use that data each subsequent time it runs.
 
You see, the Flash animation is part of a playlist (digital signage) and has a set duration which doesn't allow for network problems while retrieving data from WSDL. So while I got it to work fine by just displaying the WSDL data directly - it sometimes times out.
 
I have the retrieving from WSDL part down (flex), I can even read stuff from .txt files, but can't do the middle part - writing the variables into a .txt file.

View 2 Replies

Arrays :: Saving X And Y Cords As Variables On Mouse Click?

Jan 7, 2012

I have a piece of code worked out that creates circles on a mouseDown function. I'm trying to save the x and y cords of the circles but cannot figure out a way around this. I need to save multiple instances of the cords from mouseDown.

Is it possible to do this in an array?

var posOne:Number;
//var posTwo:Number;
//var posThree:Number;

[Code]....

View 2 Replies

Professional :: Saving And Loading Data To/from SWF?

Jul 23, 2010

I have created a simple flash animation for my employer. I basically have a square that changes color depending on which of three buttons are clicked. This is replicated about 30 times on the page. There is also about 15 circles that have a toggle button created so that when you click on the circle, they change between two colors. As I said, a very simple application.

Now, I need to save the data so that whenever someone new opens the swf, the current color combination is displayed. My way of thinking, with my limited AS3 experience, is that each button click, in addition to changing the color of a movie clip, should also send the data to a server. Then when someone opens the application fresh, I can use the URLLoader to load the most current data.

Am I on the right track, or am I missing it completely? I think I can figure out the URLLoader, but what code would I use to create the text file or xml file?Here is a snippet of my code:

var rtmColor:ColorTransform = f13335.transform.colorTransform;
var okColor:ColorTransform = f13335.transform.colorTransform;
var usColor:ColorTransform = f13335.transform.colorTransform;

[code].....

By clicking on either the rtm_13335, ok_13335, or us_13335 buttons, they will change the f13335 movie clip to the appropriate color (blue, green, or red). The default color is green.

What I would like to do is make the movie clip red, for example, then another person opens the swf, and the movie clip is red as opposed to the default green because I saved the current state to a text or xml file.

View 3 Replies

Xml :: Saving And Loading File With Flex?

Aug 25, 2009

I want to have a xml file for my configuration and so i have to load it from the same directory the swf file lies in and save it afterwards. I saw articles about filestreams in flex but my compiler didn't allow me to use the filestream. I use the open source flex sdk

View 3 Replies

ActionScript 2.0 :: Saving And Loading Drawings?

Feb 17, 2009

i am working on a flash project, not ment for the web, i am creating an interactive map app.here is a section that involves the user to draw custom shapes ,lines and text over the maps.the problem is gettting the user to save this drawings so that the next time the application is started he/she can load the previously saved drawings.

View 1 Replies

ActionScript 3.0 :: Saving And Loading To A Database?

Jan 12, 2010

hey people wondering if there is a way to use AS3 to save and load to a database.

Specifically I have created a flash program for a teacher that runs tests for her students. When a student loads up the .swf they are prompted for their name. Ideally we would like to be able to save the progress of a student after he/she has completed a test and then use that data later. Is there a way to save data like this and call upon it at a later time?

View 8 Replies

Actionscript 3.0 :: Saving And Re-loading Data?

May 9, 2009

I've made a small application in Flash CS4 that I use when I'm teaching. Part of the application allows me to 'write' on draggable 'post-it' notes (using a draw function) and another part allows me to type text onto similar 'post-it' notes. how I could save the data that is written or typed in and then re-load it on another occasion? Am I out of my depth?My AS3 is probably intermediate level, I have some experience with SWF Studio and I'm beginner level with php/mySQL.

View 3 Replies

ActionScript 2.0 :: Saving And Loading Data

Jun 14, 2004

I've searched load of threads for info on this because for what I'm doing I need to save data to the local disk and then load it back up again as required. I'm using a local shared object to save data to and this works fine. Getting it back out again seems less straightforward.[code]Nothing appears to happen at all. The program continues with no traced output at all.

View 3 Replies

ActionScript 2.0 :: Saving And Loading Locally?

Aug 22, 2006

Is it possible that, when I publish my flash program to the internet that the user can save and load text to a text file somewhere on his computer?

View 2 Replies

ActionScript 2.0 :: Saving And Loading Bitmaps?

Jun 5, 2007

Ok I wrote an application where I have panels that the user can draw on, kind of like paint, but they can create panels. Now I want them to be able to save and load their work. Using Quasimondo's bitmap exporter, I was able to save a bitmap (200x200), and the application prompts the user where they were to save the image file. However, my problem is that the user will probably have 6-12 panels to save, and so I want the program to save all those panels so they can be loaded later.

Now in order to load, I don't want the user to manually select each panel to load. I want the user to select one file and it will load all the images into the panels. I was thinking about maybe loading a zip file and flash would extract the images and load them, but I don't know if that's possible. I think the user would need to select an XML file,which would direct Flash to what files to load and in what order. For this, and I'm assuming when it saves the flash application/php, it would need to write a new xml file.So I guess what I need to know how to do is:- How do I get flash to save several images to the server or the users hard drive- flash to generate an xml file- is there any way to make flash combine all the files into one file so that the user doesn't have to deal with several files?

View 3 Replies

ActionScript 3.0 :: Saving And Re-loading Data

May 9, 2009

I've made a small application in Flash CS4 that I use when I'm teaching. Part of the application allows me to 'write' on draggable �post-it� notes (using a draw function) and another part allows me to type text onto similar �post-it� notes. Does anyone know how I could save the data that is written or typed in and then re-load it on another occasion? Am I out of my depth? My AS3 is probably intermediate level, I have some experience with SWF Studio and I�m beginner level with php/mySQL.

View 3 Replies

ActionScript 2.0 :: Saving And Loading A Dynamic Text Box?

Aug 19, 2009

I was wondering if there is a way to save and then load a message of a Dynamic text box.

View 4 Replies

ActionScript 3.0 :: Loading In An Image At 300 Dpi Manipulating It And Saving It As A 300 Dpi Png

Feb 27, 2012

I have a project where the user uploads a large 300dpi image, then manipulates it (drag it, rotate it, position it). And the user can reuse this 300 dpi image, basically to make something like a t-shirt pattern. Then when the user is ready, they save this t-shirt pattern, and the save format is a large 300dpi png. This saved png file is for printing.  Now I figure I can have PHP take bitmap data (as binary I assume) and the php can create the png. Is it a good idea to use Flash for this?  I will have to scale down the users loaded 300dpi image so they can position. Then I assume scale it back up when it comes time to save Does anyone think Flash can't handle this?

View 4 Replies

Flash :: Saving Dynamic Drawing, Then Re-loading?

Jan 30, 2010

the short version of what i need to do - via AS3 and PHP - is a user can come to this project and draw something. drawing's no problem, that's done. my issue is figuring out how to take that drawing data, converting it into something i can save to my database ... then reload said data and recreate it on the stage when the user "loads" it.

i guess i'm just searching for a way to take drawn data (just using typical as3 drawing methods) and breaking it down to a string, then bringing that string back in and recreating it. i'm not super versed in ByteArrays - which i suspect is where my answer lies.

user doesn't need to adjust any of this after it's loaded, fwiw. i'd just like to send this drawing data out - then bring it back in and place it back on the stage.

View 2 Replies

Flash Cs5.5 :: Saving/Loading To A Mobile Device?

Feb 6, 2012

I am pretty fresh into working with mobile at all here but i am having no luck finding solid info on the basic principles of file saving/loading locally on a mobile device (specifically android).

View 1 Replies

ActionScript 2.0 :: Saving / Loading Files From / To Flash

Dec 16, 2002

I know this can be done, but not sure how. I have seen a program that basically has its own fscommands and must compile them itself. Does anyone know how you would do this. The program i refer to is [URL] flash studio pro. There are other programs out there like this but these all cost money for commercial use.

View 1 Replies

ActionScript 3.0 :: Saving And Loading Data To Local Machine?

Feb 1, 2012

I am new to Flash/ActionScript, and I am having a lot of fun creating a project in Flash. am working on a character tracker (yes I am totaly geeking out) an I was wondering how to save the data I have entered into the project (hit points etc...) and load it back next time I opened it. The data would be saved on my local machine. How can I get Flash/ActionScript to do this?

View 11 Replies

ActionScript 2.0 :: Saving / Loading External Text Files

May 27, 2004

i know you can load them in as variables... but is there anyway SAVE a variable as a text file (overwriting old one as well)

View 1 Replies

ActionScript 3.0 :: Flash CS5 / CS4 Game Saving / Loading Tutorial

Apr 8, 2011

Somebody give me some tutorials sites for saving and loading game.

View 1 Replies

ActionScript 2.0 :: Saving/loading External Text Files?

May 27, 2004

i know you can load them in as variables... but is there anyway SAVE a variable as a text file (overwriting old one as well)

View 1 Replies

Flash8 :: Saving And Loading Attached Object With Shared Objects?

Sep 7, 2010

I know the basics of shared objects but I never really got into it I was wondering if there is a way that I could save and load movieclips that I attach to the stage(Each has its own name such as clip_1,clip_2,etc) including the location(_x,_y,rot) and have it duplicate them all over again and move them to the same location as before (I'm using Actionscript 2, by the way)

View 1 Replies

ActionScript 2.0 :: CS3 Saving And Loading Attached Object With Shared Objects?

Sep 17, 2010

I know the basics of shared objects but I never really got into it I was wondering if there is a way that I could save and load movieclips that I attach to the stage(Each has its own name such as clip_1,clip_2,etc) including the location(_x,_y,rot) and have it duplicate them all over again and move them to the same location as before

View 1 Replies

Flex :: Saving And Loading Image To Local SQLite BLOB ?

Sep 8, 2011

I need to be able to save and load images into an SQLite database using Flex 4.5 for a mobile application. The use case is this:

Inside the view there is a spark Image object with a URL as a source

When user clicks button, the Image is saved to an SQLite db inside a BLOB field.

In a separate Image, the source is set to the ByteArray stored in the db.

The biggest question so far is this: where do I get the ByteArray for a loaded Image? I've tried debugging and inspecting Image, BitmapImage, and BitMapData but there's no sign of the byte array.... perhaps it's inside the ContentLoader? But that's null unless I enable caching.

I've done some research and there are no complete examples for how to handle this. I've written a simple View that anyone can copy and paste into a new project. It will compile without errors and can be used for testing. I will update this code as I get the answers I need so that anyone can have a fully working example of this workflow.The only caveat: I used a synchronous connection to the DB to avoid complicating the code with event handlers, I wanted to keep it as simple as possible.I will only mark this question as answered once it is fully functioning both ways.

UPDATE SEPT. 09 2011: The code below is now fully functioning in both directions (save and load). Here are some of the things I've learned: It turns out that the ByteArray of a spark Image can be found inside the LoaderInfo of the image itself. Like this:

image.loaderInfo.bytes

However, trying to set this ByteArray as the source of another image ( image2.source = image1.loaderInfo.bytes) results in this security error: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.Which is too bad because it would save so much time and processing power.the workaround is to encode the ByteArray using either a JPEGEncoder or a PNGEncoder. I used the JPEGEncoder which produces much smaller files. Here's how:

var encoder:JPEGEncoder = new JPEGEncoder(75);
var imageByteArray:ByteArray = encoder.encode(imageToSave.bitmapData);

Now the problem is saving these bytes to the DB. Saving them as they are now will not work once we read them out, I'm not sure why. So the solution is to encode them into a base64 string like this:

var baseEncoder:Base64Encoder = new Base64Encoder();
baseEncoder.encodeBytes(imageByteArray);
var encodedBytes:String = baseEncoder.toString();

So now just save that string into the BLOB field and later read it out. However, you have to decode it from a base64 string to a ByteArray like this:

var encodedBytes:String = result.data[0].imagedata;
var baseDecoder:Base64Decoder = new Base64Decoder();
baseDecoder.decode(encodedBytes);
var byteArray:ByteArray = baseDecoder.toByteArray();

Now assign the bytearray as the source of your image and you're done. Simple right?if you find any optimizations or alternative ways to do this.I will respond and keep this code updated if need be.

View 2 Replies

ActionScript 2.0 :: Dynamically Saving/loading Movie Clip Values?

Jan 27, 2006

I've been using Flash for ages but haven't a clue about backend scripting.I've got a flash app where you can add movieclips to the stage and drag them around etc... ...what I'd like is for the user to dynamically save the _x, _y and _rotation values so they can be viewed by other people.What would be the best way to do this - write to an XML file or to a MySQL database? I've looked at some tutorials but its beyond my capabilities to be honest

View 5 Replies

ActionScript 2.0 :: Saving Data And Loading Data From A .txt File?

Sep 24, 2006

I have read through Shared Objects but i couldn't get it work...

I just have to save my data, maybe array into .txt file and later on
retrieve from the same .txt file...

Anyone here have an example or some source code so i can have reference on it?

View 6 Replies

ActionScript 3.0 :: Pass Variables Via Buttons?

Jan 22, 2010

if I have a setup like this[code]...

I start the movie and it traces "null" which makes sense. But when I click on a button it doesn't trace the button name. I know the disconnect is at the point where I'm clicking the button. Is there a way to put a listener into the content movie clip that will run the code again when a button is clicked?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved