Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-02-2012, 02:11 AM   #1
Claunchster
Registered User
 
Join Date: May 2012
Posts: 5
Exclamation Entering/Saving Text Data

I'm creating a desktop application for the beginning of the school year and I need to be able to have people manually fill in data in text fields (input text fields), primarily just names - and when they open the application they need that data to still be there. I also want them to be able to edit and delete the data that they enter. This is what I'm using so far:

ActionScript Code:
var tfA:Array = new Array(txtName1,txtName2, txtName3, txtName4, txtName5, txtName6, txtName7, txtName8, txtName9, txtName10); var so:SharedObject=SharedObject.getLocal("dataSO");   if(so.data){ for(var i:int=0;i<tfA.length;i++){ tfA[i].text=so.data["tf"_text"+i]; } }   function saveTextF():void{ for(i=0;i<tfA.length;i++){ so.data["tf_text_"+i]=tfA[i].text; } so.flush(); }

But I keep getting this output error:

TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at CTIS_fla::mcBus127B_1/frame1()[CTIS_fla.mcBus127B_1::frame1:6]

. . . and after I start the application and input some test names and close the application, when I start the application back up again it's not loading the data I put in the input text fields. What am I doing wrong? Any ideas? Thanks!
Claunchster is offline   Reply With Quote
Old 08-02-2012, 05:49 AM   #2
nite21
Senior Member
 
Join Date: Apr 2008
Location: Mumbai, India
Posts: 440
Default hi

Quote:
Originally Posted by Claunchster View Post
I'm creating a desktop application for the beginning of the school year and I need to be able to have people manually fill in data in text fields (input text fields), primarily just names - and when they open the application they need that data to still be there. I also want them to be able to edit and delete the data that they enter. This is what I'm using so far:

ActionScript Code:
var tfA:Array = new Array(txtName1,txtName2, txtName3, txtName4, txtName5, txtName6, txtName7, txtName8, txtName9, txtName10); var so:SharedObject=SharedObject.getLocal("dataSO");   if(so.data){ for(var i:int=0;i<tfA.length;i++){ tfA[i].text=so.data["tf"_text"+i]; } }   function saveTextF():void{ for(i=0;i<tfA.length;i++){ so.data["tf_text_"+i]=tfA[i].text; } so.flush(); }

But I keep getting this output error:

TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at CTIS_fla::mcBus127B_1/frame1()[CTIS_fla.mcBus127B_1::frame1:6]

. . . and after I start the application and input some test names and close the application, when I start the application back up again it's not loading the data I put in the input text fields. What am I doing wrong? Any ideas? Thanks!
chek this file
Attached Files
File Type: zip sharedobject.zip (8.9 KB, 42 views)
nite21 is offline   Reply With Quote
Old 08-02-2012, 01:39 PM   #3
dmb85
Senior Member
 
Join Date: Jan 2012
Posts: 590
Default

Your code has got some typos.

ActionScript Code:
tfA[i].text=so.data["tf"_text"+i];

that should be:

ActionScript Code:
tfA[i].text=so.data["tf_text_" + i];
dmb85 is offline   Reply With Quote
Old 08-02-2012, 03:12 PM   #4
Claunchster
Registered User
 
Join Date: May 2012
Posts: 5
Default

Hey dmb85, yeah, I noticed the typo a little while after I posted this, but it still doesn't work
Claunchster is offline   Reply With Quote
Old 08-02-2012, 09:42 PM   #5
Claunchster
Registered User
 
Join Date: May 2012
Posts: 5
Default

nite21, that wasn't exactly what I was looking for, but it works great! I was able to take it and adapt it to what I needed. Thanks!
Claunchster is offline   Reply With Quote
Old 12-07-2012, 06:04 AM   #6
nite21
Senior Member
 
Join Date: Apr 2008
Location: Mumbai, India
Posts: 440
Default

welcome
nite21 is offline   Reply With Quote
Old 12-07-2012, 09:10 PM   #7
poltuda
Senior Member
 
Join Date: May 2010
Posts: 253
Default

SharedObject is not a good solution in this type of casses.

Use localhost PHP MySQL or .txt if you able to handle it.


poltuda
poltuda is offline   Reply With Quote
Reply


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 04:36 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.