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 December 9th, 2003, 09:14 AM
mopie mopie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 22 mopie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to mopie
how do I unconcatenate a string

ok so I've got a script

Code:
 

desc1 = "ring"; 
desc2 = "necklace"; 
desc3 = "earring"; 

growth = 0; 

function make_txt() { 
   this.createTextField("desc_txt"+growth,growth,0,0,100,100); 
   nameology = "desc" + growth; 
   this["desc_txt"+growth].text = nameology; 
   growth++; 
} 

for (i=1; i<=3; i++) { 
   make_txt(); 
} 



this Creates a text field, gives it a name, and gives it content.
the for loop does it 3 times, so in there are 5 textfields...

the variable "Growth" keeps adding one so the textfield names are "desc_txt1", "desc_txt2", "desc_txt3"

Ok so most of that works...

MY problem is getting the variable "Nameology" to be equal to a variable name, not a string.

if I use

Code:
 

nameology = desc + growth; 
 


it doesnt work because DESC doesnt have a value... if I give it one its either numeric or a string (or boolean or...)
and if I keep it the way it is, the value of nameology is "Desc1", "Desc2" etc... I figured this is because

Code:

nameology = "desc" + growth; 
 


creates a string. which is no good. Unless I can convert this string (which I dont know if is possible) to be read as a variable (the same variables that are at the top of the code (desc1 = "ring"; ... desc2 = "necklace"; ) )

have I confused everybody?

Thanks in advance...

Reply With Quote
  #2  
Old December 9th, 2003, 09:48 AM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,713 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 9974 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 10 h 25 m 58 sec
Reputation Power: 580
Facebook MySpace
Hi, have you tried eval?

nameology = eval("desc" + growth);

Lemme know how that goes, I'll test it out later if that doesnt work.
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
  #3  
Old December 9th, 2003, 09:56 AM
mopie mopie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 22 mopie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to mopie
Sweeet jummping jesus on a pogo stick

it works!

THanks ever so much

Reply With Quote
  #4  
Old December 9th, 2003, 10:03 AM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,713 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 9974 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 10 h 25 m 58 sec
Reputation Power: 580
Facebook MySpace
hehe yer I had loads of trouble on similar things till I found that. It works for movie names as well i.e.

eval("mymovie" + i)._x = 10;

Doesnt work all the time though, Macromedia have a technote or two on the subject.

Glad to have helped :¬)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > how do I unconcatenate a string


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 4 hosted by Hostway
Stay green...Green IT