Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 1st, 2003, 10:11 AM
scooterbabe scooterbabe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 scooterbabe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Variable variables in Flash

Is that possible?

That is, to create a variable from another variables value...

Reply With Quote
  #2  
Old September 1st, 2003, 11:01 AM
ardivus ardivus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Provo, UT
Posts: 7 ardivus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, I'm not positive that I understand the question, but if you want to use the value of a variable as the dynamically created name of a new variable, you can do it like this:

var testVar = "something";
this[testVar] = "somethingElse";
trace(testVar);
trace(this[testVar]);
trace(something);

Your trace will show:

something
somethingElse
somethingElse


This is good because you can also make new variable names with the variable values, like this:
this[testVar + "_txt"] = "someText";
trace(something_txt);

this trace will also show "somethingElse"


I hope I wasn't too far off of the question... or too confusing.

Reply With Quote
  #3  
Old September 1st, 2003, 12:02 PM
scooterbabe scooterbabe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 scooterbabe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by ardivus
Sorry, I'm not positive that I understand the question, but if you want to use the value of a variable as the dynamically created name of a new variable, you can do it like this

...

I hope I wasn't too far off of the question... or too confusing.


You understood it perfectly! Thanks man! New to AS but old to PHP and I thought it'ld be possible!

Reply With Quote
  #4  
Old September 2nd, 2003, 03:32 AM
scooterbabe scooterbabe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 scooterbabe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do I combine this with global variable? I need too access the varibles from outside...

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Variable variables in Flash


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway