Performance :: Are Off-stage DisplayObjects In Flash Still Slowing Down The Game
Feb 21, 2012
How does Flash deal with elements that are off-stage?Obviously Flash doesn't actually render them (because they don't appear anywhere on-screen), but is the process of rendering them still existent, slowing down my game as much as it would if the elements were on-screen?
Or does Flash intelligently ignore elements who don't fall into a renderable area?Should I manually manage removing objects off the DisplayList and adding them back on as the exit and enter the stage, or is this going to be irrelevant?
View 2 Replies
Similar Posts:
Dec 28, 2010
How does flash player handle objects when they are no longer on the visible stage? Is the graphical data still in memory? Does hittestobject/point consider them? Are enterframe and interval events still running?
In AS2 I would hold metaobjects (minimal x,y,width,height data) that would delete/create movieclips as the screen scrolled. Is this still a correct approach in AS3? If not, is there anything I can do to offstage display objects that improves efficiency, assuming around 400 are created initially?
View 4 Replies
Apr 15, 2011
1.How to load image resources? And in which case we should use "[Embed]" to insertresources?2.which technology can improve the performance of the game flash game development ?
View 3 Replies
Oct 17, 2011
We have a flash game being developed in actionscript 3 and it runs much more slowly on our remote server.The game specs:-8 different movie clips, all 1 frame static png files from 10x10 to 100x100anywhere from 10 to 60 instancesof those MCs on screen at any given timeevent loop is run from a flash Timer at 25msall interaction is via the keyboardThe strange thing is, we publish the swf file and run it locally and everything is fast.We copy the swf to a remote server and everything runs much more slowly. The music plays at normal speed, but the movieclips all move around the screen at about half speed.
Why would the file run differently when fetched from a remote server? Isn't the swf always being run locally anyway? Also, we ran it locally and remotely with the task manager running and it does not seem to consume much CPU or memory.EDIT: Ok, this is really weird. I added a framecounter textfield to the game. It reports the number of ms since the last timer tick. It consistently reports 50ms. My timer is clearly set to 25. This explains the half speed, but what explains this? I also added a check on the timer.Interval property to see if it had changed and it hasn't; it's still set to 25 while the game is running.ode to use ENTER_FRAME instead of timer, and it works. I get the full 40fps, give or take a few %. Still not sure what's wrong with the timer though; if it was being delayed by the time spent in my loop it would fluctuate, but it doesn't. It's 50ms every time no matter how much is going on.Here's the code I'm using(more or less):
t = new Timer(25);
t.addEventListener(TimerEvent.TIMER, timerTick);
t.start();
[code]....
View 2 Replies
May 18, 2011
This is my first attempt at a game in AS3.I'm currently experiencing a problem which I'm sure is a result of my poor understanding of programming concepts.My problem is this, every time I call the function to rebuild my level, the game progressively slows down.I've tried to clear everything, but somehow something is still causing the slow down. I'll attach a zip with all of the files, and also I will add the main code to this.The attempted clearing happens in a function called cleanup() and the level setting up in setupLevel().[code]
View 2 Replies
Oct 22, 2010
I am setting out for a visualization project that will generate 1000+ sprites from dynamic data. The toolkit I am using (Flare) requires some optimization. I am trying to figure out some optimization techniques for Flash. How can I make Flash run fast when there are so many sprites on the stage, or maybe there is an optimization technique that doesn't involve generating so many sprites?
View 1 Replies
Apr 5, 2010
How can I use displayObjects as animation frames?I have six symbols in my library I want to animate with a timer. The advantage would be the ability to change the speed of the animations, and the elimination of the messy timeline.
The only drawback is the initial setup of the objects in the library. I've tried switch/case design patterns, visible=true, and z-depth, but I can't get it to work properly. Any answers?
//setup code
var timer:Timer = new Timer(100, 20);
timer.addEventListener(TimerEvent.TIMER, countdown);
function countdown(event:TimerEvent) {
[code].....
View 1 Replies
Oct 12, 2010
How to copying display objects (sprites, movieclips etc) while keeping thier content (graphics, added display objects etc)in AS3? The most commonly suggested solution by Kirupa (
[Code]...
View 5 Replies
Apr 20, 2009
I've got another interesting Flash issue, and I was wondering if there was some weird case I had to account for. Here's the code: var c:DisplayObject; var t:Rectangle; c.width = t.width; trace(c.width, t.width); This results in output of: 0 13 I'm expecting '13 13' as the output..what would cause this to happen? It's sporadic, sometimes it'll happen, sometimes it doesn't. Is there some weird race condition I should double check for?
View 5 Replies
Oct 10, 2010
I am very new to AS3, and I'm confused about how things that would have been simple in AS2 are so complex and tricky now. For example, I want to create a bunch TextField objects that, for some reason, rise up every frame (as in : object.y-=1; ).However, I also need each TextField to reference the TextField that was created just before it.
I tried creating a variable that would hold such a reference : ThisTextField.Ref=LastTextField; but - this returns an "Access of possibly undefined property..." error. It seems I can only have custom properties on mere Objects ! This is annoying because an Object doesn't seem to accept event listeners (remember, I need them to do something every frame). Is there a way to simply set custom properties on my TextFields, without having to use custom packages ? Or is there a way to use event listeners on Objects ? I've read something about strict mode which could allow setting properties on other objects - what are the risks of turning it off ?
View 3 Replies
Jul 28, 2011
Is there a performance and/or memory usage difference between these two scenarios?
Scenario 1: N visual elements all added to stage;
N-1 have visible = false, 1 has visible = true;
Scenario 2: N visual elements, only 1 added to the stage at any time.
View 1 Replies
Apr 10, 2010
I'm creating a game, here is a screenshot: I'm trying to implement a scene system in an easy way (I'm a beginner). In this tutorial the author adds scenes as movie clip. So I tried making a movie clip with action script export name the same as my main .as file. When I add it to the scene manually, dragging and dropping from the library, it works. But when I try adding it from a new starting .as file, I get a #1009 error. Adding a test movie clip with the same code works.
[Code]....
View 4 Replies
Apr 26, 2011
I am currently having a problem with Flash CS5. I am trying to link a sound file to my Flash game without having to put it on the stage. It would play when my character got hit by an enemy. The problem is is that when I go to edit the properties, all of the options except to play the sample are all blanked out. This is currently driving me insane as I have done everything I could think of to get around this.
View 1 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
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
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
Nov 24, 2009
I have a gallery flash that loads a pictures from xml. The pic slides on from the right. When btnNext is clicked it slides off to the left and the next pic slides on from the right. There is also a btnBack which slides on the previous pic. There are around 200 pictures.
I have now spent weeks on and off trying to figure out why it slows down and starts to chug! I figured out, with the help of individuals on this forum, how to remove the pictures when they are off stage. It definitely helped but its not yet resolved.
This flash is quite processor intensive with the amount of graphics. But the thing is, when the flash start off it goes fine but after so many pictures it starts to chug. Which seems to me that there is somehting it is not GCing or something of the sort!
[Code]...
View 2 Replies
Nov 24, 2009
I have a gallery flash that loads a pictures from xml. The pic slides on from the right. When btnNext is clicked it slides off to the left and the next pic slides on from the right. There is also a btnBack which slides on the previous pic. There are around 200 pictures.
how to remove the pictures when they are off stage. It definitely helped but its not yet resolved.
This flash is quite processor intensive with the amount of graphics. But the thing is, when the flash start off it goes fine but after so many pictures it starts to chug. Which seems to me that there is somehting it is not GCing or something of the sort!
View 4 Replies
Nov 30, 2009
I editted it from a template and I find that the scroll seems to be too fast. Is there a way to slow it down or make it clickable instead? The website isI dont have a css file, it is all done within an fla
View 1 Replies
May 1, 2006
here's my code:
Code:
var foodArray = new Array();
var loopCounter = 0;
var newNum;
[Code].....
But I get this problem in flash when I test or view the external .swf:
"A script in this movie is causing Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?" Then two buttons, "Yes" and "No".
When I click "Yes" the swf plays and my numbers in my array trace out non-repeating, the way I want, but the rest of my movie behaves funky.
View 1 Replies
Mar 23, 2012
After noticing a gradual increase in lag in a game I'm writing,I started a brand new project and wrote this simple counter to test if it would slow down eventually as well. Unfortunately,once the count reaches about 20,000 , there is a noticeable decrease in FPS. What's going on?
Code:
var count:int = 0;
stage.addEventListener(Event.ENTER_FRAME, mainLoop);
function mainLoop(e:Event):void {[code]....
View 10 Replies
Sep 17, 2009
My main flash movie is made up with scenes, on each scene I have used the UILoader component to load external swf content to the main movie, the first one works fine but gradually with each loop the movie slows down, i have a globe in one scene which is looking really juddery
View 2 Replies
Dec 21, 2011
I have create a game and added keydown event on Stage but but problem is user need to click on stage then it start capturing keydown event. I want that when game window open after that user don't need to click on flash stage area for unable keydown event..
View 1 Replies
Mar 24, 2009
Any way to prevent a simple mc from slowing my main movie. As you will see, I uploaded 2 exact versions of the same movie but the first has an extra mc with a simple rotation of a shape in a 30 frame tween. and on the other that mc is not animated. The rotating mc is the light rays behind the purple spintop. And you will notice on the animated rays version, that the whole movie along with other mc's slow down. Some computers more than others. You'll notice the difference comparing the 2 movies if you wait for the flying gadget to appear.
Here is the link with the 2 examples: [URL]
(The rays_mc is a star shaped graphic symbol in flash vectors, not bitmap)
I've tried rotating the "rays_mc" via:
1. tween with 30 frames
2. Frame by frame with 10 frames
3. Using the _rotate parameter with onEnterFrame
4. I've thought that maybe the gradient fill was causing that slowdown, so I tried a solid fill but it was the same.
And all of them result in the same outcome. I don't understand why such a simple mc slows down the whole thing.
View 2 Replies
Feb 9, 2012
I'm using CS4 Professional with ActionScript 2.0.I'm working with a movie that contains 23 Tab keypress interactions, each of which uses this code (with each one navigating to a different frame number):
Actionscript Code:
var kl = new Object();kl.onKeyDown = function(){ if(Key.isDown(Key.TAB)){ gotoAndPlay(20); }};Key.addListener(kl);
[code].....
View 2 Replies
Apr 4, 2011
I'm still having some problems understanding these touch events...or maybe something else..can anyone enlighten me as to what i'm doing wrong in this code?? Only left as1&2 to go to 3 recently so I'm sure I have bad habits and misconceptions but. In the IDE i have a button on the stage called: "touchBtn" and a textfield called "timer"
the problem i have is that if i touch the button fast / lots, the display rate really slows down...I know this is down to something I'm doing totally wrong but not sure what..
[Code]...
View 2 Replies
Oct 15, 2009
I am "old style" guy who still use Flash authoring environment as I believe working with graphics this way is easier than scripting all the things in document class..So, I have created in Flash authoring a movieClip with a graphics nested in it. Actually, this graphic is composed of two other nested graphics:
Graphics_
Graphics_C
/
[code]....
View 8 Replies
Apr 21, 2011
I'm working on a world builder that will load a toolkit which is represented by an xml document. The document will look similar to the following:[code]Now, I want to be able to represent this structure in flash. Vertical layout is easy enough, simply placing the elements from top to bottom. It gets mind-boggling when I need to do the following:Be able to click any folder and have all its children hidden/shown.Position the elements horizontally based on hierarchical position (indent children of folders, children of the child folders, etc)Position the folders/tools vertically when folders above and in the same "directory" are hidden.It either sounds a lot easier than it is, or I'm missing a vital and obvious step.Just to save confusion - when I make reference to "folders" and "tools", these are a MovieClip which is a simple block with text over it, like:[code]
View 1 Replies
Apr 2, 2008
I'm creating my first AS3 project and I've already hit my first snag, nested display objects (aka buttons and movieClips). Let's say you create a movieClip and place buttonA on frame 1 and buttonB on frame 10. You create a class for that movieClip that tells it to jump to frame X after evoking a custom method. With the same method you want to assign the buttons on that frame their functions, but you can't because Flash thinks that DisplayObject does not exist. How do you make sure all DisplayObjects for a frame have been loaded, so that you can reference them?
I have figured a way around it by using the ADDED event listener. Apparently this event is triggered every time any DisplayObject is added, whether it is nested or not. What's interesting is the number of children (numChildren) for the parent movieClip stays constant. So, this code takes advantage of that fact.
[Code]...
View 2 Replies