Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-31-2012, 09:20 PM   #1
Learning User
Join Date: May 2012
Location: Ca
Posts: 3
Question Making a simple Address/Phone Book


I'm trying to make a very simple Address/Phone Book.

So, I tried making a tryout one before I do the real thing.
I made two Input Text Boxes (one for 'name' and the other for phone).
I then added one Button.

Idea: The idea is that when I click the button, whatever is typed in the name and phone input boxes will be saved in a .txt file.

Here is my code:
ActionScript Code:
done_btn.addEventListener(MouseEvent.CLICK, saveIt); var dataArray:Array = new Array(); var dataFR:FileReference = new FileReference(); function saveIt(e:MouseEvent):void {     dataArray = [{name:name_txt.text,phone:phone_txt.text}];     tFR.save(dataArray[0].name+dataArray[0].phone,'addressbook.txt'); }

Of course, it works with no problem.
But, I want to ask if I'm doing this code the right way.

Also, is there a way where I can keep inputting data and saving it but without destroying the current data in the .txt file?
I think that I'd have to use "if statement" there. However, the tFR.save always brings out a "save as..." pop-up (after I click the button).

Thank you for any advice.

Oh I think I will try loading the .txt file first to an Array so that when I save, I can re-write the old data then add the new data with it.

Last edited by lannie; 05-31-2012 at 10:31 PM.
lannie is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 09:08 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.