Skip to main content
Inspiring
September 5, 2006
Question

Trouble passing variable

  • September 5, 2006
  • 1 reply
  • 218 views
I have looped item and window to use the same photo in two different places. I can't get the unique Id for the window loop clicked into the last line of code to control the alpha: "_root.project["window" + Id].pix._alpha = 100;" Is there a way to do? Any help is appreciated.
thanks
yogi b

for(i=0; i < gOverview.itemCount; i++){
_root.project["item"+i]._visible = true;
_root.project["item"+i].description = "<b>" + gOverview["proName"+i] + "</b>: " + gOverview["proDescription"+i];
_root.project["item"+i].Id = gOverview["proId"+i];
_root.project["item"+i].imageHolder.loadMovie(gOverview["proImage"+i]);
_root.project["window"+i].pix.loadMovie(gOverview["proImage"+i]);


_root.project["item"+i].item_btn.onPress = function () {
itemClicked (this._parent.Id);
for (var i = 0; i < gOverview.itemCount; ++i) {
_root.project["item"+i].imageHolder._alpha = 100;
_root.project["window"+i].pix._alpha = 0;

}
this._parent.imageHolder._alpha = 50;
_root.project["window" + Id].pix._alpha = 100;


}

}
This topic has been closed for replies.

1 reply

Participating Frequently
September 5, 2006
try this

for (i=0; i<gOverview.itemCount; i++) {
_root.project["item"+i]._visible = true;
_root.project["item"+i].description = "<b>"+gOverview["proName"+i]+"</b>: "+gOverview["proDescription"+i];
_root.project["item"+i].Id = gOverview["proId"+i];
_root.project["item"+i].imageHolder.loadMovie(gOverview["proImage"+i]);
_root.project["window"+i].pix.loadMovie(gOverview["proImage"+i]);
_root.project["item"+i].item_btn.onPress = function() {
itemClicked(this._parent.Id);
for (var j = 0; j<gOverview.itemCount; ++j) {
_root.project["item"+j].imageHolder._alpha = 100;
_root.project["window"+j].pix._alpha = 0;
}
this._parent.imageHolder._alpha = 50;
_root.project["window"+this._parent.Id].pix._alpha = 100;
};
}


Firas Darweesh
yogi bearAuthor
Inspiring
September 5, 2006
Firas,

That was a good idea but didn't work. I changed:

_root.project["item"+i].Id = gOverview["proId"+i];

to

_root.project["item"+i].Id = i;

and everthing worked.

Thanks,
Yogi b