Flash :: AS3 Performance Difference Between Function And Events
Jun 2, 2011
I working on a game project in Flash AS3. I need to pass data from one class (Game) to other class objects (Ships) on EnterFrame and performance is starting to be a issue. I was wondering is there a difference in performance between calling to the Ship a direct function or dispatching an event which the Ship can listen.
another question is where should I put the enterframe function. Is it better to use only one enterframe function and call the methods dispatch events from there, or it will be wiser to put the enterframe in the different objects (Ships)? note: some Ships are inactive most of the time.
View 1 Replies
Similar Posts:
Mar 8, 2009
I was wondering, because people do suggest this, but i've never explicitly had it verified:does the flash cs4 compiler actually generate a SWF file, that is more optimized and faster, than the flash cs3 compiler?and what about other compilers? custom as3 compilers, are there faster ones?I don't mean the time it takes to compile the .fla, but the speed of the SWF file.
View 1 Replies
Mar 20, 2012
I am working on this cd-rom and have just reached testing stage for part 1 (of 5). There are lots of interactive activities, video and animations. For the activities, I dont know if I am just too tired but there seems to be items which are visible on my .swf on my computer that sometimes are visible and sometimes are not visible on the cd-rom, also in testing yesterday there sere some activities that seemed to not be working correctly (Althought they perform fine on the desktop version, on a reset of the cd-rom they then seemed to work. Is there anything that I need to take into account for the code being read off a CD to make it more bullet proof? I am stressing out a bit at the Unknown factor- I cannot continue to produce this resource if I cannot guarantee how it will perform in real life?
View 5 Replies
Sep 13, 2011
I'm building an air app which will run on iPads. For the touch interaction I'm using just MouseEvents handlers (MOUSE_DOWN, MOUSE_MOVE, MOUSE_OUT, MOUSE_UP) because my app don't need multitouch, now I'm wondering if there is any difference in execution speed, should I use the equivalent touch events or the mouse events are faster?
View 2 Replies
Feb 19, 2012
almost every single one of my classes, starts with the same method. An event listener in the constructor for EVENT_ADDED_TO_STAGE. Then i do all my actual intialising in a beginclass function that listener runs.I've not generally been removing these listeners though. i never thought it would make a difference since i'm only adding these objects once, but i wonder if there's a performance element. it could be for example, that all of these listeners add an extra check each, ehenever any object is added to the display list.
View 1 Replies
Jan 22, 2011
Assuming calling the same ColdFusion web service and all other factors are identical, is there a difference in performance/speed between using the following two tags?
<s:RemoteObject id="MyService" destination="ColdFusion" source="MyWSFolder.MyService"/>
and
<s:WebService id="MyService" wsdl="http://www.myDomain.com/MyWSFolder/MyService.cfc?wsdl"/>
View 2 Replies
Feb 16, 2012
I'm curious about event performance. I have a custom class that downloads files from a server and writes to your local system with AIR. This class has a few custom events that fire during a download process: File starts downloading, files finishes downloading, error occurred, progress, and a few others. This class was built for a specific project, but made coupled so it can be used for anything else wanting to download a file from a server. I'm starting to implement it into a new project, and a few events I'm not listening for, such as when the file starts downloading, or the progress of it, just the complete.
Does it strain overall performance having all the other events still dispatching, when I know they aren't being listened to? Would be be better to comment out the dispatchEvent() for the specifics I know aren't used, or does it even matter? There's obviously events dispatched throughout the SDK that aren't always listened for: Right click, drag, resize, etc. This makes me think it doesn't matter that these events fire but aren't handled, but since code is running and things are happening, that means there is performance going on.
View 2 Replies
Mar 22, 2012
I'm wondering if anyone has experience with if there is a big difference in performance in ActionScript 3 between keeping a class with only public static functions, and utilizing those functions often (as in a frame event at 30fps), and in turning the class into a "normal" class of which I instead make an instance and call the functions via the instance instead.
View 1 Replies
Nov 25, 2011
If i keep aside the loose coupling advantage of Events, what is the difference in the way of working of
1) Simple function call
2) Dispatching an event
View 2 Replies
Jun 9, 2009
When I upload a file using a Flex application,what is the difference between complete and uploadcompletedata events? In which cases one of them will be dispatched and the other one won't?
View 1 Replies
Nov 14, 2006
just wondering if theres a difference between using
function x() {
}
and
x = function(){
}
i find sometimes,but rarely function x() will not run while the other will??
View 5 Replies
Apr 22, 2010
What is the difference between set and get function?
View 2 Replies
Jun 29, 2010
I'm wondering what the difference is between creating a new object with a class or function? For example:
Code:
class snake{
this.id = index++;
this._x = 0;
this._y = 0;
}
or
Code:
function snake(){
var snake = new Object();
snake.id = index++;
snake._x = 0;
snake._y = 0;
}
View 1 Replies
Jul 16, 2004
Whats the difference between a variable and a function? Ive started reading an actionscript book.....and to me it seems there the same.
View 4 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
Jul 12, 2011
What is the difference between the following two function definitions in ActionScript 3?
f = function(arg) {
// body
}
and
function f(arg) {
// body
}
View 1 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
Jun 21, 2011
If I need to call a specific function in the parent application from a child in a flex project, what's the best practice for this? Would it be to dispatch a custom event from the child and have a listener call that function? Or to directly call the function with FlexGlobals.topLevelApplication?
View 1 Replies
Feb 2, 2011
is there a difference between classifying a function 'private' or 'private static' in a singleton? It seems that they both do the same thing. Maybe some difference in performance?
[Code].....
View 10 Replies
Apr 18, 2012
anyway im using flash as3 for about 6 months, and im still kinda confuse in this things like getters and setters, and idk what you call that but here's and example :
private function myBoolean():boolean
{
//codes here //
{
idk how to use it, and what it differs from getters and setters,
View 5 Replies
Mar 27, 2012
iam making a game and i almost finish except one error i couln.t get it
TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@3738fb79 to flash.events.MouseEvent.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@3738fb79 to flash.events.MouseEvent.
[code]....
View 4 Replies
Sep 25, 2009
wat's the difference between finding a angle using Math.atan2(y,x) function and by finding using the movie clip's rotation (mc._rotation*Math.PI/180);
View 9 Replies
Dec 18, 2011
When I placed this AddEventListener I got this "Type Coercion failed message"
addEventListener(Event.ENTER_FRAME,onEnterFrm);
Located above the mouse event:
addEventListener(Event.ENTER_FRAME,onEnterFrm);
[code]....
View 2 Replies
Jul 29, 2009
The fact is that the "dispatchEvent" method must be placed into the code or timeline where the "event" happens, then it can be trigged and the function associated with the event will be invoked. Ok, it is understood. Nevertheless, my question is: what's the point to create an event to trigger the a function call, if I can simply call the function instead directly???
Code:
package{
import flash.events.Event;
public class CustomEvent extends Event{
public static const ONSOMETHING:String = "onSomething";
public function CustomEvent(type:String){
super(type);
[Code] .....
If I can do simply:
Code:
DoIt();
function DoIt(){
trace ("Done!");
}
What I mean is that custom events doesn't look like as REAL events for me, but more like a delegate way to call a function. Differently from Flash native events that are controlled by an internal engine that keep checking if the event happened, in the custom events they must triggered 'manually', and it seems to lose the event main characteristic.
View 6 Replies
Jul 3, 2009
I am trying to figure out a way to be able to trigger an event which will display a message. The only thing is that the date function does not seem to be equipped with the ability to set events to it. I read the reference to it on the Flash support site and it seems as it is usually only used for date stuff.
I downloaded a digital clock, but it seems as that is based on diffrent principals as it was simply iterating throught the if stmts
[Code]...
View 7 Replies
Jul 28, 2010
In flex, I am handling event like this,
myImage.addEventListener(MouseEvent.CLICK, redoOperation);
Now, I want to pass some value to redoOperation. (function redoOperation myId:String)) How can I pass String to it?
View 1 Replies
Feb 9, 2011
I am developing an lib which tracks user events, like button click, state change, module load and application finish.
My problem is how I can track the application finish event. I googled for it, but I found no good answer.
View 1 Replies
Feb 27, 2003
I have 4 invisible buttons that all do basically the same thing. I am learning how to consolidate my code using functions and I'm stuck on this one. I am using onRollover, on Rollout and onReleases in a frame actionscript. The code is below for 2 of the buttons.
mission_btn.onRollOver =function(){
mission_mc.gotoAndPlay("on");
}
[Code]....
change these events into a function? or should I just continue with this method for the other buttons?
View 7 Replies