HI all,
I modified it and now its working.
Here is the revised code:
if (screen_Name == "Tab") {
_root.depth++;
var Tab_Int_MC = mainMC.createEmptyMovieClip("TabMenu_Int",
_root.depth);
var temp_Array1 = [];
var temp_Array2 = [];
for (var i = 0; i<3; i++) {
_root.depth++;
Tab_Int_MC.attachMovie("GR_BG_TAB_icon_unselect_theme1",
"GR_BG_TAB_icon_unselect_theme1_"+i, _root.depth);
TT = this["Tab"+i];
TT = Tab_Int_MC["GR_BG_TAB_icon_unselect_theme1_"+i];
TT._x = 35*i;
TT._y = 19;
_root.depth++;
Tab_Int_MC.attachMovie("GR_BG_TAB_icon_select_Theme1",
"GR_BG_TAB_icon_select_Theme1_"+i, _root.depth);
TT_hlt = this["TT_hlt"+i];
TT_hlt = Tab_Int_MC["GR_BG_TAB_icon_select_Theme1_"+i];
TT_hlt._x = 35*i;
TT_hlt._y = 19;
temp_Array1.push(TT);
temp_Array2.push(TT_hlt);
temp_Array2[i]._visible = false;
//trace(TT);
}
for (var j = 0; j<temp_Array1.length; j++) {
trace("J: "+temp_Array1[j]);
temp_Array1[j].me = temp_Array1[j];
temp_Array1[j].partner = temp_Array2[j];
temp_Array1[j].onRollOver = function() {
//trace(this.me);
this.partner._visible = true;
drawOutline(this.me, "TL");
};
temp_Array1[j].onRollOut = function() {
this.partner._visible = false;
removeOutline(this.me._parent.Highlight);
};
temp_Array1[j].onRelease = function() {
DisplayData(this.me, xPos, yPos, width,
height, "left");
};
}
Sajid
On 4/7/06, Arul Prasad <[EMAIL PROTECTED]> wrote:
> i tried picking up the for loop from ur code and trying it out, and am am
> able to see the rollOver fn being triggered. Not sure why it isnt working
> for u. If your mcs are not getting attached at all, probably u have to check
> if ur _root.depth variable has been initialized.
>
> ~Arul Prasad.
>
>
> On 4/7/06, Sajid Saiyed <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > Trying to figure this out.
> >
> > I want to create dynamic movieclips within a for loop and assign
> > actions to each created movieclip.
> >
> > When I try to do it this way, it does not seem to work:
> >
> > if (screen_Name == "Tab") {
> > _root.depth++;
> > var Tab_Int_MC = mainMC.createEmptyMovieClip("TabMenu_Int",
> > _root.depth);
> > for (var i = 0; i<3; i++) {
> > _root.depth++;
> >
> >
> > Tab_Int_MC.attachMovie("GR_BG_TAB_icon_unselect_theme1",
> > "GR_BG_TAB_icon_unselect_theme1_"+i, _root.depth);
> > this["Tab"+i] =
> > Tab_Int_MC["GR_BG_TAB_icon_unselect_theme1_"+i];
> > this["Tab"+i]._x = 35*i;
> > this["Tab"+i]._y = 19;
> > _root.depth++;
> >
> >
> > Tab_Int_MC.attachMovie("GR_BG_TAB_icon_select_Theme1",
> > "GR_BG_TAB_icon_select_Theme1_"+i, _root.depth);
> > this["TT_hlt"+i] =
> > Tab_Int_MC["GR_BG_TAB_icon_select_Theme1_"+i];
> > this["TT_hlt"+i]._x = 35*i;
> > this["TT_hlt"+i]._y = 19;
> > this["TT_hlt"+i]._visible = false;
> > this["Tab"+i].onRollOver = function() {
> > this["TT_hlt"+i]._visible = true;
> > drawOutline(this["Tab"+i], "TL");
> > };
> > this["Tab"+i].onRollOut = function() {
> > this["TT_hlt"+i]._visible = false;
> >
> >
> > removeOutline(this["Tab"+i]._parent.Highlight);
> > };
> > this["Tab"+i].onRelease = function() {
> > DisplayData(this["Tab"+i], xPos, yPos,
> > width, height, "left");
> > };
> > }
> >
> > So I tried it this way also and it didnt work:
> >
> > if (screen_Name == "Tab") {
> > _root.depth++;
> > var Tab_Int_MC = mainMC.createEmptyMovieClip("TabMenu_Int",
> > _root.depth);
> > for (var i = 0; i<3; i++) {
> > _root.depth++;
> >
> >
> > Tab_Int_MC.attachMovie("GR_BG_TAB_icon_unselect_theme1",
> > "GR_BG_TAB_icon_unselect_theme1_"+i, _root.depth);
> > TT = this["Tab"+i];
> > TT =
> > Tab_Int_MC["GR_BG_TAB_icon_unselect_theme1_"+i];
> > TT._x = 35*i;
> > TT._y = 19;
> > _root.depth++;
> >
> >
> > Tab_Int_MC.attachMovie("GR_BG_TAB_icon_select_Theme1",
> > "GR_BG_TAB_icon_select_Theme1_"+i, _root.depth);
> > TT_hlt = this["TT_hlt"+i];
> > TT_hlt =
> > Tab_Int_MC["GR_BG_TAB_icon_select_Theme1_"+i];
> > TT_hlt._x = 35*i;
> > TT_hlt._y = 19;
> > TT_hlt._visible = false;
> > TT.onRollOver = function() {
> > TT_hlt._visible = true;
> > drawOutline(TT, "TL");
> > };
> > TT.onRollOut = function() {
> > TT_hlt._visible = false;
> > removeOutline(TT._parent.Highlight);
> > };
> > TT.onRelease = function() {
> > DisplayData(TT, xPos, yPos, width, height,
> > "left");
> > };
> > }
> >
> > Can someone help me debug this?
> >
> > Thanks
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com