AS2: ._width variable not working

Hi, i posted yesterday about dynamic thumbnail sizes for an xml gallery.
Everything worked (thanks to help from Graphixboy) but i ran into a problem that seems easy but is alluding me.

I have an mc that loads thumbnail images which are then displayed sequentially in a scroller.

I have an array that contains the individual widths of the images and i can get them correlating to the specific images. However:

when i try to change the hit size of the images (controlled by a hitSize mc which is just a red box) it won’t change the ._width of the hitSize mc according to the variable.

This is what i can do:

hitSize._width = 100; 

(which works)

This what i have:

hitwidth = _root.projectsB[this.menuNum]; //this is the individual width of the image being loaded
hitwidth = this.hitSize._width;

if i trace(hitwidth); i get the correct number, but the above code won’t change the size of the mc

the above code is in the correct section.

thanks.

not sure I follow your problem, but wouldn’t it be:


hitwidth = _root.projectsB[this.menuNum]; //this is the individual width of the image being loaded
this.hitSize._width = hitwidth;

Thats correct syntax - so i changed, but alas no difference :frowning:

essentially i want the container of the images to have different widths according to the values i specified in the array. so hitSize._width = array value.

The code in the original post should work but i don’t know why…

sometimes what i’ve found can happen when loading in data dynamically is that the variable type that is loaded in is not exactly what you want.

eg. twenty-three = of type string.
23 could also be recognised as a string.

try reseting the type attribute to number:


hitwidth = _root.projectsB[this.menuNum];//origional
hitwidth = new Number(_root.projectsB[this.menuNum]);//modified