Re: [Flashcoders] problem creating multiple instances
Finally found the problem!! In the end it was very simple. I did not define _myMouseListener:Object in the correct place, and it was being overwritten. Thanks for the help! Cheers, - Bill On May 24, 2007, at 6:41 AM, Bill Mackin wrote: Yes it is. It is the name the person designates to the plane at runtime. On May 23, 2007, at 9:58 PM, David Ngo wrote: Where are you getting 'myName'? Is that a unique name per instance? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 6:33 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances After reading your first e-mail I did go through and make a change here, but it did not resolve the issue. _mcLibrary = _scope.attachMovie(libraryLink, "mcLibrary"+myName, _scope.getNextHighestDepth()); The line you mention is not the MovieClip reference for the plane, but a MovieClip created to create a BitmapData object. _bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true, 0x00); This BitmapData object is later placed into the plane reference MovieClip. At least that is my understanding... YIKES! _di = new DistortImage(_mc, _bd, vQuality, hQuality); I'm not able to post the class inside the e-mail anymore, it exceeds the maximum file size allowed by flashcoders. If you need the class file again I will create a link to all of the files. Thanks for your response! On May 23, 2007, at 4:03 PM, David Ngo wrote: Yeah, you're using the same MovieClip name reference. I do believe you can't have two objects share the same name. You'll get concurrency issues with that on this line: _mcLibrary = _scope.attachMovie(libraryLink,"mcLibrary", _scope.getNextHighestDepth()); You'll need to create a unique ID for it. I would probably suggest either within your creation object, or have an ID factory (should probably be a hybrid Singleton/Factory) that just generates unique ID's that you can append to your instance names. As for the custom class, it's nothing more than a blank class with public variables (or private ones and getter/setter methods) that contain the data you want to pass. OR, since you use two separate objects, just have a single object compose both. There are many ways to go about doing it, so it just boils down to preference I guess. ___ 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 ___ 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] problem creating multiple instances
Muzak, Thanks for your suggestion, I will look into XRay for future projects. I have of course placed several trace commands throughout my code, but I am still unable to find the problem. Cheers, - Bill On May 23, 2007, at 9:46 PM, Muzak wrote: I suggest you start placing some trace()'s in your code so you can track what happens. And get XRay.. http://osflash.org/xray regards, Muzak ___ 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] problem creating multiple instances
Yes it is. It is the name the person designates to the plane at runtime. On May 23, 2007, at 9:58 PM, David Ngo wrote: Where are you getting 'myName'? Is that a unique name per instance? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 6:33 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances After reading your first e-mail I did go through and make a change here, but it did not resolve the issue. _mcLibrary = _scope.attachMovie(libraryLink, "mcLibrary"+myName, _scope.getNextHighestDepth()); The line you mention is not the MovieClip reference for the plane, but a MovieClip created to create a BitmapData object. _bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true, 0x00); This BitmapData object is later placed into the plane reference MovieClip. At least that is my understanding... YIKES! _di = new DistortImage(_mc, _bd, vQuality, hQuality); I'm not able to post the class inside the e-mail anymore, it exceeds the maximum file size allowed by flashcoders. If you need the class file again I will create a link to all of the files. Thanks for your response! On May 23, 2007, at 4:03 PM, David Ngo wrote: Yeah, you're using the same MovieClip name reference. I do believe you can't have two objects share the same name. You'll get concurrency issues with that on this line: _mcLibrary = _scope.attachMovie(libraryLink,"mcLibrary", _scope.getNextHighestDepth()); You'll need to create a unique ID for it. I would probably suggest either within your creation object, or have an ID factory (should probably be a hybrid Singleton/Factory) that just generates unique ID's that you can append to your instance names. As for the custom class, it's nothing more than a blank class with public variables (or private ones and getter/setter methods) that contain the data you want to pass. OR, since you use two separate objects, just have a single object compose both. There are many ways to go about doing it, so it just boils down to preference I guess. ___ 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] problem creating multiple instances
Where are you getting 'myName'? Is that a unique name per instance? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 6:33 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances After reading your first e-mail I did go through and make a change here, but it did not resolve the issue. _mcLibrary = _scope.attachMovie(libraryLink, "mcLibrary"+myName, _scope.getNextHighestDepth()); The line you mention is not the MovieClip reference for the plane, but a MovieClip created to create a BitmapData object. _bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true, 0x00); This BitmapData object is later placed into the plane reference MovieClip. At least that is my understanding... YIKES! _di = new DistortImage(_mc, _bd, vQuality, hQuality); I'm not able to post the class inside the e-mail anymore, it exceeds the maximum file size allowed by flashcoders. If you need the class file again I will create a link to all of the files. Thanks for your response! On May 23, 2007, at 4:03 PM, David Ngo wrote: > Yeah, you're using the same MovieClip name reference. I do believe > you can't > have two objects share the same name. You'll get concurrency issues > with > that on this line: > > _mcLibrary = _scope.attachMovie(libraryLink,"mcLibrary", > _scope.getNextHighestDepth()); > > > You'll need to create a unique ID for it. I would probably suggest > either > within your creation object, or have an ID factory (should probably > be a > hybrid Singleton/Factory) that just generates unique ID's that you can > append to your instance names. > > As for the custom class, it's nothing more than a blank class with > public > variables (or private ones and getter/setter methods) that contain > the data > you want to pass. OR, since you use two separate objects, just have > a single > object compose both. There are many ways to go about doing it, so > it just > boils down to preference I guess. ___ 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] problem creating multiple instances
I suggest you start placing some trace()'s in your code so you can track what happens. And get XRay.. http://osflash.org/xray regards, Muzak ___ 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] problem creating multiple instances
After reading your first e-mail I did go through and make a change here, but it did not resolve the issue. _mcLibrary = _scope.attachMovie(libraryLink, "mcLibrary"+myName, _scope.getNextHighestDepth()); The line you mention is not the MovieClip reference for the plane, but a MovieClip created to create a BitmapData object. _bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true, 0x00); This BitmapData object is later placed into the plane reference MovieClip. At least that is my understanding... YIKES! _di = new DistortImage(_mc, _bd, vQuality, hQuality); I'm not able to post the class inside the e-mail anymore, it exceeds the maximum file size allowed by flashcoders. If you need the class file again I will create a link to all of the files. Thanks for your response! On May 23, 2007, at 4:03 PM, David Ngo wrote: Yeah, you're using the same MovieClip name reference. I do believe you can't have two objects share the same name. You'll get concurrency issues with that on this line: _mcLibrary = _scope.attachMovie(libraryLink,"mcLibrary", _scope.getNextHighestDepth()); You'll need to create a unique ID for it. I would probably suggest either within your creation object, or have an ID factory (should probably be a hybrid Singleton/Factory) that just generates unique ID's that you can append to your instance names. As for the custom class, it's nothing more than a blank class with public variables (or private ones and getter/setter methods) that contain the data you want to pass. OR, since you use two separate objects, just have a single object compose both. There are many ways to go about doing it, so it just boils down to preference I guess. ___ 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] problem creating multiple instances
Yeah, you're using the same MovieClip name reference. I do believe you can't have two objects share the same name. You'll get concurrency issues with that on this line: _mcLibrary = _scope.attachMovie(libraryLink,"mcLibrary", _scope.getNextHighestDepth()); You'll need to create a unique ID for it. I would probably suggest either within your creation object, or have an ID factory (should probably be a hybrid Singleton/Factory) that just generates unique ID's that you can append to your instance names. As for the custom class, it's nothing more than a blank class with public variables (or private ones and getter/setter methods) that contain the data you want to pass. OR, since you use two separate objects, just have a single object compose both. There are many ways to go about doing it, so it just boils down to preference I guess. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 1:42 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances This is how I am instantiating the creationObject (below). I believe that if I am passing a different name to the myName property it should create more than one MovieClip instance. I'd love to hear more about your suggestion to use a custom class to set properties instead of a generic object, or maybe point me in the direction of good tutorial or example. Unfortunately I am a self taught coder and am not always familiar with some of the best practices. var myCreationSettings:Object = { myName:"3DCircleOnCavill", libraryLink:"CircleOnCavill", scope:this, xAxisStart:-20, yAxisStart:20, vQuality:3, hQuality:3 } var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings); my3Dplane.mouseReactive(true, 30, 20, true); var myCreationSettings2:Object = { myName:"3DCircleOnCavill2", libraryLink:"tom", scope:this, xAxisStart:-20, yAxisStart:20, vQuality:3, hQuality:3 } var my3Dplane2:Simple3DPlane = new Simple3DPlane(myCreationSettings2); my3Dplane2.mouseReactive(true, 30, 20, true); On May 23, 2007, at 3:20 PM, David Ngo wrote: > Looks like you're attaching your plane to the same MovieClip > instance, thus > destroying any/all objects that was previously on that MovieClip > instance. > Depends on how you're instantiating your creationObject. BTW, just > a comment > on your implementation: I would use a custom class to set > properties for > creation and animation rather than a generic object. This way, you > can avoid > having to iterate through the object and then you can just > composition your > custom class/object. In Java, this would be equivalent to a Value > Object or > a Data Transfer Object. > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Bill Mackin > Sent: Wednesday, May 23, 2007 12:51 AM > To: flashcoders@chattyfig.figleaf.com > Subject: Re: [Flashcoders] problem creating multiple instances > > Hello, > > Looks like the attachment did not go out. I've pasted the > Actionscript into this e-mail. > > Cheers, > > - Bill > > /* > Simple 3D Plane - v1.0 > > > Created : January 24, 2007 > Last Updated : May 18, 2007 > > Copyright © 2007 Pixlart. All rights reserved. > > http://www.pixlart.net > info [at] pixlart [dot] net > */ > > > /// \\ > \ > /* > DESCRIPTION Allows you to animate MovieClips and Bitmaps > on a 3D > plane with full control and easing. > > > AUTHOR(s) Bill Mackin - > http://www.billmackin.com > Combination > of scripts and development of 3D animation API. > > > Marquee Flipper - Which provided a good starting point and > combination of World3d and DistortImage. > > Felix Turner - http://www.airtightinteractive.com > > Simple 3d Engine "World3d" - A very basic "light" 3D engine. > > André Michelle - http://www.andre-michelle.com >
Re: [Flashcoders] problem creating multiple instances
This is how I am instantiating the creationObject (below). I believe that if I am passing a different name to the myName property it should create more than one MovieClip instance. I'd love to hear more about your suggestion to use a custom class to set properties instead of a generic object, or maybe point me in the direction of good tutorial or example. Unfortunately I am a self taught coder and am not always familiar with some of the best practices. var myCreationSettings:Object = { myName:"3DCircleOnCavill", libraryLink:"CircleOnCavill", scope:this, xAxisStart:-20, yAxisStart:20, vQuality:3, hQuality:3 } var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings); my3Dplane.mouseReactive(true, 30, 20, true); var myCreationSettings2:Object = { myName:"3DCircleOnCavill2", libraryLink:"tom", scope:this, xAxisStart:-20, yAxisStart:20, vQuality:3, hQuality:3 } var my3Dplane2:Simple3DPlane = new Simple3DPlane(myCreationSettings2); my3Dplane2.mouseReactive(true, 30, 20, true); On May 23, 2007, at 3:20 PM, David Ngo wrote: Looks like you're attaching your plane to the same MovieClip instance, thus destroying any/all objects that was previously on that MovieClip instance. Depends on how you're instantiating your creationObject. BTW, just a comment on your implementation: I would use a custom class to set properties for creation and animation rather than a generic object. This way, you can avoid having to iterate through the object and then you can just composition your custom class/object. In Java, this would be equivalent to a Value Object or a Data Transfer Object. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 12:51 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances Hello, Looks like the attachment did not go out. I've pasted the Actionscript into this e-mail. Cheers, - Bill /* Simple 3D Plane - v1.0 Created : January 24, 2007 Last Updated : May 18, 2007 Copyright © 2007 Pixlart. All rights reserved. http://www.pixlart.net info [at] pixlart [dot] net */ /// \\ \ /* DESCRIPTION Allows you to animate MovieClips and Bitmaps on a 3D plane with full control and easing. AUTHOR(s) Bill Mackin - http://www.billmackin.com Combination of scripts and development of 3D animation API. • Marquee Flipper - Which provided a good starting point and combination of World3d and DistortImage. Felix Turner - http://www.airtightinteractive.com • Simple 3d Engine "World3d" - A very basic "light" 3D engine. André Michelle - http://www.andre-michelle.com • DistortImage - A class to distort an image (including persective distortions) by slicing the image into smaller pieces (generally triangles). Thomas Pfeiffer "kiroukou" - http://www.thomas- pfeiffer.info Richard Lester "RichL" Didier Brun "foxy" - http://www.foxaweb.com • Easing Equations - Popular equations used by many to provide easing effects in scripted animations. Robert Penner - http://www.robertpenner.com USAGE var myCreationSettings:Object = { myName:"3DCircleOnCavill", libraryLink:"CircleOnCavill", scope:this, xAxisStart:0, yAxisStart:0, mouseReactive:false, vQuality:3, hQuality:3 } var my3Dplane:Si
RE: [Flashcoders] problem creating multiple instances
Looks like you're attaching your plane to the same MovieClip instance, thus destroying any/all objects that was previously on that MovieClip instance. Depends on how you're instantiating your creationObject. BTW, just a comment on your implementation: I would use a custom class to set properties for creation and animation rather than a generic object. This way, you can avoid having to iterate through the object and then you can just composition your custom class/object. In Java, this would be equivalent to a Value Object or a Data Transfer Object. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Mackin Sent: Wednesday, May 23, 2007 12:51 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] problem creating multiple instances Hello, Looks like the attachment did not go out. I've pasted the Actionscript into this e-mail. Cheers, - Bill /* Simple 3D Plane - v1.0 Created : January 24, 2007 Last Updated : May 18, 2007 Copyright © 2007 Pixlart. All rights reserved. http://www.pixlart.net info [at] pixlart [dot] net */ /// \\ \ /* DESCRIPTION Allows you to animate MovieClips and Bitmaps on a 3D plane with full control and easing. AUTHOR(s) Bill Mackin - http://www.billmackin.com Combination of scripts and development of 3D animation API. Marquee Flipper - Which provided a good starting point and combination of World3d and DistortImage. Felix Turner - http://www.airtightinteractive.com Simple 3d Engine "World3d" - A very basic "light" 3D engine. André Michelle - http://www.andre-michelle.com DistortImage - A class to distort an image (including persective distortions) by slicing the image into smaller pieces (generally triangles). Thomas Pfeiffer "kiroukou" - http://www.thomas- pfeiffer.info Richard Lester "RichL" Didier Brun "foxy" - http://www.foxaweb.com Easing Equations - Popular equations used by many to provide easing effects in scripted animations. Robert Penner - http://www.robertpenner.com USAGE var myCreationSettings:Object = { myName:"3DCircleOnCavill", libraryLink:"CircleOnCavill", scope:this, xAxisStart:0, yAxisStart:0, mouseReactive:false, vQuality:3, hQuality:3 } var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings); var myAnimationSettings:Object = { xAxisTo:0, yAxisTo:180, animationDuration:1, easingMath:"Expo", easingType:"easeOut", delay:1, callBack:"doSomething", callBackScope:this, callBackArgs:[true, "both", 1] } my3Dplane.animate3DPlane(myAnimationSettings); my3Dplane.getTarget(); // returns an instance of the newly created MovieClip containing the 3D plane. my3Dplane.mouseReactive(true, 30, 20, true);@param1 = turns 3D movement based on mouse position on/off @param2 = the limit for the 3D movement on the x axis, (in degrees). @param3 = the limit for the 3D movement on the y axis, (in degrees). @param4 = determines whether the 3D plane rotates towards the mouse or away, (only used when limiting angles).
Re: [Flashcoders] problem creating multiple instances
Hello, Looks like the attachment did not go out. I've pasted the Actionscript into this e-mail. Cheers, - Bill /* Simple 3D Plane - v1.0 Created : January 24, 2007 Last Updated : May 18, 2007 Copyright © 2007 Pixlart. All rights reserved. http://www.pixlart.net info [at] pixlart [dot] net */ /// \\ \ /* DESCRIPTION Allows you to animate MovieClips and Bitmaps on a 3D plane with full control and easing. AUTHOR(s) Bill Mackin - http://www.billmackin.com Combination of scripts and development of 3D animation API. • Marquee Flipper - Which provided a good starting point and combination of World3d and DistortImage. Felix Turner - http://www.airtightinteractive.com • Simple 3d Engine "World3d" - A very basic "light" 3D engine. André Michelle - http://www.andre-michelle.com • DistortImage - A class to distort an image (including persective distortions) by slicing the image into smaller pieces (generally triangles). Thomas Pfeiffer "kiroukou" - http://www.thomas- pfeiffer.info Richard Lester "RichL" Didier Brun "foxy" - http://www.foxaweb.com • Easing Equations - Popular equations used by many to provide easing effects in scripted animations. Robert Penner - http://www.robertpenner.com USAGE var myCreationSettings:Object = { myName:"3DCircleOnCavill", libraryLink:"CircleOnCavill", scope:this, xAxisStart:0, yAxisStart:0, mouseReactive:false, vQuality:3, hQuality:3 } var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings); var myAnimationSettings:Object = { xAxisTo:0, yAxisTo:180, animationDuration:1, easingMath:"Expo", easingType:"easeOut", delay:1, callBack:"doSomething", callBackScope:this, callBackArgs:[true, "both", 1] } my3Dplane.animate3DPlane(myAnimationSettings); my3Dplane.getTarget(); // returns an instance of the newly created MovieClip containing the 3D plane. my3Dplane.mouseReactive(true, 30, 20, true); @param1 = turns 3D movement based on mouse position on/off @param2 = the limit for the 3D movement on the x axis, (in degrees). @param3 = the limit for the 3D movement on the y axis, (in degrees). @param4 = determines whether the 3D plane rotates towards the mouse or away, (only used when limiting angles). NOTES BILL MACKIN • When using a MovieClip for your content, be sure to position the top left of your content at 0,0. TO DO 1. Update so you can create several 3D plane instances and control each of them separately. */ /// \\ \ /// // INCLUDE / IMPORT ---> // import flash.display.BitmapData; import flash.geom.Matrix; import mx.utils.Delegate; import ActionScript.simple3D.DistortImage import ActionScript.simple3D.World3d import ActionScript.Tools.PennerEasing // class ActionScript.simple3D.Simple3DPlane { // PROPERTIES // var myName:String;