Re: [flexcoders] Efficiency and objects in the display list
Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Well I'd say depending on what you're doing, you could go with bitmap blitting (less trouble than it first sounds) and a single UIComponent behind the images that handles your mouse events and determines based on mouseX, mouseY which tile / subcomponent is affected. -Josh On Thu, Oct 16, 2008 at 9:49 AM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/ -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
RE: [flexcoders] Efficiency and objects in the display list
Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guy Morton Sent: Wednesday, October 15, 2008 8:01 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] :: http://flex.joshmcdonald.info/ http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guy Morton Sent: Wednesday, October 15, 2008 8:01 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Create a custom component that extends UIComponent that you will use to hold all your Sprites. Then you can use addChild to add the Sprites to that component. And since your custom holder component extends UIComponent you can add that to whatever Container class you've got in your app. Doug On Wed, Oct 15, 2008 at 5:16 PM, Guy Morton [EMAIL PROTECTED] wrote: Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Guy Morton *Sent:* Wednesday, October 15, 2008 8:01 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Not at all. If you're currently adding all these components to a Canvas, you simply need to add a UIComponent to that Canvas, and add the Sprites to that. And if that can't get you the performance you're after, I suppose you're left with using Shape or bitmap double-buffering and using a containing UIComponent to listen to MouseEvents, and get mouseX and mouseY coordinates to map to Shapes and do whatever you're trying to do. -Josh On Thu, Oct 16, 2008 at 10:16 AM, Guy Morton [EMAIL PROTECTED] wrote: Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Guy Morton *Sent:* Wednesday, October 15, 2008 8:01 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/ -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Yes, thanks Doug, Josh, Tracy...I did get that working. On 16/10/2008, at 11:21 AM, Doug McCune wrote: Create a custom component that extends UIComponent that you will use to hold all your Sprites. Then you can use addChild to add the Sprites to that component. And since your custom holder component extends UIComponent you can add that to whatever Container class you've got in your app. Doug On Wed, Oct 15, 2008 at 5:16 PM, Guy Morton [EMAIL PROTECTED] wrote: Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guy Morton Sent: Wednesday, October 15, 2008 8:01 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Guy, I'm curious to hear about whether shifting from UIComponent components to using sprites made your app perform fast enough for you. Once you do a bit of testing care to share your overall experience? Doug On Wed, Oct 15, 2008 at 5:32 PM, Guy Morton [EMAIL PROTECTED] wrote: Yes, thanks Doug, Josh, Tracy...I did get that working. On 16/10/2008, at 11:21 AM, Doug McCune wrote: Create a custom component that extends UIComponent that you will use to hold all your Sprites. Then you can use addChild to add the Sprites to that component. And since your custom holder component extends UIComponent you can add that to whatever Container class you've got in your app. Doug On Wed, Oct 15, 2008 at 5:16 PM, Guy Morton [EMAIL PROTECTED] wrote: Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Guy Morton *Sent:* Wednesday, October 15, 2008 8:01 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Initial indicators are that it makes a difference, however the sprites don't appear as smoothly anti-aliased and at the moment I've only managed to get one layer of items to work using sprites...a second layer converted to this way of doing things isn't appearing for some reason. I'll need to put some hours into it before I'll know for sure if it's worthwhile, but will definitely report back what I learn. Thanks again folks On 16/10/2008, at 11:34 AM, Doug McCune wrote: Guy, I'm curious to hear about whether shifting from UIComponent components to using sprites made your app perform fast enough for you. Once you do a bit of testing care to share your overall experience? Doug On Wed, Oct 15, 2008 at 5:32 PM, Guy Morton [EMAIL PROTECTED] wrote: Yes, thanks Doug, Josh, Tracy...I did get that working. On 16/10/2008, at 11:21 AM, Doug McCune wrote: Create a custom component that extends UIComponent that you will use to hold all your Sprites. Then you can use addChild to add the Sprites to that component. And since your custom holder component extends UIComponent you can add that to whatever Container class you've got in your app. Doug On Wed, Oct 15, 2008 at 5:16 PM, Guy Morton [EMAIL PROTECTED] wrote: Which gets me back to where I started... :-/ On 16/10/2008, at 11:26 AM, Tracy Spratt wrote: Container children must be UIComponents. You will need to add the sprites to a UIComponent first. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guy Morton Sent: Wednesday, October 15, 2008 8:01 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Efficiency and objects in the display list Hi Doug Yes, I tried using Sprite but it seems I can't add a sprite-based component to my other containers...I guess because they are UIComponent based? Do Sprites in flex have to be added to the display list directly? I'm having a look at the docs but it's a little confusing as they generally discuss Sprite in terms of Flash rather than Flex. Guy On 16/10/2008, at 10:55 AM, Doug McCune wrote: Sprites can have mouse handling. If you don't base your class on UIComponent you lose all the automatic display list stuff (measuring, layout, etc). But if you manually control positioning and everything yourself, and don't have any need for stuff like CSS styles, then you should be OK using Sprite. Doug On Wed, Oct 15, 2008 at 4:49 PM, Guy Morton [EMAIL PROTECTED] wrote: It seems odd that there is no really lightweight class for addressing this sort of need, which I would have expected was a common one (I note it's the subject of a second thread now too). On 16/10/2008, at 9:51 AM, Guy Morton wrote: Thanks for the reply, Josh. They do need to respond to mouseovers and mousedowns, so am I stuck with UIComponent? Guy On 15/10/2008, at 8:11 AM, Josh McDonald wrote: If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/
Re: [flexcoders] Efficiency and objects in the display list
Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy
Re: [flexcoders] Efficiency and objects in the display list
If they don't need mouse events, base them on Shape instead. On Wed, Oct 15, 2008 at 7:09 AM, Guy Morton [EMAIL PROTECTED] wrote: Anyone? On 14/10/2008, at 11:34 AM, Guy Morton wrote: We have an app which adds 50 or 60 dynamically created and animated canvas-based objects to the display list as it runs. I've noticed when running this under the profiler that even though these canvas-based components are really simple (they have a draw function and a rotate function in them and don't import any other classes) they each add about 1 Mb to the overall memory consumed by the app. I've also tried making the components UIComponent based instead of using Canvas (as I believe it's a little more lightweight) but it doesn't seem to make a huge difference. Is there a better/more efficient way to dynamically create, draw, rotate and animate a bunch of small objects in a flex app? TIA Guy -- Therefore, send not to know For whom the bell tolls. It tolls for thee. Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] :: http://flex.joshmcdonald.info/