[Flashcoders] Fast color-transformation over MovieClip with cacheAsBitmap
Hey! I have a very complex vector symbol on the Stage - background_mc . I have set background_mc.cacheAsBitmap = true. This turns background to bitmap and makes Stage repaint fast. Every frame the background light changes. I use the following code to alter the light. (new Color(background_mc)).setTransform(light); And here is the problem. The code works very slow. I guess because the light is applied to the contents of the background_mc. And then a new cached bitmap is rasterized once again. The same code over BitmapData of the same size works much faster! Is there a way to tell Flash to apply color-transformation to the cached bitmap, instead of underlying vector symbols? Note, that background_mc is scaled when Stage is resized. This is not so fast, but it's good, because the picture quality preserved. If I convert background_mc to BitmapData, bitmap would be scaled. Pavel ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] dynamically attached not smoothing using BitmapData?
Hey guys I'm having a problem with using smoothing on my loaded bitmap images with AS3 and I was wondering if you could help, please? Here is my code: [code] private function sendImageLoadEvent(e:Event):void { var nCurImg:Number = _arImageArray.length; var bmp:Bitmap = e.target.content as Bitmap; bmp.smoothing = true; // create scale / offset var bmp_xscale:Number = stage.stageWidth / bmp.width; var bmp_yscale:Number = stage.stageHeight / bmp.height; var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale); var bmp_scaledWidth:Number = bmp.width * bmp_scale; var bmp_scaledHeight:Number = bmp.height * bmp_scale; var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth) / 2; var bmp_yshift:Number = (stage.stageHeight - bmp_scaledHeight) / 2; var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0, bmp_scale, bmp_xshift, bmp_yshift); var bmpImage:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00); bmpImage.draw(bmp, bmpMatrix, null, null, null, true); bmp.bitmapData = bmpImage; bmp.smoothing = true; _arImageArray[nCurImg] = new Sprite(); _arImageArray[nCurImg].addChild(bmp); _sprViewingArea.addChild(_arImageArray[nCurImg]); } [/code] I saw on grant skinners blog that adding a bitmapData property to a Bitmap object will remove the smoothing property so that is why I'm re-applying the smoothing to see if that makes a difference It seems like this is quite a buggy thing to do (based on the amount of unresolved forum hits in google) but i'd like to see if there's a solution. Could it be the size of the images (ie Is there a maximum size to scale from / to / by)? Anything you've learned could be helpful. Thanks for your help in advance Alz ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] dynamically attached not smoothing using BitmapData?
Well you could take a look at marjnivessers (prob didnt spell that right) ImageLoader. That class smooths a loaded image. But the one I have is as2. Try googling ImageLoader and see if he has an as3 version. If anything, you could get the logistics from it and apply. HTH Karl Sent from losPhone On Jun 3, 2009, at 5:18 AM, allandt bik-elliott (thefieldcomic.com) alla...@gmail.com wrote: Hey guys I'm having a problem with using smoothing on my loaded bitmap images with AS3 and I was wondering if you could help, please? Here is my code: [code] private function sendImageLoadEvent(e:Event):void { var nCurImg:Number = _arImageArray.length; var bmp:Bitmap = e.target.content as Bitmap; bmp.smoothing = true; // create scale / offset var bmp_xscale:Number = stage.stageWidth / bmp.width; var bmp_yscale:Number = stage.stageHeight / bmp.height; var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale); var bmp_scaledWidth:Number = bmp.width * bmp_scale; var bmp_scaledHeight:Number = bmp.height * bmp_scale; var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth) / 2; var bmp_yshift:Number = (stage.stageHeight - bmp_scaledHeight) / 2; var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0, bmp_scale, bmp_xshift, bmp_yshift); var bmpImage:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00); bmpImage.draw(bmp, bmpMatrix, null, null, null, true); bmp.bitmapData = bmpImage; bmp.smoothing = true; _arImageArray[nCurImg] = new Sprite(); _arImageArray[nCurImg].addChild(bmp); _sprViewingArea.addChild(_arImageArray[nCurImg]); } [/code] I saw on grant skinners blog that adding a bitmapData property to a Bitmap object will remove the smoothing property so that is why I'm re- applying the smoothing to see if that makes a difference It seems like this is quite a buggy thing to do (based on the amount of unresolved forum hits in google) but i'd like to see if there's a solution. Could it be the size of the images (ie Is there a maximum size to scale from / to / by)? Anything you've learned could be helpful. Thanks for your help in advance Alz ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] dynamically attached not smoothing using BitmapData?
could be good - thanks a lot Karl On Wed, Jun 3, 2009 at 12:37 PM, Karl DeSaulniers k...@designdrumm.comwrote: Well you could take a look at marjnivessers (prob didnt spell that right) ImageLoader. That class smooths a loaded image. But the one I have is as2. Try googling ImageLoader and see if he has an as3 version. If anything, you could get the logistics from it and apply. HTH Karl Sent from losPhone On Jun 3, 2009, at 5:18 AM, allandt bik-elliott (thefieldcomic.com) alla...@gmail.com wrote: Hey guys I'm having a problem with using smoothing on my loaded bitmap images with AS3 and I was wondering if you could help, please? Here is my code: [code] private function sendImageLoadEvent(e:Event):void { var nCurImg:Number = _arImageArray.length; var bmp:Bitmap = e.target.content as Bitmap; bmp.smoothing = true; // create scale / offset var bmp_xscale:Number = stage.stageWidth / bmp.width; var bmp_yscale:Number = stage.stageHeight / bmp.height; var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale); var bmp_scaledWidth:Number = bmp.width * bmp_scale; var bmp_scaledHeight:Number = bmp.height * bmp_scale; var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth) / 2; var bmp_yshift:Number = (stage.stageHeight - bmp_scaledHeight) / 2; var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0, bmp_scale, bmp_xshift, bmp_yshift); var bmpImage:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00); bmpImage.draw(bmp, bmpMatrix, null, null, null, true); bmp.bitmapData = bmpImage; bmp.smoothing = true; _arImageArray[nCurImg] = new Sprite(); _arImageArray[nCurImg].addChild(bmp); _sprViewingArea.addChild(_arImageArray[nCurImg]); } [/code] I saw on grant skinners blog that adding a bitmapData property to a Bitmap object will remove the smoothing property so that is why I'm re-applying the smoothing to see if that makes a difference It seems like this is quite a buggy thing to do (based on the amount of unresolved forum hits in google) but i'd like to see if there's a solution. Could it be the size of the images (ie Is there a maximum size to scale from / to / by)? Anything you've learned could be helpful. Thanks for your help in advance Alz ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] removing dynamically created movie clips(HELP)
Hi Matt I did as you sent me, but something wrong happened this is the warning flash gave me: 1120: Access of undefined property contactWindow. and so on with the other parts of the code , code is: function removerChild():void{ if(stage.contains(contactWindow)){ stage.removeChild(contactWindow); }else if(stage.contains(productGeneral)){ stage.removeChild(productGeneral); }else if(stage.contains(productWindow)){ stage.removeChild(productWindow); }else if(stage.contains(aboutWindow)){ stage.removeChild(aboutWindow); }else if(stage.contains(ecuacocoaWindow)){ stage.removeChild(ecuacocoaWindow); }else if(stage.contains(suppWindow)){ stage.removeChild(suppWindow); }else if(stage.contains(eWindow)){ stage.removeChild(eWindow); }else if(stage.contains(proWindow)){ stage.removeChild(proWindow); } } This is added to the click event of my buttons. The click is a function that creates an object based on an object that is export for actionscript like: function click(e:MouseEvent):void{ var newWindow:AboutUsWindow = new AboutUsWindow(): } see? is the regular way, problem is when I run the code above to try to get rid of those windows, but they are not still on stage..that was the reason? or I miss something else. Regards, gustavo On Jun 2, 2009, at 2:02 PM, Matt Gitchell wrote: The container would be the stage in that instance, yes. I used it because Stage extends DisplayObjectContainer, and you could use that chunk of code for any DisplayObjectContainer (MovieClip, Sprite) as well. I should also mention that we're talking AS3. --Matt On Tue, Jun 2, 2009 at 10:38 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: in this case what is container? is stage.? like this if(stage.contains(contactWindow)){ stage.removeChild(contactWindow); } is like this, if not please explain me what this container is about. Gustavo On Jun 2, 2009, at 12:07 PM, Matt Gitchell wrote: if (container.contains(itemToRemove)){ container.removeChild(itemToRemove); }; On Tue, Jun 2, 2009 at 8:45 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: Hi I have movie clips, that are created one I click a button, I'd like to know how could I remove then, something to put in the buttons, problem is when I try to remove the movieclip from the stage(I put the orders en every single button I have there), it says that is not created yet, there is a way to know when the movie clip is on there and if this is there just remove it. Like if(stage.movieclipName=true){ removeChild(movieClipName); } there is a way like this or something else around. Regards, Gustavo Duenas ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] removing dynamically created movie clips(HELP)
function click(e:MouseEvent):void{ var newWindow:AboutUsWindow = new AboutUsWindow(): //?? addChild(newWindow) } Gustavo Duenas wrote: Hi Matt I did as you sent me, but something wrong happened this is the warning flash gave me: 1120: Access of undefined property contactWindow. and so on with the other parts of the code , code is: function removerChild():void{ if(stage.contains(contactWindow)){ stage.removeChild(contactWindow); }else if(stage.contains(productGeneral)){ stage.removeChild(productGeneral); }else if(stage.contains(productWindow)){ stage.removeChild(productWindow); }else if(stage.contains(aboutWindow)){ stage.removeChild(aboutWindow); }else if(stage.contains(ecuacocoaWindow)){ stage.removeChild(ecuacocoaWindow); }else if(stage.contains(suppWindow)){ stage.removeChild(suppWindow); }else if(stage.contains(eWindow)){ stage.removeChild(eWindow); }else if(stage.contains(proWindow)){ stage.removeChild(proWindow); } } This is added to the click event of my buttons. The click is a function that creates an object based on an object that is export for actionscript like: function click(e:MouseEvent):void{ var newWindow:AboutUsWindow = new AboutUsWindow(): } see? is the regular way, problem is when I run the code above to try to get rid of those windows, but they are not still on stage..that was the reason? or I miss something else. Regards, gustavo On Jun 2, 2009, at 2:02 PM, Matt Gitchell wrote: The container would be the stage in that instance, yes. I used it because Stage extends DisplayObjectContainer, and you could use that chunk of code for any DisplayObjectContainer (MovieClip, Sprite) as well. I should also mention that we're talking AS3. --Matt On Tue, Jun 2, 2009 at 10:38 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: in this case what is container? is stage.? like this if(stage.contains(contactWindow)){ stage.removeChild(contactWindow); } is like this, if not please explain me what this container is about. Gustavo On Jun 2, 2009, at 12:07 PM, Matt Gitchell wrote: if (container.contains(itemToRemove)){ container.removeChild(itemToRemove); }; On Tue, Jun 2, 2009 at 8:45 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: Hi I have movie clips, that are created one I click a button, I'd like to know how could I remove then, something to put in the buttons, problem is when I try to remove the movieclip from the stage(I put the orders en every single button I have there), it says that is not created yet, there is a way to know when the movie clip is on there and if this is there just remove it. Like if(stage.movieclipName=true){ removeChild(movieClipName); } there is a way like this or something else around. Regards, Gustavo Duenas ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Loading images at the same time, bugs in Flash AS3
Hello fellowcoders, I've been experiencing some problems with an application I've made with AS3. It consists of an image gallery which loads images dynamically from an XML file. Maybe you'd want to skip my explanations and go directly to the problem in the bottom of this message. Since it's my first experience with AS3 - apart from doing some basic AS3 tutorials and other not so simple but still very simple stuff with AS2 a couple of years ago - it is absolutely not written in the simplest and more effective manner. For example, I've changed the code lots of times. For example, redefining the way the images were loaded. At the beginning they were loaded by clicking on the thumbnails. So if I clicked on the thumb of an image that were already loaded, it would load it again. Now it works like that: There are 3 arrays of images (for the thumbnails, big thumbnails and full images). So these three sequences of images start loading at the same time, and placing the images as elements in the arrays in order to be more easily handled (to my point of view). Naturally the thumbnails finish loading first. If I click on a thumbnail whose corresponding image is not yet loaded, It starts loading it. And then when the function that keeps running to load all the full images gets to it, it skips it. There are lots of other things I could have done better for example, placing many of the elements inside of a movieclip, for example a bar which would contain all the elements of the thumbnail mechanismus ( containers, masks, buttons). I've tried that but it was maybe too late, for it was difficult cause I had many references to those elements with in the code. There's no document class, and 80% of the code is written in one frame. Actually I don't know how I could write this whole thing using different class files, for example, cause it would have many cross-references, etc. But I would like to know how to do it! So the main problems are the following: 1. Sometimes (randomly) the array ot thumbnails stop loading. It gets stuck in a certain thumbnail, showing the preloader movieclip forever. 2. Another problem is that the browser's window simply closes itself by clicking on an item in the menu, that happend in Safari and Firefox. 3. Another problems occur with the menu (the icon moves up and not the square behind it, or the whole thing gets stuck. Any help will be appreciated ! You can check it out on this link: http://iialves.com/hive/ I've probably put this version one week ago, so I've been unpdating it since then. But it remais something very close to that. Now I should go cause I'm late to work. Thanks a lot! Isaac ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] removing dynamically created movie clips(HELP)
Hi Glen, the problem is not the creation of the window(which is movie clip exported to actionscript), is to removing then in a function. Regards, Gustavo On Jun 3, 2009, at 11:04 AM, Glen Pike wrote: function click(e:MouseEvent):void{var newWindow:AboutUsWindow = new AboutUsWindow()://??addChild(newWindow)}Gustavo Duenas wrote: Hi Matt I did as you sent me, but something wrong happened this is the warning flash gave me:1120: Access of undefined property contactWindow.and so on with the other parts of the code , code is:function removerChild():void{if(stage.contains (contactWindow)){stage.removeChild(contactWindow);} else if(stage.contains(productGeneral)) {stage.removeChild(productGeneral);}else if (stage.contains(productWindow)){stage.removeChild (productWindow);}else if(stage.contains(aboutWindow)) {stage.removeChild(aboutWindow);}else if (stage.contains(ecuacocoaWindow)){stage.removeChild (ecuacocoaWindow);}else if(stage.contains(suppWindow)) {stage.removeChild(suppWindow);}else if (stage.contains(eWindow)){stage.removeChild (eWindow);}else if(stage.contains(proWindow)) {stage.removeChild (proWindow);} }T his is added to the click event of my buttons.The click is a function that creates an object based on an object that is export for actionscriptlike:function click(e:MouseEvent):void{var newWindow:AboutUsWindow = new AboutUsWindow():}see? is the regular way, problem is when I run the code above to try to get rid of those windows, but they are not still on stage..thatwas the reason? or I miss something else.Regards,gustavoOn Jun 2, 2009, at 2:02 PM, Matt Gitchell wrote: The container would be the stage in that instance, yes. I used it becauseStage extends DisplayObjectContainer, and you could use that chunk of codefor any DisplayObjectContainer (MovieClip, Sprite) as well.I should also mention that we're talking AS3.-- MattOn Tue, Jun 2, 2009 at 10:38 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: in this case what is container? is stage.?like thisif (stage.contains(contactWindow)){stage.removeChild (contactWindow);}is like this, if not please explain me what this container is about.GustavoOn Jun 2, 2009, at 12:07 PM, Matt Gitchell wrote: if (container.contains(itemToRemove)){ container.removeChild(itemToRemove);};On Tue, Jun 2, 2009 at 8:45 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: Hi I have movie clips, that are created one I click a button, I'd like to know how couldI remove then, something to put in the buttons, problem is when I try toremovethe movieclip from the stage(I put the orders en every single button Ihavethere), it says that is not created yet, there is a way to know when themovie clip is on there and if this is therejust remove it.Like if (stage.movieclipName=true){removeChild(movieClipName);}there is a way like this or something else around.Regards,Gustavo Duenas___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp:// chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp:// chattyfig.figleaf.com/mailman/listinfo/flashcoders ___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp:// chattyfig.figleaf.com/mailman/listinfo/flashcoders ___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp:// chattyfig.figleaf.com/mailman/listinfo/flashcoders ___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp://chattyfig.figleaf.com/ mailman/listinfo/flashcoders ___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp://chattyfig.figleaf.com/ mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] removing dynamically created movie clips(HELP)
Hi, Sorry, I am a little confused - I may have looked at your question wrong... Your error says 1120: Access of undefined property contactWindow etc. Where is contactWindow created - if you have no variable called contactWindow in the scope of your removerChild function, it will complain - I guess if you create stuff dynamically, you may have this problem. You either have to declare all your child instances, look in an array, or be a bit more abstract in your remove function: If you want to remove all objects from the stage (or a clip - substitute stage with the name of the clip), you can loop through them one by one: Start by checking what's on your stage / in your clip like this: function removerChild():void{ var count:int = stage.numChildren(); for(var i:int = 0;i count;i++) { var clip:DisplayObject = stage.getChildAt(i); trace(clip is + clip + name + clip.name); //You might be able to determine what type of movieclip your child is by casting it - //if the cast does not work, it will probably be null (not sure if it throws an Exception) if(clip as AboutUsWindow) { stage.removeChild(clip); } } } I would recommend that you put your dynamic windows inside another container clip on the stage. That way, it might just be easier to remove all the children in the container rather than checking if they are a specific instance. function removerChild():void{ var count:int = container.numChildren(); for(var i:int = 0;i count;i++) { container.removeChildAt(i); } } This will only work if you are getting rid of everything each time you call the function removerChild. If you want to keep certain things on the stage, it may be easier to pass in an argument(s) saying what clip(s) to leave onstage - I will leave that for you to decide. Hopefully I have got the right end of the stick this time... Glen Gustavo Duenas wrote: Hi Glen, the problem is not the creation of the window(which is movie clip exported to actionscript), is to removing then in a function. Regards, Gustavo On Jun 3, 2009, at 11:04 AM, Glen Pike wrote: function click(e:MouseEvent):void{var newWindow:AboutUsWindow = new AboutUsWindow()://??addChild(newWindow)}Gustavo Duenas wrote: Hi Matt I did as you sent me, but something wrong happened this is the warning flash gave me:1120: Access of undefined property contactWindow.and so on with the other parts of the code , code is:function removerChild():void{ if(stage.contains(contactWindow)){ stage.removeChild(contactWindow); }else if(stage.contains(productGeneral)){ stage.removeChild(productGeneral); }else if(stage.contains(productWindow)){ stage.removeChild(productWindow); }else if(stage.contains(aboutWindow)){ stage.removeChild(aboutWindow); }else if(stage.contains(ecuacocoaWindow)){ stage.removeChild(ecuacocoaWindow); }else if(stage.contains(suppWindow)){ stage.removeChild(suppWindow); }else if(stage.contains(eWindow)){ stage.removeChild(eWindow); }else if(stage.contains(proWindow)){ stage.removeChild(proWindow); } }This is added to the click event of my buttons.The click is a function that creates an object based on an object that is export for actionscriptlike:function click(e:MouseEvent):void{var newWindow:AboutUsWindow = new AboutUsWindow():}see? is the regular way, problem is when I run the code above to try to get rid of those windows, but they are not still on stage..thatwas the reason? or I miss something else.Regards,gustavoOn Jun 2, 2009, at 2:02 PM, Matt Gitchell wrote: The container would be the stage in that instance, yes. I used it becauseStage extends DisplayObjectContainer, and you could use that chunk of codefor any DisplayObjectContainer (MovieClip, Sprite) as well.I should also mention that we're talking AS3.--MattOn Tue, Jun 2, 2009 at 10:38 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: in this case what is container? is stage.?like thisif(stage.contains(contactWindow)){stage.removeChild(contactWindow);}is like this, if not please explain me what this container is about.GustavoOn Jun 2, 2009, at 12:07 PM, Matt Gitchell wrote: if (container.contains(itemToRemove)){ container.removeChild(itemToRemove);};On Tue, Jun 2, 2009 at 8:45 AM, Gustavo Duenas LRS gdue...@leftandrightsolutions.com wrote: Hi I have movie clips, that are created one I click a button, I'd like to know how couldI remove then, something to put in the buttons, problem is when I try toremovethe movieclip from the stage(I put the orders en every single button Ihavethere), it says that is not created yet, there is a way to know when themovie clip is on there and if this is therejust remove it.Like if(stage.movieclipName=true){removeChild(movieClipName);}there is a way like this or something else around.Regards,Gustavo Duenas___Flashcoders mailing listflashcod...@chattyfig.figleaf.comhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Loading images at the same time, bugs in Flash AS3
I would love to see what's going on, as it sounds crazy; yet, your site isn't coming up for me. Isaac Alves wrote: Hello fellowcoders, I've been experiencing some problems with an application I've made with AS3. It consists of an image gallery which loads images dynamically from an XML file. Maybe you'd want to skip my explanations and go directly to the problem in the bottom of this message. Since it's my first experience with AS3 - apart from doing some basic AS3 tutorials and other not so simple but still very simple stuff with AS2 a couple of years ago - it is absolutely not written in the simplest and more effective manner. For example, I've changed the code lots of times. For example, redefining the way the images were loaded. At the beginning they were loaded by clicking on the thumbnails. So if I clicked on the thumb of an image that were already loaded, it would load it again. Now it works like that: There are 3 arrays of images (for the thumbnails, big thumbnails and full images). So these three sequences of images start loading at the same time, and placing the images as elements in the arrays in order to be more easily handled (to my point of view). Naturally the thumbnails finish loading first. If I click on a thumbnail whose corresponding image is not yet loaded, It starts loading it. And then when the function that keeps running to load all the full images gets to it, it skips it. There are lots of other things I could have done better for example, placing many of the elements inside of a movieclip, for example a bar which would contain all the elements of the thumbnail mechanismus ( containers, masks, buttons). I've tried that but it was maybe too late, for it was difficult cause I had many references to those elements with in the code. There's no document class, and 80% of the code is written in one frame. Actually I don't know how I could write this whole thing using different class files, for example, cause it would have many cross-references, etc. But I would like to know how to do it! So the main problems are the following: 1. Sometimes (randomly) the array ot thumbnails stop loading. It gets stuck in a certain thumbnail, showing the preloader movieclip forever. 2. Another problem is that the browser's window simply closes itself by clicking on an item in the menu, that happend in Safari and Firefox. 3. Another problems occur with the menu (the icon moves up and not the square behind it, or the whole thing gets stuck. Any help will be appreciated ! You can check it out on this link: http://iialves.com/hive/ I've probably put this version one week ago, so I've been unpdating it since then. But it remais something very close to that. Now I should go cause I'm late to work. Thanks a lot! Isaac ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] removing dynamically created movie clips(HELP)
Hi Glen, I did as you said and this is the result of the first part:clip is [object MainTimeline] name root1 how can I rename the object?True is I don't know how. I tried using : var newWindow:AboutUsWindow = new AboutUsWindow(); newWindow.name = newWindow; but it returns nothing, I only have the phrase you have in the beginning of my email. Regards, Gustavo ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Loading images at the same time, bugs in Flash AS3
Without looking through your code: * For alignment of the thumbnail container, you could be waiting until after everything has loaded inside before asking it to change it's y position. * For the thumbs not loading properly, that could be caused by your load order... Your downloads are racing each other. Things need to be loaded in sequence for stability; yet, you are, if I am not mistaken, downloading everything at once in a loop, not waiting until one thing downloads until you go to the next; yet, in your display, you are making it wait. Flash lets you send multiple requests at once and does not automatically que your requests, in the sense that only one can happen at a time; therefore, if something needs to load in sequence, you need to put safeguards in your code to ensure that things get loaded in order of priority. Just guessing, Anthony Anthony Pace wrote: I would love to see what's going on, as it sounds crazy; yet, your site isn't coming up for me. Isaac Alves wrote: Hello fellowcoders, I've been experiencing some problems with an application I've made with AS3. It consists of an image gallery which loads images dynamically from an XML file. Maybe you'd want to skip my explanations and go directly to the problem in the bottom of this message. Since it's my first experience with AS3 - apart from doing some basic AS3 tutorials and other not so simple but still very simple stuff with AS2 a couple of years ago - it is absolutely not written in the simplest and more effective manner. For example, I've changed the code lots of times. For example, redefining the way the images were loaded. At the beginning they were loaded by clicking on the thumbnails. So if I clicked on the thumb of an image that were already loaded, it would load it again. Now it works like that: There are 3 arrays of images (for the thumbnails, big thumbnails and full images). So these three sequences of images start loading at the same time, and placing the images as elements in the arrays in order to be more easily handled (to my point of view). Naturally the thumbnails finish loading first. If I click on a thumbnail whose corresponding image is not yet loaded, It starts loading it. And then when the function that keeps running to load all the full images gets to it, it skips it. There are lots of other things I could have done better for example, placing many of the elements inside of a movieclip, for example a bar which would contain all the elements of the thumbnail mechanismus ( containers, masks, buttons). I've tried that but it was maybe too late, for it was difficult cause I had many references to those elements with in the code. There's no document class, and 80% of the code is written in one frame. Actually I don't know how I could write this whole thing using different class files, for example, cause it would have many cross-references, etc. But I would like to know how to do it! So the main problems are the following: 1. Sometimes (randomly) the array ot thumbnails stop loading. It gets stuck in a certain thumbnail, showing the preloader movieclip forever. 2. Another problem is that the browser's window simply closes itself by clicking on an item in the menu, that happend in Safari and Firefox. 3. Another problems occur with the menu (the icon moves up and not the square behind it, or the whole thing gets stuck. Any help will be appreciated ! You can check it out on this link: http://iialves.com/hive/ I've probably put this version one week ago, so I've been unpdating it since then. But it remais something very close to that. Now I should go cause I'm late to work. Thanks a lot! Isaac ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Loading images at the same time, bugs in Flash AS3
My guess is that if it's iterating through a loop to load, I would imagine that the loader objects are being lost in the loop by getting de-referenced and are getting garbage collected. If this is what's happening, you would probably have to put your loader objects in a stack or array so they don't get de-referenced, and then do some housekeeping to remove them once they have been loaded. jord Anthony Pace wrote: Without looking through your code: * For alignment of the thumbnail container, you could be waiting until after everything has loaded inside before asking it to change it's y position. * For the thumbs not loading properly, that could be caused by your load order... Your downloads are racing each other. Things need to be loaded in sequence for stability; yet, you are, if I am not mistaken, downloading everything at once in a loop, not waiting until one thing downloads until you go to the next; yet, in your display, you are making it wait. Flash lets you send multiple requests at once and does not automatically que your requests, in the sense that only one can happen at a time; therefore, if something needs to load in sequence, you need to put safeguards in your code to ensure that things get loaded in order of priority. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] swf paths...
Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] swf paths...
Hi Maurice, Check out the base attribute for the object / embed tag (you can also define it with SwfObject and similar scripts for embedding swfs): base - . or *[base directory]* or *[URL]*. Specifies the base directory or URL used to resolve all relative path statements in the Flash Player movie. This attribute is helpful when your Flash Player movies are kept in a different directory from your other files. http://kb2.adobe.com/cps/127/tn_12701.html Set it to swf and it should work without needing to hard code paths. I think you can also do this: loadSomethig(../xml/some.xml) if, for instance, you have an xml folder at the same level as swf. Cheers Juan Pablo Califano 2009/6/3, maurice sallave mo.be...@gmail.com: Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] swf paths...
Hi Maurice, How about sending it in as a URL variable when you load preloader.swf into the html page? In the HTML: object . param name=movie value=swf/preloader.swf?path=swf/ / ... embed src=swf/preloader.swf?path=swf/ .../ /object Then in preloader.swf: var ojtParams:Object = this.loaderInfo.parameters; var swfPath:String = ojtParams.path; hth, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 1:30 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] swf paths... Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] help removing an display object created
I have several buttons which create some windows based on a movie clip that exports for actioncript. Everything is ok, with the creation, but when it comes to close them ( I have a button in the window itself that can remove the child), I will trying to do it using actionscript. if (stage.contains(thenameoftheobject)){ stage.removeChild(thenameoftheobject)} but so far it isn't working, Flash is telling me that the display object is not there (course is not there until it is created by the button) so everyone knows how could I remove the child from the same buttons without the warning that the buttons are not there. here is my code for the windows. it will explain how I have those created. function newClick(e:MouseEvent){ productsOff(); removerChild() gotoAndPlay(75); var newBack:Loader = new Loader(); newBack.load(new URLRequest(imgs/sombrero.jpg)); this.backMovie.addChild(newBack) var myWindow:AboutUsWindow = new AboutUsWindow(); myWindow.name = e.currentTarget.name; trace(myWindow.name); myWindow.x=500.0; myWindow.y=391.0; var myText:URLLoader= new URLLoader(); myText.addEventListener(Event.COMPLETE, onLoaded); function onLoaded(e:Event):void{ myWindow.textoWindow.text= e.target.data; myScroll.scrollTarget=myWindow.textoWindow; } myText.load(new URLRequest(text/+ e.currentTarget.name+.txt)); var myScroll:UIScrollBar = new UIScrollBar(); myScroll.enabled=true; myScroll.direction= VERTICAL; myScroll.setSize(myWindow.textoWindow.width, myWindow.textoWindow.height); myScroll.x=300; myScroll.y=-33; myScroll.height = myWindow.textoWindow.height; myWindow.addChild(myScroll); var myLoader:Loader = new Loader(); myLoader.load(new URLRequest(e.currentTarget.name+.swf)); myWindow.imgScreen.addChild(myLoader); myWindow.botoncito.buttonMode=true; myWindow.botoncito.addEventListener(MouseEvent.MOUSE_OVER, botoncitoOver); myWindow.botoncito.addEventListener(MouseEvent.MOUSE_OUT, botoncitoOut); myWindow.botoncito.addEventListener(MouseEvent.CLICK, botoncitoClick); //new botoncitoBehaviour// function botoncitoOver(e:MouseEvent):void{ e.currentTarget.gotoAndPlay(2); } function botoncitoOut(e:MouseEvent):void{ e.currentTarget.gotoAndStop(1); } function botoncitoClick(e:MouseEvent):void{ removeChild(e.currentTarget.parent); } addChild(myWindow); } Any help is appreciated. Gus ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] swf paths...
Thanks for the replies. I'll be looking into both. kind of been playing around with this as well: str = _url; slash = str.lastIndexOf(/); str = str.substring(slash+1, str.length); dot = str.lastIndexOf(.); filename = str.substring(0, dot); directoryLocation = _url.split(filename + .swf).join(); and setting it to frame 1. On Wed, Jun 3, 2009 at 2:15 PM, Robert Leisle b...@headsprout.com wrote: Hi Maurice, How about sending it in as a URL variable when you load preloader.swf into the html page? In the HTML: object . param name=movie value=swf/preloader.swf?path=swf/ / ... embed src=swf/preloader.swf?path=swf/ .../ /object Then in preloader.swf: var ojtParams:Object = this.loaderInfo.parameters; var swfPath:String = ojtParams.path; hth, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 1:30 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] swf paths... Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] swf paths...
Here's another version: var str:String = http://www.yourDomain.com/dir1/dir2/dir3/preloader.swf;; var intFirst:int = str.indexOf(.com/) +5; var intLast:int = str.lastIndexOf(/)+1; var intPathLen:int = intLast - intFirst; // var serverName:String = str.substr( 0, intFirst ); var directoryPath:String = str.substr( intFirst, intPathLen ); var fileName:String = str.substr( intLast ); // trace( serverName: +serverName, \ndirectoryPath: +directoryPath, \nfileName: +fileName ); Cheers, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 3:11 PM To: Flash Coders List Subject: Re: [Flashcoders] swf paths... Thanks for the replies. I'll be looking into both. kind of been playing around with this as well: str = _url; slash = str.lastIndexOf(/); str = str.substring(slash+1, str.length); dot = str.lastIndexOf(.); filename = str.substring(0, dot); directoryLocation = _url.split(filename + .swf).join(); and setting it to frame 1. On Wed, Jun 3, 2009 at 2:15 PM, Robert Leisle b...@headsprout.com wrote: Hi Maurice, How about sending it in as a URL variable when you load preloader.swf into the html page? In the HTML: object . param name=movie value=swf/preloader.swf?path=swf/ / ... embed src=swf/preloader.swf?path=swf/ .../ /object Then in preloader.swf: var ojtParams:Object = this.loaderInfo.parameters; var swfPath:String = ojtParams.path; hth, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 1:30 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] swf paths... Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] swf paths...
ah sumly cool. Thanks for showing off. I love it. On Wed, Jun 3, 2009 at 3:52 PM, Robert Leisle b...@headsprout.com wrote: Here's another version: var str:String = http://www.yourDomain.com/dir1/dir2/dir3/preloader.swf;; var intFirst:int = str.indexOf(.com/) +5; var intLast:int = str.lastIndexOf(/)+1; var intPathLen:int = intLast - intFirst; // var serverName:String = str.substr( 0, intFirst ); var directoryPath:String = str.substr( intFirst, intPathLen ); var fileName:String = str.substr( intLast ); // trace( serverName: +serverName, \ndirectoryPath: +directoryPath, \nfileName: +fileName ); Cheers, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 3:11 PM To: Flash Coders List Subject: Re: [Flashcoders] swf paths... Thanks for the replies. I'll be looking into both. kind of been playing around with this as well: str = _url; slash = str.lastIndexOf(/); str = str.substring(slash+1, str.length); dot = str.lastIndexOf(.); filename = str.substring(0, dot); directoryLocation = _url.split(filename + .swf).join(); and setting it to frame 1. On Wed, Jun 3, 2009 at 2:15 PM, Robert Leisle b...@headsprout.com wrote: Hi Maurice, How about sending it in as a URL variable when you load preloader.swf into the html page? In the HTML: object . param name=movie value=swf/preloader.swf?path=swf/ / ... embed src=swf/preloader.swf?path=swf/ .../ /object Then in preloader.swf: var ojtParams:Object = this.loaderInfo.parameters; var swfPath:String = ojtParams.path; hth, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice sallave Sent: Wednesday, June 03, 2009 1:30 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] swf paths... Hello! First time on here, so thanks for any advice. I'm pulling in a preloader.swf file into an html file that sits at root swf/preloader.swf. All my swf's are located in a swf directory that gets preloaded into this preloader.swf - simple enough. I'd like to try to keep my server as clean as possible without having to hard-code the path into the preloader.swf file and don't want to use flashvars as a way of referencing my targeted path. Is there another way of doing this? Of course if I put the html file inside the swf directory, everything works, but it defeats the purpose of keeping my server organized. I hope this makes sense and again thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders