ActionScript 3.0 :: Flash Optimizing Code For High Number Of Iterations

Jun 4, 2010

I'm posting regarding a small app I'm working on that basically allows a grid of particles to be manipulated based on the mouse position. It is fairly primitive in its ideas, but I thought it would be a good test of my newly acquired actionscripting knowledge! It runs on the basic idea that (when clicked) a force is applied to a particle (movieclip instance). The force is inversely proportional to it's distance.

A loop goes through all the particles in the grid (a 1 dimensional array) and calculates this force, changes the velocity, and then the position. This happens every frame for every particle. At about 10,000 particles however I notice a huge decrease in fps. I know what you're thinking, its because of the amount of particles! However, I thought that the performance of the app would be directly affected by the processing power. Considering my itouch can easily handle about 8000 particles I'm guessing my pc should be able to handle 10000 particles a lot better.

View 14 Replies


Similar Posts:


Actionscript 3 :: Flash CS4 5005 Unknown Error Optimizing Byte Code

Aug 2, 2010

I'm trying to compile my flash project from Flash CS4. But it raises me this error "5005 unknown error optimizing byte code" Does anybody know the exact solution for this problem?

View 1 Replies

ActionScript 1/2 :: Test If A Number Is Between A Low And High Number?

Apr 23, 2009

I want to test if a number is between a low and high number. In my case if it is between 1 and 3. I thought I could do it like this, but seems like this does not work.

if(currentSubBtn >= 1 && currentSubBtn <= 3)
{
}

If not && what do I have to use?

View 4 Replies

ActionScript 2.0 :: Optimizing Code Execution?

May 7, 2002

I have written a small bit of actionscript code which is designed so that small objects fly across a window from left to right at varying speeds, and then get moved back again with different attributes once they reach the right edge. The code is fully functional.My problem is that this eats a huge amount of system resources, and runs slowly on a 1Ghz machine. Is there a more efficient way to achieve this?

//Frame 1 Code - create 20 objects of varying scale, x/y position and alpha.

