Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-2008, 04:19 PM
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default root aray?

can you use the root as an array to access objects?
eg in flash this would work:

thing1="hello";
i=1;
trace(_root["thing"+i]);//outputs hello
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 07:51 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: root aray?

No, not in ffish script. You will have to use the "FlashPlayer.getVariable" method
Code:
var value = FlashPlayer.getVariable("_root.thing" + i);
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 06:21 AM
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default Re: root aray?

so what about for a variable called thing1 that was inside the ffish script and not the actionscript.
becuase I want code that uses a for loop, and runs for lots of variables.
Reply With Quote
  #4 (permalink)  
Old 03-05-2008, 08:55 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: root aray?

You can define an object and set the variables as properties of the object
Code:
var x = new Object;
for (var i = 0; i < 1000; i++) {
	x["thing" + i] = "thing" + i;
}

trace(x.thing100);
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:03 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.