Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 01-11-2010, 05:00 PM   #1
Registered User
Join Date: Jan 2010
Posts: 1
Default Textfield and String

Hello everybody

I'm trying to put a text from SharedObject and String to a dynamic text field, but the textfield stays empty (or it's whatever I put in var myName:String = ""; ), and it's ignoring any text I define later for the String object. I'm newbie with this and can't get a clue what's wrong.

Here's the code (Flash lite 2.1, AS 2.0):
ActionScript Code:
var mySO:SharedObject = SharedObject.getLocal("myData"); var myText:String = ""; soInitHandler = function(so:SharedObject){     if(mySO.data.myText == undefined){         myText = "Hello World";     }         else {         myText = mySO.data.myText;         mySO.flush();     } } SharedObject.addListener("myData", soInitHandler); myTextField.text = myText;
After this, myTextField should be "Hello World" or anything, but it's empty. What's wrong with this?

(Ps: It works only if I put myTextField.text whithin soInitHandler function, but it's not such a good solution since I need to reuse String data for other text fields later)

inkredibl 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 07:19 PM.

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.