dcount = 1;
dupcount = 20;
while (dcount<=dupcount) {[code]......

View 1 Replies

ActionScript 3.0 :: Optimizing Code For Removing Lag?

Oct 14, 2011

I recently completed the battle engine for my game.But the problem is that it is lagging horribly.optimize the code(because the graphics I'm using are really very basic)

View 13 Replies

ActionScript 3.0 :: Optimizing Short Code With XML Objects

Jul 14, 2010

I'm trying to take into account the Garbage Collector (GC), so I decide to optimize this code:[code]For instance, is it useful to put "xmlOne = null" in every iteration? I'm checking with the Flashdevelop's profiler, but I don't see the difference.maybe, I can also reuse the item object rather than creating it every time, right?

View 1 Replies

Unknown Error Optimizing Byte Code

Sep 29, 2010

We have a big project, which include about 700 classes and based on Robotleg frameworks.at some point looks we reach some limitation of flash ide, we got this error and can't render properly.[url]...

View 1 Replies

Flex :: Reduce SWF Filesize By Optimizing The Code?

Jan 26, 2011

Considering we have already done the following actions:

Flex Framework as RSL
Compiling with debug=false
Loading most images at runtime
Drawing other simple images with flash draw features

[code].....

We believe we spent a lot of time into asset optimization and most of the work is remaining on the code.By analyzing our link-report, our guess is that the heavy part of the code is comming from Flex .mxml nested components. We don't think there is much to do on our pure AS classes.Is there any analysis or coding best practice in order to reduce the impact of the code on the swf filesize ?

View 3 Replies

Actionscript 3 :: Optimizing Collision Detection Code?

Aug 9, 2011

I have two mc's on the stage, the first one is called missiles and the second one is called boxes. So accordingly I put boxes in the boxes mc and missiles in the missiles mc. My problem is how to detect whether any of the missiles collide with boxes and make damage to the box.

I am using simple and effective algorithm which works but it is very slow when there are many missiles and boxes on stage. I am using two nested "for" cycles which is a bad practice, but I don't have other idea at the moment.

Here is the code

public function onEnterFrame(e:Event) {
for(var i:int=0;i<ground_mc.boxesLayer_mc.numChildren;i++){
mc1=ground_mc.boxesLayer_mc.getChildAt(i);
for(var j:int=0;j<ground_mc.bmLayer_mc.numChildren;j++){

[code].....

Are there other techniques to solve this problem. I have already tried to add detection code in every missile but it is also slow with "for".

View 3 Replies

ActionScript 3.0 :: Optimizing Code Button Array

Nov 16, 2009

[code]I'm pretty sure I could just run a for loop and add the listeners and settings for each button that way, but what would it take to do this, if the buttons are added on the stage's timeline, they're not added via actionscript.Should I just create an array in AS with each name as an object in the array? [code]Or should I add the dynamic text field inside of the button MovieClip and just change the text to "A", "B", "C" etc in the For loop, as well as setting the mouseEnabled property to false? That way, I don't even need the buttonText array at all.

View 6 Replies

ActionScript 3.0 :: 5005: Unknown Error Optimizing Byte Code?

Feb 23, 2011

I'm getting this error all of a sudden when I try to compile my flash file.
"5005: Unknown error optimizing byte code."[URL]Which seems to work for most people, but I am still getting this error. I'm also getting this message in the output window:"ReferenceError: Error #1065: Variable ComponentShim is not defined."It started happening after I created a new .as file that is about 43kb (holds data for a game level).

View 6 Replies

Professional :: 5005 - Unknown Error Optimizing Byte Code

Aug 30, 2011

I got this horrible error, But then I found this solution.[URL]

View 1 Replies

ActionScript 3.0 :: 5005: Unknown Error Optimizing Byte Code

May 26, 2009

5005: Unknown error optimizing byte code. I just got this error for the first time today on a project I've been building for over a year. The really weird part is, it happens about half the times I compile it, with no changes to the code. It first cropped up when I made a change to a class that extends Loader:

[Code]...

I added a feature that checks whether the content is a Bitmap or a MovieClip, since prior to this my class was only used for quick-loading images, but now I've got a need to load MovieClips with it as well. But since the compiler error only happens half the time, I'm wondering if this has anything to do with it. I'm wondering if the logic board in my laptop is going, at this point. Has anyone run into this error before?

View 13 Replies

ActionScript 3.0 :: Unknown Error Optimizing Byte Code / Nothing Works!

Feb 24, 2011

I'm getting this error all of a sudden when I try to compile my flash file."5005: Unknown error optimizing byte code."url...Which seems to work for most people, but I am still getting this error. I'm also getting this message in the output window:"ReferenceError: Error #1065: Variable ComponentShim is not defined."It started happening after I created a new .as file that is about 43kb (holds data for a game level).Running Flash CS5 in Mac OSX Snow Leopard.

View 2 Replies

ActionScript 2.0 :: Make A High Score Table For A Flash Game Where EVERYONE See's The Same High Scores?

Oct 11, 2003

how can i make a high score table for a flash game where EVERYONE see's the same high scores?

eg.

Bill gets 1000 in USA
Ben gets 1002 in UK

they can see each others scores on a high score table.

View 7 Replies

MX04 Understanding 'for' Loop Iterations

Mar 25, 2009

How come every time I run this script:[code]Where does the Undefined come into things? I have only asked the script to fire 3 times so the first time through the text in position [0] in the script Carp should be printed out?

View 2 Replies

ActionScript 3.0 :: Checking All Iterations In A For Loop?

Jul 5, 2010

I'm trying to write a script to make iterations of a imported class file through a for loop. Currently, my menu buttons work for revealing themselves when clicked, but I want to make it so that if I click another button, the previous button collapses (or generally, all buttons except for the one that's clicked get collapsed).Here's the section of code:

ActionScript Code:
var ColorArray_arr:Array = new Array(DarkBlue,MidBlue,LightBlue,Gray,OffWhite,Goldenrod);
var ButtonLabels_arr:Array = new Array("menu one","menu two","menu three","menu four");
var ButtonArray_arr:Array = new Array();

[code]....

Is there something I can add to my event handler to make it so that anything that's not the target equals true? If so, would I have to put it in the for loop as well?

View 3 Replies

Flash CS4 Optimizing Files?

May 15, 2010

i want to create some crazy sites with Flash i created the site in Photoshop and then i imported the psd into flash but i come in one post that i should optimizing the content before publishing on internet but how and why should i do that??

View 3 Replies

Optimizing PSDs To Use In Flash

Jun 13, 2009

It seems to me everytime I export a PSD design into flash the images come out a little pixelated. Granted I do use 72 dpi though I thought that was the webstandard. By using flash can I use higher dpi images? Or is there another method I should be using instead of the direct import to lirbary?

View 5 Replies

ActionScript 3.0 :: Optimizing Flash File For Internet?

Sep 28, 2010

I have a 10MB flash file that I have uploaded to my website. No idea if this is large or small for a Flash file! The Flash appears on my index.html page. I have noticed that different browsers react differently, but when I open the page initially the video does not start playing straight away.

View 13 Replies

Actionscript 3 :: Flash - Optimizing Collision Detection

Oct 25, 2011

I'm trying to make my first game in Actionscript 3. Its a simple artillery game where you have a gun at bottom left corner and AIs flying across the screen which you have to shoot down. Now, in a classing shooter game how this is achieved is either by firing a bullet from the gun and doing a hitTest of that bullet with the AI movieClip or by simply removing(or playing the death animation) the AI movieclip. But here's the problem. I dont wanna do either of them. I want to show a gun with a rapid fire rate and hence no bullets. And I also don't want the player to click exactly ON the AI movieclip to destroy them (just the gun/turret pointing at the correct direction should be enough). So here's what I tried. This image should help picture the whole thing.

Tried attaching a 'line' to the turret and checking for collision with AI clip. This obviously failed because of the bounding box problem when the line is slanting.
I tried putting multiple tiny movieClips ON the line and iterate through them in a loop and checking for any collision with the AI. This method partially worked, but it was too slow and didn't seem like the 'correct' method. I draw 2 hypothetical lines. One between p1 and p2 and other connecting p3 and p4 (please see the image above). p3----p4's lenght = AI.width and is a horizontal line running right through the center of the AI MovieClip. Upon mouseClick I check for any intersection between these two lines. Now if I have multiple AIs on the screen, Again i need to iterate through each of them, draw a fresh p3-----p4 and check for intersection with p1-----p2.

[Code]....

View 1 Replies

Flash 10 :: Optimizing A Large Vector Movieclip?

Apr 3, 2011

I have an extremely complicated (10 frames, 3 layers, around 200 objects per layer) vector object, and wish to create 5 instances of this object in my SWF simultaneously. Unsurprisingly, attempting such a feat causes my program to slow down dramatically.

I can freely combine the layers, convert to bitmap or whatever is needed, although the object is very often rotated in my ActionScript code, and is at the third layer of a much larger object. What would be the best (reasonably fast, as I need to repeat this process 10 times, on 10 seperate frames each time) way to optimise this object to increase the run speed without hitting load times too drastically? (The size of the object in question is 7x700 'pixels')...

View 1 Replies

Professional :: Optimizing Flash Graphics - Use Filters Or Vectors?

Mar 28, 2011

I'm trying to lighten the load on the users' machine as much as possible. Which requires less resources: using Flash filters for Drop Shadow/Glow or creating vector shapes for the shadow/glow with the Modify > Shape > Soften Fill Edges command?

View 3 Replies

ActionScript 3.0 :: Optimizing Multiply Layers With Blendmodes In Flex / Flash?

Nov 23, 2009

I'm working on some photo manipulation stuff and have multiple images loading and displaying ontop of each other, each with various blendmodes set e.g. overlay, multiply etc.

The problem is it is sooooo slow! I thought I might be able to optimise it by drawing the resultant image to a new bitmap using BitmapData.draw (so sort of pre-baking the effects). The problem is (as I understand it) blendmodes are not draw when not on screen, so I can't use this approach until I've added the images to the screen at which point it has already slooowed down.

View 0 Replies

ActionScript 2.0 :: Optimizing A Flash File To Reduce Loading Time

Feb 25, 2007

i have a fairly large flash file and i'm wondering what i can do to reduce/compress this anymore to make it load a little quicker??

View 2 Replies

Professional :: Modify The Code To Get The Last Number Of Image?

Aug 9, 2010

The following code is quite nice I got it from a tutorial. But I would like one modification as mentioned below: The next_btn will disappear in the following code once it reaches to 5 image.Instead that what I need to modify is, the could should get th last number from the images and set the disappear to value to next_btn. Why I need it because I don't know how many images the user will require. The following is the code:


next_btn.addEventListener(MouseEvent.CLICK, nextImage);
//variable is a container that holds some value...var imageNumber:Number = 1;=true;[code]..........

View 5 Replies

ActionScript 2.0 :: Setup A Number Of Frames By The Code?

Apr 25, 2010

Is it possible to set up a frame number by the code, rather than doing so in the timeline? This usually is tedious, if you keep adding and removing frames till you get the desired effect.

View 1 Replies

ActionScript 3.0 :: Convert Number Which Contains ASCII Code To Character

Aug 2, 2011

I need for my little project know a way to do following things:

- Getting any character from string (preferably operating on strings like on 1 dimensional arrays)

- Get ASCII code for character

- Convert number which contains ASCII code to character

View 4 Replies

ActionScript 3.0 :: Know When Code Is Written For Number Its Taking As String?

Aug 19, 2010

Can any one tell me the how do we come to know when the code is written for number its taking as a string.

View 3 Replies

ActionScript 3.0 :: Convert The Color Code From Number To Hexadecimal?

Oct 21, 2011

I passed dynamically value for color code But Its number format,but i need Hexadecimal color code?how can i convert numer format to Hexadecimal format in as3?here my code

ActionScript Code:
var tf:TextField = new TextField();
tf.text ="jkg"

[code].....

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved