ActionScript 2.0 :: OnEnterFrame Efficiency?

Dec 16, 2009

Say I have 100 MC's (movie clips) in my scene that are spreading out in _x and _y. On every frame I need to check each of those MC's for a hitTest (or anything really). Would it be more programatically efficient to:A) Create a single array to hold all the MC's and do a for...loop to check all of themorB) When each MC is created create an onEnterFrame to check only itself (x100)?Hope this makes sense. This is an argument between me and my partner as to which will be the less processor intensive. My theory is that there would be no difference but I've read no documentation for it

View 3 Replies


Similar Posts:


ActionScript 2.0 :: OnEnterFrame=null - OnEnterFrame=undefined & Delete OnEnterFrame

Mar 29, 2008

onEnterFrame=null, onEnterFrame=undefined & delete onEnterFrame....

Which one to use??? What are the performance considerations. If all my movieclips on-stage are running a MovieClip.prototype.onEnterFrame = function() {run initial stuff before setting onEnterFrame=null/undefined... }, will there be performance hits? It's sad that delete onEnterFrame doesn't work unless I delete the prototype enterFrame as well, which would make the clips reinitailise itself again once you declare the enterFrame prototype again (i need to do this since there's more movieclips that end up appearing on-stage, and they need to automatically initialises themselves the moment they appear).

[Code]...

View 5 Replies

Using The 'for' Loop For Efficiency?

Jun 17, 2009

I've got a long list of code which I think can be made far more shorter by using a 'for' loop, however, I'm not entirely sure how to go about this? Here's the code I have at the moment

if(event.target.hitTestObject(zone0_mc) && zoneFull[0] == false && event.target._ballPlaced[event.target.name.substring(4,5)] == false) event.target.x

[code].....

View 2 Replies

ActionScript 3.0 :: OnEnterFrame - The OnEnterFrame Is Not Triggered Automatically By Flash Player At Run Time

Feb 1, 2010

i'm very new to Flash (although have plenty of experience in Java, C++, PHP, etc). For a University assignment, I am creating a World Cup Guide and i'm creating a countdown to the tournament. I've followed a tutorial and modified it slightly but i'm receiving an error message. The error message is:

[Code]....

View 1 Replies

Professional :: Building A Music Player / Efficiency?

Mar 8, 2012

I'm creating a music player to be on my website and so far I have it set up as such: The player is contained in a movieclip with a 'song progress bar', a pause and a play button.The songs are played by clicking the song title in a list in the main stage (not contained in the player movie clip), which sends the music player to the frame in which the song starts.
 
My audio is set as event audio so that the play and pause buttons can be coded as play(); and stop(): respectively which will stop the main player movie clip thus yeilding the progress bar from moving further and the song from playing.
 
This works just fine, except for the following:
 
- When I select event as my audio type the quality reduces dramatically Having the audio files in my library and not obtained from some outside source (i.e on my website's server) causes the .fla file to be much larger as well as the .swf Being as my project is at 24 FPS and each song is represented in as many frames as it takesto play the song out, my music player at present has only 3 songs 'in it', and my frames in the movie clip are approaching 20,000 (this is VERY tedious to work with) 
 
I'm sure there is a more efficient way of doing things, but my knowledge is limited. I'd imagine I can do something along the lines of loading .mp3's off of my website into the frame and the play pause buttons will enact more elaborate scripts that not only stop the progress bar but also stop the music from playing temporarily, or something like this. But I have no idea how to implement it

View 2 Replies

Flash :: Massive Efficiency In Timeline Project?

Feb 1, 2012

this is the offending bit of code:

for (var i in yearMarkersArray) {
yearMarkersArray[i].x = ((timelines.x + 350) % 140) + (140 * i) - 5;
yearMarkersArray[i].text = "0";
}

This is part of the main loop that triggers whenever the user drags the zoomed-out timelines (the sprites in eventsArray) left or right. The six TLFText objects in yearMarkersArray appear to scroll left or right with the user, but are really repositioned and relabeled with the correct year markers as calculated by a function I did not include above (it's working and not relevant to this problem, I simply replaced it with the "0" for clarity).

The text-setting statement is the problem code...I've commented literally everything else out of the main loop to verify it. I even changed the statement to not involve any function call (simply setting the text attribute to "0"), and it still causes the final .swf to eat an extra 1% of my CPU every 15 seconds until finally the FPS crashes through the floor. The rest of the main loop has much, MUCH more complex and I'm sure inefficient code that also runs every frame,Since this project reads a data file with a list of timeline events whose span of years I cannot predict, I do need the displayed year markers to be done dynamically in some way. The code ultimately works (I only noticed the ridiculous slowdown when I accidentally left the movie open and idle for a few minutes),

View 2 Replies

ActionScript 2.0 :: Lines Between Dots Approach: Efficiency?

Dec 20, 2006

I've got a question about the efficiency of two functions I wrote that do the same thing. I'm trying to figure out which one to use. The functions draw lines between a series of points, and continually redraw them as the points move. The first function uses the drawing functions in flash.The second function creates an empty movieclip and draws a short line in it, then uses trig to scale / rotate the movieClip to make it fit between the dots.Both work, but as my program gets larger I'm wondering which function would calculate faster.

View 5 Replies

ActionScript 2.0 :: Delete OnEnterFrame Start OnEnterFrame?

Sep 26, 2008

any consise methods to restart a deleted onEnterFrame that has been deleted?

View 3 Replies

ActionScript 3.0 :: Increase Efficiency Of Created Moves Around The Screen And Another Object

Sep 21, 2009

I wrote a class for an object that as soon as it is created moves around the screen and can create another object (replicating itself). That seems to work fine for a while, but after like 20 or so objects on the screen things slow down a lot! I create the first object on frame one. The rest is all done by the objects themselves.

Would it be better if the objects did not move around on their own, but rather through a loop on frame one or does it not matter? I am working on a simulation that should go up to over 100 objects, but with this problem can't get there. The object is just a movie clip (imported png picture about 4 by 7 pixel, not animated). I was going to replace it with an animated one later, but that seems unlikely now.

View 4 Replies

ActionScript 2.0 :: Flash8 OnEnterFrame Once A Second?

Dec 5, 2010

I use this:

this.onEnterFrame = function(){
if((kropp==2)&&(huvud==4)&&(bg.BGtyp==1)){
bg.nextFrame();
trace("good");
}

to know when different variabels are right. But I don�t want the check to be once every 2 second and not every frame. I could put the code in a looping mc but could I do that in a code?

View 2 Replies

ActionScript 2.0 :: How To Kill OnEnterFrame

Apr 27, 2011

I have a main.swf file and it will load an external swf file.I have this code in the external swf file:[code]So when the external swf file loaded in the main.swf, the color_picker is visible in the main.swf.Everything works just fine but I just need to know how to remove (Kill the onEnterFrame) when the external swf file has been unloaded or replaced with another external swf file?

View 2 Replies

ActionScript 1/2 :: OnEnterFrame Won't Play?

Apr 17, 2009

I have a script with some onEnterFrame's.. my problem is that I can't evoke more than one of the functions in "onframe()".. after the first function "onframe1()" has ended nothing more happens.. if I switch the two functions ("onframe1()" and "onframe2()"  arround or I escape the first the script still ends after the first function is done

function onframe(){  var i = 0; onEnterFrame = function() if(i == 10) onframe1();  if(i == 200) onframe2();//delete this.onEnterFrame; i++; }}

[code].....

View 8 Replies

Professional :: How To Use This.onEnterFrame = Function()

Jan 10, 2010

as2 this works but in as3 it no work how do you do this in as3
 
this.onEnterFrame = function() { if(Key.isDown(Key.UP)) {  square._y -= speed; }

View 4 Replies

Combining The OnEnterFrame Functions?

Sep 8, 2011

i have a few onEnterFrame functions like 6 to 7 which I want to combine them into a single function. But it doesn't work after adding the function.

View 4 Replies

Flash :: OnEnterframe And Tween In C#

Aug 24, 2011

I'm trying to write some programs with kinect sdk in c# , I'm a flash developer and my skills are in actionscript , and I've written some simple projects with c# , the thing I wanna know is that is there a function like onEnterFrame in C# ? or something like tween functions in C#

View 1 Replies

ActionScript 2.0 :: OnEnterframe The Mc Can't Stop?

Jun 16, 2010

my prblem is my mc cant stop after hiting the mc hoe to stop ms after hitingI used this code to stop this Mc and its work Butthe mc hit only one time 2nd time its doesn't touch the mouse

if(this.hitTest(block)==true)
{
//this._x= this._x+60;

[code]....

View 0 Replies

ActionScript 2.0 :: OnEnterFrame() Only Running Once?

Nov 16, 2010

I have a set of movie clips that are attached to the stage every so often. The attached movie clips all move independently with their own class code. After I changed something in an unrelated class, my attached movie clips only run their onEnterFrame() code once, instead of once per frame. I called up the list of variables, and my movies (which are passed into an array) are all "undefined". I'm not really sure whats causing these movie clips to not run their code properly. This is the code for attaching them:

ActionScript Code:
var target = _root.attachMovie("Target", "Target" + _root.getNextHighestDepth(), _root.framework.depth[7]);
target._y = _root.framework.paths[attachlocation][0]._y

[Code]......

View 1 Replies

ActionScript 3.0 :: Moving This Out Of OnEnterFrame?

Sep 12, 2011

Ok, This actually works butI want it out of EnterFrame. what is going on is this... The user moves a movieClip called selector.selectorCollisionBox over the movieClip called fG.buidling1 Then the string buildingName is no longer NULL or "", it becomes whatever I set it to. Also a Button is added to the top of the selector so the user can click that and 'enter the building' to view info about it.(or that last part is the plan down the road)

[Code]...

problem is, it seems like it is checking this constantly because I have it on EnterFrame. Is there a way to make an event that just specifically looks for if (selector.selectorCollisionBox.hitTestObject(fG.bu ilding1)) ?? Or better yet, maybe I can have a boolean, overBuilding1 = true that fires all those properties off once instead of every EnterFrame? That way onEnterFrame just fires off a condition? I am so close to understanding this.. I feel like I am at my last brain hurdle.

View 1 Replies

ActionScript 2.0 :: Delete A OnEnterFrame That Is Placed On The MC Its Self?

Jun 20, 2004

can you delete a onEnterFrame that is placed on the MC its self, for example:

Code:
onClipEvent(load){i=0}
onClipEvent(onenterFrame){
i++
if(i>50){
delete this.onEnterFrame
}
}

the concept is simple and works when placed on the timeline but does not work when placed directly on the MC.

View 7 Replies

ActionScript 2.0 :: Execute OnEnterFrame?

Feb 7, 2005

ok, should this work or am i barking up the wrong tree?

Code:
onEnterFrame = traceMe("test")
traceMe = function(param){

[code]....

View 1 Replies

ActionScript 2.0 :: Play A _MC OnEnterFrame?

Oct 24, 2005

Im quite confused its early in the morning i have just made a vnice website layout and i cant think of how to play a MoveClip on enter each page... On enter page to play a "Flash" Effect like a page transaction.

View 1 Replies

ActionScript 2.0 :: OnEnterFrame In A For() Lopp?

Jun 19, 2006

I have this code to go through all my movieclips and give EACH of them an onEnterFrame function.

Code:
for (var i = 0; i<menuTot; i++) {
var thumb:MovieClip = holdThumb.attachMovie("thumb", "thumb"+i,holdThumb.getNextHighestDepth());
thumb.onEnterFrame = function() {
//whatever
}
};

So the problem is that the only onEnterFrame function that works is the last movieclip. Obviously there is somthing wrong when defining it as it is only taking the last thumb variable for the name. How do I get it so each thumb clip gets its own onEnterFrame function?

View 6 Replies

ActionScript 2.0 :: Why Won't The OnEnterFrame Work

Aug 11, 2006

[code]Why won't the onEnterFrame work?

View 1 Replies

ActionScript 2.0 :: OnEnterFrame In A Class?

Sep 6, 2006

I am studying �classes� in order to develop one that allows me to drive a car. After some tries a doubt came out: where to put the controls to drive the car? I mean, where to put the OnEnterFrame handler to refresh the position of the car? In the class or in the main fla?

Code:

//Main .fla
stop();
var Car:car= new car ();
var onEnterFrame:Function = Update;

[code]....

Is it possible to have the handler in the class?

View 7 Replies

ActionScript 2.0 :: Firefox/ie Bug With OnEnterFrame?

Jul 12, 2007

The gallery I am working on works fine when I preview it, and fine in IE, but not fine in firefox.

you can see it here:

[URL]

I have narrowed it down to firefox not liking the loader.onEnterFrame, but even when I change it too a movieclip thats already there, no luck. infact, it only seems to work if I change it to the root onEnterFrame, but I need that for my scroller (which lags if you place it in any other.onEnterFrame, annoyingly).

is this something to do with firefox, or is it a code problem?

here is the fla, if you'd like to have a poke around for me (cs3 format, but I can do different ones if needs be):

[URL]

View 9 Replies

ActionScript 2.0 :: OnEnterFrame Not Working?

Dec 13, 2007

var mcHolder:MovieClip = _root.mcHolder;
mcHolder.onEnterFrame = function() {
trace"hello");

[code].....

View 1 Replies

ActionScript 2.0 :: OnEnterFrame In Mx Not Working

Dec 31, 2008

I am running a test using onEnterFrame in flash mx but its not working for the life of me... Heres the code:

[Code]...

I am trying to get the text box to always register the width of the "test_mc" however it will not change from 100 it doesn't even start at 100! I tried changing the "_xscale" to _xmouse to see if it would change the text and it worked but still not for "_xscale"!

View 2 Replies

IDE :: OnEnterFrame Won't Stop Until I Click

Jun 18, 2009

I have a goofy issue going on with a drag/drop scroller. When i stop dragging the following onEnterFrame will not clear/stop unless you click on the movieclip again, then it clears.

Can one of you coder minded people see anything wrong with this? It works great, but i need it to clear as it's taking up that precious memory [code]...

View 2 Replies

ActionScript 2.0 :: _x Position Without OnEnterFrame?

Apr 27, 2005

Is there a way in AS to stay aware the _x position of a flash movie, without using onEnterFrame action?

I want to create a dynamic generated movie, but because i'm using Laco's tween class, I may not use onEnterFrame.

View 9 Replies

ActionScript 2.0 :: Use The OnEnterFrame For The ScrollPane/MC's?

Jan 5, 2004

I am using createEmptyMovieClip to create MC's based on values from an array. The MC's are placed into the FScrollPaneSymbol component. They load ok however the getURL that should be loaded from the array doesn't work. I've only been able to get it working if I put in an onEnterFrame function but that makes it assign the last url from the array to all the MC's.

Code:
foo.onEnterFrame = function() {
for (q in portfolio.sections[0].items) {
//loader[thumbX] is a dynamically created MC[code].......

If the array values are 1,2,3 it assigns the geturl for each of the MC's to "3";Do I even have to use the onEnterFrame for the ScrollPane/MC's?

View 2 Replies







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