ActionScript 3.0 :: Spinning Many Objects With Slow Down The Performance
Aug 27, 2009
I have 500 small objects, I would like for them each to rotate (spin) constantly, I have seen a few methods for doing this, but what would be the best way to do this so performance doesn't slow down?
I have a banner, and on this banner there are three wheels which spin continuously by way of motion tweens.What I want to do is have them stop spinning for a few seconds and then continue spinning, this process will be repeated every time.
So my question is: How would I accomplish this?I know I could just add a bunch of frames to stop the wheels from spinning, but I was wondering if there's a script that will do this without having to add frames.
I'm devloping some library classes for flocking/steering behaviours on large numbers of objects (2000+). I'm finding that at < 500 instances, performance is reasonable. As the numbers increase, framerate bogs down.
I've seen remarkable performance with libraries such as Flint or Box2D with ridiculous #'s of particles / objects, so it should be possible to optimize / refactor my code to be a bit better.
I'm aware of the basic optimizations, such as bitwise operations and optimized for loops. Are there any more fundamental approaches I should be considering? For example, currently each instance is a vector-based MovieClip. Would working with BitmapData be more efficient?
Basically what I am trying to accomplish is to make a rotating menu comprised of circles that are spinning at a slow constant speed, and when the mouse goes over a circle(button) the menu stops rotating.
I have created an app in CS5.5 for Android and iOS. I have tested on two Android devices and everyingthing works fine. However, on an iPad and iPhone the animations are really slow. Here are some more facts:
1) My project has many scenes and in the problems scene there are upwards of 1,200 frames. But even simple animations run slowly.
2) The frame rate is set for 24 fps.
3) I have created a universal app (iphone and ipad), publish resolution is standard at full screen.
4) Ironically, I have already tried caching as bitmap. That actually slowed my animations even more. I am truely at the end of the line here and don't have any possible solutions.
I have a DataProvider object which loads an XML object during instantiation. I set my datagrid.dataProvider to the DataProvider object. There are 13 columns, and approximately 40 rows.
Scrolling the datagrid, and resizing columns has alot of lag. Is this to be expected when using the DataGrid component with larger datasets?
for the past couple of weeks I've been learning AS3, and for a school project I'm doing a remake of the popular DOS game Liero. Everything is working fine, I got a layer of dirt that I am shooting away, but the problem is that after a few hundred bullets, the game starts to lag heavily whenever a shot is fired.I'm using a simple bitmap and a brush to erase the parts where the bullets hit.
// Drawing stage bmap = new BitmapData(1100,800, true, 0); dispBmp = new Bitmap(bmap);
when I create a medium or large text block, Flash (cs4) starts to work very slow, only a objet move or a click on stage takes a lot of time to process. My computer features should be ok... 4gb ram, intel 2 core duo 2.4 hz... The only thing that I think can be a problem is that I'm using Windows Vista 64 bit.
I'm curious when Adobe are going to repair the performance issues inside component inspector panel in CS5? Scrolling through the properties of some components is ridiculously slow, 486 like slow...
I have a Flash movie that runs full screen, but with StageScaleMode.NO_SCALE so that the actual movie size is the same as it would be if I ran it not full screen.
There is a huge difference in performance between full screen and no full screen. This is despite the movie taking up the same screen space.
My scene has a video background which scales to the stage size. Then, each section has another video when transitioning in. The problem is that the videos play really slow than they should, very low fps. When there are 2 videos on the stage, it goes even slower. I've tried with embedding videos, using FLVPlayback, wrapping in movieclips, but still the same result. The videos are exported at 30 fps, same rate than the flash movie.
In a SWF file, when I am using the following code to move backwards to a previous frame, it is incredibly slow -- Taking around 2 seconds. Where as moving forward to next frame takes 30-40 milli seconds.
In terms of performance, does loading .swfs into a flash movie have any implications. I've been experimenting with loading complex swfs into a simple movie and the complex .swf seems to perform a lot slower within the .swf than as a standalone. The host movie has no other funcitonality other than as a simple container. Is it in general terms better not to load .swfs into a movie but to code everything inside 1 movie ?
I am using a custom Flex skin to create an active blur/frosted glass effect on the background of floating Panels, TitleWindows, and other containers (similar to http:url....). There is a background image in the Application skin, and potentially any number of other components above and below the active blur component. Here's some relevant code within the skin:
public static const BLUR_FILTER :BlurFilter = new BlurFilter(16, 16, BitmapFilterQuality.HIGH); private var _bitmapFill :BitmapFill = new BitmapFill; private var _matrix :Matrix = new Matrix;[code]....
Unfortunately, the performance of this when the component is being resized, and especially when moved, is poor. There is noticeable drag delay and overall slowdown, and this is with only one popped-up TitleWindow in the test application. There is especially poor performance when components inside the TitleWindow are changed (button hover states, etc.)I've attempted to optimized a little bit by avoiding reinstantiation of the blur filter, bitmap fill, and matrix, but this has had little or no effect. I removed the blur at one point, just drawing the Application to a bitmap, and the performance is still poor, so it's clear that it's mostly the BitmapData.draw() call.
I've read about using scrollRect and cacheAsBitmap, but I'm not sure where to apply these properties (or other optimizations I'm not aware of) within the Application or its components.
I have an application with about 20 models and controllers and am not using any particular framework. What is the best practice for using multiple remote objects in Flex performance-wise?
1) Method 1 - One per Component - Each component instantiates a RemoteObject for itself 2) Method 2 - Multiple in Application Root - Each controller is handled by a RemoteObject in the root 3) Method 3 - One in Application Root - Combine all controllers into one class and handle them with one RemoteObject
I'm guessing 3 will have the best performance but will be too messy to maintain and 1 would be the cleanest but would take a performance hit.
So for my current project I am to handle A LOT of objects on the screen. Which made me wonder what approach I would go about the ENTER_FRAME event.I have 2 samples below, one where my BulletControl object calls on every bullet object's 'FrameFunc()' in its own ENTER_FRAME event with a for loop.The other sample every object has its very own ENTER_FRAME, so it works independently.
[code]....
Also for each burst of bullets I create about 50 objects or so; a lot of object instantiation is never good with such a short interval which makes me wonder if the garbage collector has a hard time keeping up.
I was wondering if addChildAt is slower than addChild, and if so, how bad it is. I want to add objects at runtime, constantly, but they must be behind the player, so I'd use addChildAt to index 0, I figured. However, would this damage my performance? It's for my scrolling platform engine, I want buildings in the 'background' only on the display list when they actually can be seen (code for this is working fine, runs at about 160 FPS last time I checked).
So, should I look into another solution? The only other solution I know of is to have a second 'layer' sprite in the engine, but since it's scrolling, I'd have to scroll 2 sprites all the time. Don't know the best thing to do here
I'm building my first Flex custom component, in Flex 3. It is a data table based on the 'Grid' container class, with a simple text Label in each cell. (DataGrid and AdvancedDataGrid were not appropriate starting points for my needs.) The component works quite well using smallish tables, but I tried stress-testing it using a larger table, and have been disappointed by the results.
The component creation process has some slow spots, but those are in my power to optimize and aren't my primary concern. What worry me more are what appear to be limitations in the Flex framework itself.
This 'large' sample table has a bit over 7000 cells in it. This is largish, but still 1-2 orders of magnitude less than the biggest I need to accommodate. In standard Grid structure, the main portion of the component consists of a Grid with 400 GridRows of 16 GridItems each, plus a few other smaller ancillary Grids.
Once the table renders, I find the following:
Mouse-related events are slow to fire. Specifically, I have rollOver/rollOut event handlers registered on each table cell, to let me highlight the cell under the pointer. On a small table, I could move the mouse over the table very quickly, and the highlighting would follow the pointer in real-time. With the larger table, the highlighting is very jerky, changing only about twice per second, skipping over many cells.If I place the mouse cursor over the component and leave it there, my CPU is pegged (one processor core, anyway), and stays that way until I move off of the component, when it drops to idle. My component isn't doing anything at all at this point.
It feels like Flex simply cannot scale to support component trees that are this large. I shudder to imagine how it would behave with 100,000 cells. Perhaps I'm pushing the Grid beyond its intended use, but having an object per table cell doesn't seem like an unreasonable model, and ~14,000 objects in the tree (a GridItem and a Label per cell) seems pretty modest.
I've written a small program which detects my mouse movement and draws circles on the x- and y-position of the mouse.
[Code]....
As you can probably see: after drawing a lot of circles the program slows down and the framerate makes the circles be placed with a large gap between them. I would guess that the program draws what is behind the current circle even though the user cannot see it?
Will I take a big hit in performance using nested ViewStacks? Should I strive to handle all navigation in one ViewStack and push children manually or will the affected performance be negligible?
We have a medium size Flex 3.6 application that contains around 20 different page views (managed via a single lazy ViewStack) each having multiple components. Most use custom renderers.All model data is loaded at startup and changes to model instances are communicated via binding and/or collection change events.Once the user has viewed each page at least once, all page views are instantiated and happily listen to update events.Which in effect means that each time a model instance changes, all interested views receive that event and compute derived data or trigger item-renderers.I have tested and confirmed this behaviour in a proof-of-concept application. Even when setting a list to being invisible, it still listens to collection change events and invalidates any renderer affected.What would you do?
My main objective is to emulate this scrolling effect seen such as the att phone. The effect of being able to click and drag to "spin" the phone and/or use a scrollbar to "spin" it. [URL]I have taken the time to take pictures of my object from many many angles so i thought to myself "i want to make a scroll bar and mouse events that will scroll through frames, since I can just put each angle in a frame and go from there"
What I have done is create a new actionscript 3 document, imported to stage my bitmap then converting it to movie clip, then i just apply the 3d spin motion preset.When i try the movie it spins ok apart from 1 frame where it looks like the bitmap moves to the left slightly.Do I need to delete frame 1 or the last frame perhaps
I am trying to make a spinning wheel and I've got it spinning fine, forum as well as a tutorial I found. Thing I could not make to work is hitTest. Actually I've got it to work but its reporting wrong details at times.