ActionScript 3.0 :: AddChildAt - Performance - Add Objects At Runtime?
Mar 24, 2010
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
View 8 Replies
Similar Posts:
Jan 11, 2011
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?
View 1 Replies
Oct 3, 2011
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.
View 3 Replies
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?
View 9 Replies
Jun 8, 2010
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.
View 1 Replies
Jun 8, 2011
Is there any way to turn off all special FX's and especially dropShadow's on all objects inside the application ?
View 2 Replies
Mar 20, 2006
i m working on flash offline application... i have a main file where i have hundreds of movieclips and sound clips to animate and run on the stage directly from libaray by "export for actionscript" and "export in fisrt frame". Everything is going well but the final swf file or projector file becomes very heavy and have problem runing on P2 system. so , is it possible that i could divide the assets of movie i.e. sound clips and movie clips on saprate files ... and i load these files into main file time to time during runtime .. and use there sound and movie clips from the main file script.. i only want to use the resources of other files for actionscript.
View 1 Replies
May 22, 2010
function funFun():void{
someMC:MC = new MC;
someMC.property = value;
stage.addChild(someMC);
}
How do I access the properties someMC after it is added?
View 8 Replies
Jul 7, 2010
I have an object of type sprite. I would like to add a new field in the sprite object without deriving the class.I tried to do
object.newField = 'value';
but it's not working.I need it because the Api expect that field in the sprite class.
View 2 Replies
Jan 21, 2012
I am new in flash so this question can sound stupid
I am about to create my first drawing in the adobe flash of some creature.
The problem is CAN i resize it when the flash is running (in runtime) by the end user.
Example: I want to increase the height of the creature.
View 1 Replies
Mar 19, 2007
I am fairly new to Flash and action script as a whole, and would like to know how one can write a script that allows users to rescale/ resize and rotate movie clip objects at runtime.I.e. When a user moves their cursor over an object on the floor plan, I would like for them to be able to either resize the object or rotate it.
After trawling the web, I am still yet to find an existing API that I can use to build my floor planner in Flash. However, I did stumble across the 'Space planner' created by Icovia for architects and interior designers alike. If you visit the icovia web site at http:[url].....and click on 'Test Drive' under Interior design and Home renovations section, you will see what I envisage for my project. However, all I would like to know for now is how I can manipulate objects on the floorplan using action script.
View 2 Replies
May 16, 2011
I have a textBox and I am using it as a mail address input field where the user can type in several addresses, a bit same as in hotmail. Each address is rendered into a clickable button. Thus upon double-clicking on a specific address I want the item to be editable. After having edited the address when the user taps enter, the item is added to the list of mail adds.I am adding it using the code below:
flowBox.addChildAt( myItem, myindex);
However addChildAt seems to add the item as the last item in the list. But I want it to add the item the position where it was originally. Say the item was at position 2 in the mail list, after editing adn tapping enter, it should add at position 2 itself and not at the end of the list.
View 2 Replies
May 16, 2011
I have a textBox and I am using it as a mail address input field where the user can type in several addresses, a bit same as in hotmail. Each address is rendered into a clickable button. Thus upon double-clicking on a specific address I want the item to be editable. After having edited the address when the user taps enter, the item is added to the list of mail adds.I am adding it using the code below:flowBox.addChildAt( myItem, myindex);However addChildAt seems to add the item as the last item in the list. But I want it to add the item the position where it was originally. Say the item was at position 2 in the mail list, after editing adn tapping enter,
View 2 Replies
Sep 12, 2011
this is what i'm trying to accomplish; With a click on a movieclip (cannon_mc)a shot is being fired (ball_mc)
The longer mouse is down, the speed of wich the ball is fired with should increase.My question to you is;
What is the most efficient way to accomplish this? With a timer or something like this;
[Code]...
View 2 Replies
Sep 23, 2011
After adding an image to the stage, turning it into a Movie clip, and setting linkage in library to Export for Actionscript, I'm now using a timer to add a bunch of roses to the stage as a video plays.How can I get rid of all these clips once the video is over?Do I need to add all of them into an extra container and then just removeChild that container at the end? Or do I need to use something like getNumberOfChildren and then create a loop that removes them one by one?The clips (myRose) are fairly small and do not have any event listeners added to them. I just use TweenMax to move them from top to bottom of the screen.
public function roseTimer():void
{
MonsterDebugger.trace(this, "in roseTimer");[code]......
View 4 Replies
Sep 12, 2009
I am having a bit of trouble replacing txt within a mc on my stage in response to button clicks on the main timeline also.This is the code that is working, and all it is, is when you click btn_servOne the goal is to remove the type_mc within the placed movieClip that works fine.What I need it to do, is remove the current, then add the selected txt... so in this case, I need it to remove txtServices_mc, and also addChildAt (0) for the next field of text: txtServOne_mc. Everytime I try to add that into the function, it fails though. So, can anyone assits?
btn_servOne.addEventListener (MouseEvent.CLICK, servOneClick);
View 4 Replies
Jul 20, 2010
I used the following to add an external .swf:
[Code]...
it worked as I wished - by placing the swf under all other elements on the timeline via the addChildAt being 0. I now need to add another external .swf (over the top of the one I just brought in) and was expecting by using:
[Code]...
it would place it above the other .swf but in fact, it places it under one element of it.
should this be the case of is there a different way to do what I wish to?
View 1 Replies
Nov 4, 2011
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?
eg.
<viewstack>
<tabnavigator />
<tabnavigator />
<tabnavigator />
</viewstack>
View 2 Replies
Mar 19, 2012
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?
View 1 Replies
Dec 31, 2011
I'm working with a component that extends List. It works fine unless it's loaded into another swf.
It cannot find the library symbols. I know the symbols exist in the loaded swf.
View 4 Replies
Feb 23, 2010
I've seen the Loom project, but are there any alternatives that are more mature (and actively developed)? I am looking for something that would allow load-time weaving of pointcuts into existing binary code at runtime with the AVM2 runtime.
Has any work been done in this area?
View 3 Replies
Nov 16, 2009
I've been into coding for about 5 years now, but I'm a recent convert to Flash development. One of the questions I have at the moment is, considering that SWF files can be run by either Adobe Flash Player OR Adobe AIR, what's the real difference between the two runtime environments? What API's and Objects exist in one environment, but not the other?
Basically what I'm more or less trying to establish is, when would I want to develop an SWF for AIR, and when would I want to develop for Flash Player, considering that Flash Player can also execute locally (providing support for creating "desktop applications")
View 1 Replies
Oct 9, 2009
Whenever I link a set of movieclips together with the bone tool which are inside a containing movieclip, and also set the type to "runtime" instead of "authortime", I get this error when published.
"Runtime symbols with skewed matrices should be wrapped in a movie clip" What does it mean? I need the type to be set to runtime so I can use scripting with it..
View 2 Replies
Mar 28, 2011
It's OK on develop machine,
but when put on product machine,it's extremely slow...
The real time publishing often turns out a static image hanging there.
View 1 Replies
Apr 29, 2010
Does anyone know of some tips when embedding an .swf into a .pdf? I've been working on this for a couple of days, and the .pdf has some significant issues playing my swf when the swf plays well from the IDE and the browser.
View 1 Replies
Jan 4, 2010
I'm running Flash CS4 on a laptop and find it gets sluggish. I find when I restart my computer, I can work at a good speed for a while, but eventually it becomes very laggy - why is this?
Can I dump the cache files or something to simulate the restart? I've reduced the undo history to 10 - any other tips for CS4 on a mediocre machine?
View 1 Replies
Apr 17, 2010
When I have an animation, 180 frames long which contains just some small animations and its running at 120 fps no problems. Now I add a keyframe on frame 90 where a large static image pops in. A 1280x800 background image for example, completely static. Then I try to run it at 120 fps and I get a small freeze(0.25s-0.5s) on frame 90. When I add this large image at frame 1 and set visibility to false and on frame 90 I set visibility to true, I have no problems. So the problem should be in instancing the large background object. What can I do about it? Is it possible to get rid of this problem and still keep using the timeline for animations to not hardcode everything because of this?
View 2 Replies
Dec 2, 2009
PowerMac Dual 2.3 GHz G5/8 GB RAM I suspect I'm not using best practices, as this is my first project, but my the flash file is getting very sluggish to work on. The swf (AS 2.0) publishes fine and runs OK off the server and in the browser, but the Flash application is slowing down to a crawl making work very unpleasant indeed. Not that it was ever that fast to begin with. The Flash file size is presently 15 megs. It's got a log of symbols in the library and a lot of small jpgs used as navigational buttons, and utilizes many instances of the loader component to dynamically load external files: Is this too much of a demand on the app's resources? I do think that some of this has to do with a poorly implemented user interface (first attempt by Adobe to make Flash "look and feel" like a CS app), but I'm sure there are other issues.
View 1 Replies
Aug 15, 2010
Specifically, I want to test exactly how many connections my installed version of FMS can accept.
Is there such a tool for benchmarking with FMS?
View 1 Replies
Jan 19, 2010
I am working on a flex application. The application occupies 100% of the browser screen, but it is slow to load. How should I improve the performance, what are the best techniques one should follow for improving the performance of a flex App. I did try some stuff though, I am not using relative layout instead i am using absolute layout and putting the buttons/images etc at exact places in a Canvas, still i feel it is slow. Can I profile the App or flex code to see where exactly the app is taking the maximum time to execute.
View 3 Replies