Hi guys, i'm in a trouble, either i'm going really blind or...

I've the following code, in ActionScript3:

trace("FILE: " + soUsers.data.currUser);

currUserID = soUsers.data.currUser;
trace("currUserID: " + currUserID );

currUserID = soUsers.data.currUser as String;
trace("currUserID: " + currUserID );

trace("FILE: " + soUsers.data.currUser);

And i got the following output:

FILE: def1
currUserID: null
currUserID: null
FILE: def1

Can you please, please, point out what i'm doing wrong??

BTW, 'soUsers' is a SharedObject, and 'currUserID' is a string variable;

8 years ago*

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

Not quite yet ;)

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 8 years ago.

8 years ago
Permalink

Comment has been collapsed.

Yes, otherwise, there would be a undefined property error!
Plus... i can access it!

8 years ago
Permalink

Comment has been collapsed.

Have a bump so maybe someone who knows the answer will see it.

8 years ago
Permalink

Comment has been collapsed.

currUser is not defined. The variable you want in the second and third trace() is currUserID.

8 years ago
Permalink

Comment has been collapsed.

Sorry, that was my mistake in renaming my variables to this post,
Originally they were all: 'uID', but i thought that 'currUserID' was easier to get the idea!

But thanks!

8 years ago
Permalink

Comment has been collapsed.

GOT IT!!!!!

In another file, i declared new variables and copy pasted the code, and worked perfectly!
And right after testing a stupid idea, i solved it!

When i inicially declared my variables, i casted them to a specific type:
var currUserID:String;

On the second file, i just declared them uncasted, and solved the problem!
Don't know exactly why, but it worked!

Thanks everyone, nonetheless!!

8 years ago*
Permalink

Comment has been collapsed.

Closed 8 years ago by MRRICARDO.