Re: [Flashcoders] Assigning actions to dynamic movieclips
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 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._visi
Re: [Flashcoders] Assigning actions to dynamic movieclips
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 > ___ > Flashcoders@chattyfig.figleaf.com > 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 > ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] Assigning actions to dynamic movieclips
No! :OD But what you could do is write a test case and work from that. It will probably be a pathing issue. Trace the objects you are trying to assign actions to. Adrian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Sajid Saiyed Sent: 07 April 2006 11:55 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Assigning actions to dynamic movieclips 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 ___ Flashcoders@chattyfig.figleaf.com 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