0

Is there a simple way to convert an instance variable to a String?

2 Answers 2

5

Use this (a bit safer because it will still work if myInstanceVariable is null):

String(myInstanceVariable)

or

myInstanceVariable.toString()

Also, I just found this nice article explaining the different methods: http://www.morearty.com/blog/2008/07/28/actionscripts-different-ways-to-convert-an-object-to-a-string/

Sign up to request clarification or add additional context in comments.

Comments

0

for string I always use myStringVar = myInstance + "";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.