PDA

View Full Version : Dynamic variables... how to create?



Leo75
February 24th, 2009, 10:13 AM
Hi there…
I am trying to create dynamic variables.
Lets say:
I read a file where I have: building, restaurant and hotel.

Then, will load those values like…
X = building.
Y = restaurant
Z = hotel.

Now I want to create variables like: building._alpha = 0; restaurant._alpha = 0; hotel._alpha =0;
So on…

I guess the question is how to use the value (building, restaurant, hotel) on naming or creating variables to use them later…

Thanks.
Cheers.
Leo.

sk8er5960
February 24th, 2009, 10:26 PM
your confusing instance names for variables.. In other words variables don't have attributes such as "alpha", "width", etc.. Instead movieClips with instance names assigned to them(defined in the the properties panel) have these attributes. This is something that is pivotal to understanding flash.

instance names = "names" used in actionScript used to refer to movieClips
variables = "names" that store data to be used in actionScript, commonly used to refer to the attributes of movie clips.

example:

buildingSectionAlpha = 100;
buildingSection_mc._alpha = buildingSectionAlpha;

hope that helps a little