Re: [Flashcoders] Need help dynamically adding a layer to a MC.
Andrei, themask is in there according to debug lists but I can't see it in the .swf... What/where is Frame 0 ? Seems to be instanciated but not loaded. Can't find a command to explicitly load it. Also interesting that I can't seem to force the level on any of the movie clips. Thanks, Teresa Level #0: Frame=1 Shape: Movie Clip: Frame=1 Target="_level0.img_mc0" Shape: Movie Clip: Frame=0 Target="_level0.img_mc0.themask" Movie Clip: Frame=1 Target="_level0.img_mc1" Shape: Movie Clip: Frame=0 Target="_level0.img_mc1.themask" . . .etc On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: i guess you need to change: mcTemp.duplicateMovieClip("themask", "idono"+k, this.getNextHighestDepth ()); to: mcTemp.duplicateMovieClip("themask", "idono"+k, mcTemp.getNextHighestDepth ()); []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > Andrei, > Significant progress...following your suggestions... > > temp = "wrapper"+k; > mcTemp = target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth > ()); > mcTemp.duplicateMovieClip("themask", "idono"+k, > this.getNextHighestDepth > ()); > mcTemp.blendMode = "layer"; > trace(k); > > I made one further change because the .attachMovieClip was not executing. > I > moved to .duplicateMovieClip and now see "themask" showing up in debug > list. > (Although still not in the .swf) In the process, I found this variable > list > in the debug mode. I have no idea what this means but anything that says > must be a hint! > > Thanks so much for being here today to help me through this! > T > > > Variable _level0.i = 13 > Variable _level0.j = 22 > Variable _level0.instofimg = "img_mc12" > Variable _level0.img_mcl = [object #5, class 'MovieClipLoader'] {} > Variable _level0.ratio = 4 > Variable _level0.temp = "wrapper3" > Variable _level0.mcTemp = [movieclip:] > Movie Clip: Target="_level0.img_mc0" > Movie Clip: Target="_level0.img_mc1" > Movie Clip: Target="_level0.img_mc2" > Movie Clip: Target="_level0.img_mc3" > Movie Clip: Target="_level0.img_mc4" > Movie Clip: Target="_level0.img_mc5" > Movie Clip: Target="_level0.img_mc6" > Movie Clip: Target="_level0.img_mc7" > Movie Clip: Target="_level0.img_mc8" > Movie Clip: Target="_level0.img_mc9" > > On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > > > change > > > > temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); > > > > for > > > > temp.attachMovie("themask", "idono"+k, temp.getNextHighestDepth()); > > > > you need the next depth inside the empty movieclip. And you also need a > > reference to the empty movieclip: > > > > > > //target_mc.addMask = function() { > > temp = "wrapper" + k; > > mcTemp = target_mc.createEmptyMovieClip(temp, > > this.getNextHighestDepth()); > > > > mcTemp.attachMovie("themask", "idono"+k, this.getNextHighestDepth > ()); > > mcTemp.blendMode = "layer"; > > trace(k); > > //}; > > > > in your code, temp is a string, not a movieclip. This may be the > problem. > > > > []'s > > andrei > > > > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > > > I ditched the function() since it wasn't executing and tried your > > > suggestion. The debugger now shows the "wrapper"..s getting added to > the > > > movieclips. Hmm...progress. But the temp.attachMovie is not executing > on > > > any > > > layer anywhere. I just don't see why. > > > Thanks, > > > T > > > > > > //target_mc.addMask = function() { > > > temp = "wrapper" + k; > > > target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth ()); > > > > > > temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth > ()); > > > temp.blendMode = "layer"; > > > trace(k); > > > //}; > > > > > > On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > > > > > > > I guess you have to create an empty movie clip inside target_mc, and > > > > attach > > > > the mask to it. > > > > > > > > []'s > > > > andrei > > > > > > > > > > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Just joined... and by reading today's posts, it looks like I am in > > the > > > > > right > > > > > place to get help on this. > > > > > > > > > > I am dynamically creating movie clips and loading each with a .jpg > > and > > > a > > > > > layer with a mask. It is the addMask step that doesn't work. I > have > > > > > written > > > > > this a dozen different ways and have only confused > myself. Stepping > > > > > through > > > > > the code I learned that it creates all the movie clips first and > > then > > > > goes > > > > > to the onLoadInit and sets all the properties. It skips my attempt > > at > > > an > > > > > addMask function. The linkage id of the mask in the library is > > > > "themask". > > > > > I > > > > > tested this line separately in a different file. It sort of works > > > > although > > > > > I > > > > > couldn't tell if it was loading the mask into the movie clip or > the > > > main > > > > > timeline. Yes, I am a beginne
Re: [Flashcoders] Need help dynamically adding a layer to a MC.
i guess you need to change: mcTemp.duplicateMovieClip("themask", "idono"+k, this.getNextHighestDepth ()); to: mcTemp.duplicateMovieClip("themask", "idono"+k, mcTemp.getNextHighestDepth ()); []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: Andrei, Significant progress...following your suggestions... temp = "wrapper"+k; mcTemp = target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth ()); mcTemp.duplicateMovieClip("themask", "idono"+k, this.getNextHighestDepth ()); mcTemp.blendMode = "layer"; trace(k); I made one further change because the .attachMovieClip was not executing. I moved to .duplicateMovieClip and now see "themask" showing up in debug list. (Although still not in the .swf) In the process, I found this variable list in the debug mode. I have no idea what this means but anything that says must be a hint! Thanks so much for being here today to help me through this! T Variable _level0.i = 13 Variable _level0.j = 22 Variable _level0.instofimg = "img_mc12" Variable _level0.img_mcl = [object #5, class 'MovieClipLoader'] {} Variable _level0.ratio = 4 Variable _level0.temp = "wrapper3" Variable _level0.mcTemp = [movieclip:] Movie Clip: Target="_level0.img_mc0" Movie Clip: Target="_level0.img_mc1" Movie Clip: Target="_level0.img_mc2" Movie Clip: Target="_level0.img_mc3" Movie Clip: Target="_level0.img_mc4" Movie Clip: Target="_level0.img_mc5" Movie Clip: Target="_level0.img_mc6" Movie Clip: Target="_level0.img_mc7" Movie Clip: Target="_level0.img_mc8" Movie Clip: Target="_level0.img_mc9" On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > change > > temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); > > for > > temp.attachMovie("themask", "idono"+k, temp.getNextHighestDepth()); > > you need the next depth inside the empty movieclip. And you also need a > reference to the empty movieclip: > > > //target_mc.addMask = function() { > temp = "wrapper" + k; > mcTemp = target_mc.createEmptyMovieClip(temp, > this.getNextHighestDepth()); > > mcTemp.attachMovie("themask", "idono"+k, this.getNextHighestDepth ()); > mcTemp.blendMode = "layer"; > trace(k); > //}; > > in your code, temp is a string, not a movieclip. This may be the problem. > > []'s > andrei > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > I ditched the function() since it wasn't executing and tried your > > suggestion. The debugger now shows the "wrapper"..s getting added to the > > movieclips. Hmm...progress. But the temp.attachMovie is not executing on > > any > > layer anywhere. I just don't see why. > > Thanks, > > T > > > > //target_mc.addMask = function() { > > temp = "wrapper" + k; > > target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); > > > > temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth ()); > > temp.blendMode = "layer"; > > trace(k); > > //}; > > > > On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > > > > > I guess you have to create an empty movie clip inside target_mc, and > > > attach > > > the mask to it. > > > > > > []'s > > > andrei > > > > > > > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > > > > > Just joined... and by reading today's posts, it looks like I am in > the > > > > right > > > > place to get help on this. > > > > > > > > I am dynamically creating movie clips and loading each with a .jpg > and > > a > > > > layer with a mask. It is the addMask step that doesn't work. I have > > > > written > > > > this a dozen different ways and have only confused myself. Stepping > > > > through > > > > the code I learned that it creates all the movie clips first and > then > > > goes > > > > to the onLoadInit and sets all the properties. It skips my attempt > at > > an > > > > addMask function. The linkage id of the mask in the library is > > > "themask". > > > > I > > > > tested this line separately in a different file. It sort of works > > > although > > > > I > > > > couldn't tell if it was loading the mask into the movie clip or the > > main > > > > timeline. Yes, I am a beginner. And yes, I am going to go out and > get > > > the > > > > Flash 8 Essentials book based on the posts I read today. Any > > suggestions > > > > greatly appreciated!!! > > > > > > > > Thanks, > > > > T > > > > > > > > ... > > > > max = 12; > > > > //array of positions for x and y > > > > var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, > > 200, > > > > 400, > > > > 600, 0); > > > > var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, > 400, > > > 400, > > > > 400, 600); > > > > k = 0; > > > > var mcl_obj:Object = new Object(); > > > > mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { > > > > target_mc._x = pos_x[k]; > > > > target_mc._y = pos_y[k]; > > > > if (target_mc._width>200) { > > > > ratio = target_mc._width/200; > > > > target_mc._width = target_mc._width/ratio; > > > > target_mc._height
Re: [Flashcoders] Need help dynamically adding a layer to a MC.
Andrei, Significant progress...following your suggestions... temp = "wrapper"+k; mcTemp = target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth ()); mcTemp.duplicateMovieClip("themask", "idono"+k, this.getNextHighestDepth ()); mcTemp.blendMode = "layer"; trace(k); I made one further change because the .attachMovieClip was not executing. I moved to .duplicateMovieClip and now see "themask" showing up in debug list. (Although still not in the .swf) In the process, I found this variable list in the debug mode. I have no idea what this means but anything that says must be a hint! Thanks so much for being here today to help me through this! T Variable _level0.i = 13 Variable _level0.j = 22 Variable _level0.instofimg = "img_mc12" Variable _level0.img_mcl = [object #5, class 'MovieClipLoader'] {} Variable _level0.ratio = 4 Variable _level0.temp = "wrapper3" Variable _level0.mcTemp = [movieclip:] Movie Clip: Target="_level0.img_mc0" Movie Clip: Target="_level0.img_mc1" Movie Clip: Target="_level0.img_mc2" Movie Clip: Target="_level0.img_mc3" Movie Clip: Target="_level0.img_mc4" Movie Clip: Target="_level0.img_mc5" Movie Clip: Target="_level0.img_mc6" Movie Clip: Target="_level0.img_mc7" Movie Clip: Target="_level0.img_mc8" Movie Clip: Target="_level0.img_mc9" On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: change temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); for temp.attachMovie("themask", "idono"+k, temp.getNextHighestDepth()); you need the next depth inside the empty movieclip. And you also need a reference to the empty movieclip: //target_mc.addMask = function() { temp = "wrapper" + k; mcTemp = target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); mcTemp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); mcTemp.blendMode = "layer"; trace(k); //}; in your code, temp is a string, not a movieclip. This may be the problem. []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > I ditched the function() since it wasn't executing and tried your > suggestion. The debugger now shows the "wrapper"..s getting added to the > movieclips. Hmm...progress. But the temp.attachMovie is not executing on > any > layer anywhere. I just don't see why. > Thanks, > T > > //target_mc.addMask = function() { > temp = "wrapper" + k; > target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); > > temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); > temp.blendMode = "layer"; > trace(k); > //}; > > On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > > > I guess you have to create an empty movie clip inside target_mc, and > > attach > > the mask to it. > > > > []'s > > andrei > > > > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > > > Just joined... and by reading today's posts, it looks like I am in the > > > right > > > place to get help on this. > > > > > > I am dynamically creating movie clips and loading each with a .jpg and > a > > > layer with a mask. It is the addMask step that doesn't work. I have > > > written > > > this a dozen different ways and have only confused myself. Stepping > > > through > > > the code I learned that it creates all the movie clips first and then > > goes > > > to the onLoadInit and sets all the properties. It skips my attempt at > an > > > addMask function. The linkage id of the mask in the library is > > "themask". > > > I > > > tested this line separately in a different file. It sort of works > > although > > > I > > > couldn't tell if it was loading the mask into the movie clip or the > main > > > timeline. Yes, I am a beginner. And yes, I am going to go out and get > > the > > > Flash 8 Essentials book based on the posts I read today. Any > suggestions > > > greatly appreciated!!! > > > > > > Thanks, > > > T > > > > > > ... > > > max = 12; > > > //array of positions for x and y > > > var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, > 200, > > > 400, > > > 600, 0); > > > var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, > > 400, > > > 400, 600); > > > k = 0; > > > var mcl_obj:Object = new Object(); > > > mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { > > > target_mc._x = pos_x[k]; > > > target_mc._y = pos_y[k]; > > > if (target_mc._width>200) { > > > ratio = target_mc._width/200; > > > target_mc._width = target_mc._width/ratio; > > > target_mc._height = target_mc._height/ratio; > > > } > > > //---broken part starts here-- > > > target_mc.addMask = function() { > > > target_mc.attachMovie("themask", "idono"+i, > > > this.getNextHighestDepth > > > ()); > > > target_mc.blendMode = "layer"; > > > trace(i); > > > }; > > > //--end of broken part -- > > > //trace ("x "+pos_x[k]); > > > //trace ("y "+pos_y[k]); > > > target_mc.onPress = function(
Re: [Flashcoders] Need help dynamically adding a layer to a MC.
change temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); for temp.attachMovie("themask", "idono"+k, temp.getNextHighestDepth()); you need the next depth inside the empty movieclip. And you also need a reference to the empty movieclip: //target_mc.addMask = function() { temp = "wrapper" + k; mcTemp = target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); mcTemp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); mcTemp.blendMode = "layer"; trace(k); //}; in your code, temp is a string, not a movieclip. This may be the problem. []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: I ditched the function() since it wasn't executing and tried your suggestion. The debugger now shows the "wrapper"..s getting added to the movieclips. Hmm...progress. But the temp.attachMovie is not executing on any layer anywhere. I just don't see why. Thanks, T //target_mc.addMask = function() { temp = "wrapper" + k; target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); temp.blendMode = "layer"; trace(k); //}; On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: > > I guess you have to create an empty movie clip inside target_mc, and > attach > the mask to it. > > []'s > andrei > > > On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > > > Just joined... and by reading today's posts, it looks like I am in the > > right > > place to get help on this. > > > > I am dynamically creating movie clips and loading each with a .jpg and a > > layer with a mask. It is the addMask step that doesn't work. I have > > written > > this a dozen different ways and have only confused myself. Stepping > > through > > the code I learned that it creates all the movie clips first and then > goes > > to the onLoadInit and sets all the properties. It skips my attempt at an > > addMask function. The linkage id of the mask in the library is > "themask". > > I > > tested this line separately in a different file. It sort of works > although > > I > > couldn't tell if it was loading the mask into the movie clip or the main > > timeline. Yes, I am a beginner. And yes, I am going to go out and get > the > > Flash 8 Essentials book based on the posts I read today. Any suggestions > > greatly appreciated!!! > > > > Thanks, > > T > > > > ... > > max = 12; > > //array of positions for x and y > > var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, 200, > > 400, > > 600, 0); > > var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, > 400, > > 400, 600); > > k = 0; > > var mcl_obj:Object = new Object(); > > mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { > > target_mc._x = pos_x[k]; > > target_mc._y = pos_y[k]; > > if (target_mc._width>200) { > > ratio = target_mc._width/200; > > target_mc._width = target_mc._width/ratio; > > target_mc._height = target_mc._height/ratio; > > } > > //---broken part starts here-- > > target_mc.addMask = function() { > > target_mc.attachMovie("themask", "idono"+i, > > this.getNextHighestDepth > > ()); > > target_mc.blendMode = "layer"; > > trace(i); > > }; > > //--end of broken part -- > > //trace ("x "+pos_x[k]); > > //trace ("y "+pos_y[k]); > > target_mc.onPress = function() { > > trace("drag goes here"); > > }; > > k = k+1; > > }; > > for (var i = 0; i<=max; i++) { > > //trace(i); > > j = 10+i; > > var instofimg = new Object(); > > instofimg = "img_mc"+i; > > this.createEmptyMovieClip(instofimg, j); > > var img_mcl:MovieClipLoader = new MovieClipLoader(); > > img_mcl.addListener(mcl_obj); > > //load image into movieclip > > img_mcl.loadClip("image"+i+".jpg", instofimg); > > > > } > > ___ > > 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 > ___ 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] Need help dynamically adding a layer to a MC.
I ditched the function() since it wasn't executing and tried your suggestion. The debugger now shows the "wrapper"..s getting added to the movieclips. Hmm...progress. But the temp.attachMovie is not executing on any layer anywhere. I just don't see why. Thanks, T //target_mc.addMask = function() { temp = "wrapper" + k; target_mc.createEmptyMovieClip(temp, this.getNextHighestDepth()); temp.attachMovie("themask", "idono"+k, this.getNextHighestDepth()); temp.blendMode = "layer"; trace(k); //}; On 2/4/07, Andrei Thomaz <[EMAIL PROTECTED]> wrote: I guess you have to create an empty movie clip inside target_mc, and attach the mask to it. []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: > > Just joined... and by reading today's posts, it looks like I am in the > right > place to get help on this. > > I am dynamically creating movie clips and loading each with a .jpg and a > layer with a mask. It is the addMask step that doesn't work. I have > written > this a dozen different ways and have only confused myself. Stepping > through > the code I learned that it creates all the movie clips first and then goes > to the onLoadInit and sets all the properties. It skips my attempt at an > addMask function. The linkage id of the mask in the library is "themask". > I > tested this line separately in a different file. It sort of works although > I > couldn't tell if it was loading the mask into the movie clip or the main > timeline. Yes, I am a beginner. And yes, I am going to go out and get the > Flash 8 Essentials book based on the posts I read today. Any suggestions > greatly appreciated!!! > > Thanks, > T > > ... > max = 12; > //array of positions for x and y > var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, 200, > 400, > 600, 0); > var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, 400, > 400, 600); > k = 0; > var mcl_obj:Object = new Object(); > mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { > target_mc._x = pos_x[k]; > target_mc._y = pos_y[k]; > if (target_mc._width>200) { > ratio = target_mc._width/200; > target_mc._width = target_mc._width/ratio; > target_mc._height = target_mc._height/ratio; > } > //---broken part starts here-- > target_mc.addMask = function() { > target_mc.attachMovie("themask", "idono"+i, > this.getNextHighestDepth > ()); > target_mc.blendMode = "layer"; > trace(i); > }; > //--end of broken part -- > //trace ("x "+pos_x[k]); > //trace ("y "+pos_y[k]); > target_mc.onPress = function() { > trace("drag goes here"); > }; > k = k+1; > }; > for (var i = 0; i<=max; i++) { > //trace(i); > j = 10+i; > var instofimg = new Object(); > instofimg = "img_mc"+i; > this.createEmptyMovieClip(instofimg, j); > var img_mcl:MovieClipLoader = new MovieClipLoader(); > img_mcl.addListener(mcl_obj); > //load image into movieclip > img_mcl.loadClip("image"+i+".jpg", instofimg); > > } > ___ > 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 ___ 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] Need help dynamically adding a layer to a MC.
I guess you have to create an empty movie clip inside target_mc, and attach the mask to it. []'s andrei On 2/4/07, Teresa Hardy <[EMAIL PROTECTED]> wrote: Just joined... and by reading today's posts, it looks like I am in the right place to get help on this. I am dynamically creating movie clips and loading each with a .jpg and a layer with a mask. It is the addMask step that doesn't work. I have written this a dozen different ways and have only confused myself. Stepping through the code I learned that it creates all the movie clips first and then goes to the onLoadInit and sets all the properties. It skips my attempt at an addMask function. The linkage id of the mask in the library is "themask". I tested this line separately in a different file. It sort of works although I couldn't tell if it was loading the mask into the movie clip or the main timeline. Yes, I am a beginner. And yes, I am going to go out and get the Flash 8 Essentials book based on the posts I read today. Any suggestions greatly appreciated!!! Thanks, T ... max = 12; //array of positions for x and y var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, 200, 400, 600, 0); var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, 400, 400, 600); k = 0; var mcl_obj:Object = new Object(); mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { target_mc._x = pos_x[k]; target_mc._y = pos_y[k]; if (target_mc._width>200) { ratio = target_mc._width/200; target_mc._width = target_mc._width/ratio; target_mc._height = target_mc._height/ratio; } //---broken part starts here-- target_mc.addMask = function() { target_mc.attachMovie("themask", "idono"+i, this.getNextHighestDepth ()); target_mc.blendMode = "layer"; trace(i); }; //--end of broken part -- //trace ("x "+pos_x[k]); //trace ("y "+pos_y[k]); target_mc.onPress = function() { trace("drag goes here"); }; k = k+1; }; for (var i = 0; i<=max; i++) { //trace(i); j = 10+i; var instofimg = new Object(); instofimg = "img_mc"+i; this.createEmptyMovieClip(instofimg, j); var img_mcl:MovieClipLoader = new MovieClipLoader(); img_mcl.addListener(mcl_obj); //load image into movieclip img_mcl.loadClip("image"+i+".jpg", instofimg); } ___ 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
[Flashcoders] Need help dynamically adding a layer to a MC.
Just joined... and by reading today's posts, it looks like I am in the right place to get help on this. I am dynamically creating movie clips and loading each with a .jpg and a layer with a mask. It is the addMask step that doesn't work. I have written this a dozen different ways and have only confused myself. Stepping through the code I learned that it creates all the movie clips first and then goes to the onLoadInit and sets all the properties. It skips my attempt at an addMask function. The linkage id of the mask in the library is "themask". I tested this line separately in a different file. It sort of works although I couldn't tell if it was loading the mask into the movie clip or the main timeline. Yes, I am a beginner. And yes, I am going to go out and get the Flash 8 Essentials book based on the posts I read today. Any suggestions greatly appreciated!!! Thanks, T ... max = 12; //array of positions for x and y var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, 200, 400, 600, 0); var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, 400, 400, 600); k = 0; var mcl_obj:Object = new Object(); mcl_obj.onLoadInit = function(target_mc:MovieClip):Void { target_mc._x = pos_x[k]; target_mc._y = pos_y[k]; if (target_mc._width>200) { ratio = target_mc._width/200; target_mc._width = target_mc._width/ratio; target_mc._height = target_mc._height/ratio; } //---broken part starts here-- target_mc.addMask = function() { target_mc.attachMovie("themask", "idono"+i, this.getNextHighestDepth ()); target_mc.blendMode = "layer"; trace(i); }; //--end of broken part -- //trace ("x "+pos_x[k]); //trace ("y "+pos_y[k]); target_mc.onPress = function() { trace("drag goes here"); }; k = k+1; }; for (var i = 0; i<=max; i++) { //trace(i); j = 10+i; var instofimg = new Object(); instofimg = "img_mc"+i; this.createEmptyMovieClip(instofimg, j); var img_mcl:MovieClipLoader = new MovieClipLoader(); img_mcl.addListener(mcl_obj); //load image into movieclip img_mcl.loadClip("image"+i+".jpg", instofimg); } ___ 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