Flash :: Slowndown Stays After Using And Removing A Lot Of Objects

Jul 19, 2011

I use this piece of code to create some eyecandy of debree falling. When an object is destroyed i spawn some rubble and let is fly over the screen. But... when i use this a lot, slowdown is there and even when all the objects are gone the slowdown stays. The good old 50fps won't come back anymore

public function destroyBlock(xPos,yPos,nrObjects) {
for (var debree = 0; debree < nrObjects; debree++) {
debreeObject = new mc_ground();

[Code].....

View 2 Replies


Similar Posts:


Removing Objects From Stage In Flash CS4

Oct 15, 2009

I have a problem with this code:[code]There are two overlapping objects on my stage: character_mc and vanish_mc. As soon as i start the scene [Ctrl+Enter] vanish_mc is VISUALLY removed. But the code still sees a collision somehow. How can i Entirely remove the object vanish_mc?

View 7 Replies

ActionScript 3.0 :: Flash Is Removing Objects

Sep 14, 2010

I seem to be running into some garbage collection issues. I'm making an RTS game with a side scrolling map. I have a "game" layer on the stage which scrolls left and right, all the troops, vehicles, bullets, etc are within this layer. If I scroll the game layer to the far side of the map from some tanks placed at the other end, the tanks disappear. I can only assume flash is "helpfully" removing objects it thinks are too far away form the action to be of use any more. I'd rather it didn't.

View 2 Replies

ActionScript 3.0 :: Flash - Removing Objects When They Reach The Edge Of The Screen

May 28, 2011

currently i am removing objects when they reach the edge of the screen with

[Code].....

i understand this does not delete the object? without removing event listeners before removing the object the error log fills up, i believe its due to the stage isnt there after its removed. this makes me think that removechild does not delete the object? i will be creating and deleting many objects during runtime, and i dont want to slow down or use too much memory, how to properly free up the object

View 3 Replies

ActionScript 3.0 :: Removing Objects Without Using For Loop?

Jul 10, 2009

i am having a problem removing objects from the stage and their associated arrays. basically when a "shark" is added to stage i want all "cans" to be removed and i dont want any "cans" to be added until the shark has left.my problem comes as i dont want to keep using for loops as i already have two or three for "cans" alone and i heard thats not good for the code!

Code:
var canTimer:Timer=new Timer(2000);
canTimer.addEventListener(TimerEvent.TIMER, addCan);
canTimer.start();

[code]....

im not 100% sure were to put this in my code-i didnt really want to put it in a function of it's own as it would mean using another for loop?i get a output error when a shark is added like this:

Quote:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/contains()
at dolphinmoviegame_fla::MainTimeline/canHitTest()

even though all "cans" are removed.

View 1 Replies

ActionScript 3.0 :: Removing Various Objects From An Array?

Feb 23, 2009

I have a utility function:

function removeFromArray(item:Object, arr:Array):Object {
for(var i:uint = 0; i < arr.length; i++) {
if(item == arr

[Code]....

This function searches through an array and sees if an item exists in it, if it does, it removes it and returns a reference to that item.

This works fine for most things. But I just ran into a problem where I need to remove an array from an array.

so my array looks like this [ [item1a, item1b], [item2a, item2b] ]; and i need to remove [item1a, item1b] from it. But passing in the the array to remove and the full array to remove it from does not work because i guess of the casting to an object in the parameters list. Can the functionality i want be used? if so how?

View 1 Replies

Actionscript 3 :: Removing Display Objects?

Mar 19, 2010

i don't understand why none of my display objects are not being removed. when i press the button, i'm expecting a trace and removal of both shapes and the button, but nothing happens:

[Code]...

i realize there are better ways of accomplishing this, but i'm learning and therefore only interested in why the above code doesn't work.

View 3 Replies

ActionScript 3.0 :: Removing Objects From Array?

Feb 4, 2010

I have made a class that creates a dotted line following a moving object. The dotted line is small circle added to the stage (and to an array) every half a second at the object's position.

First I add the circles to the stage, when the object stops moving I remove them from the stage.

This, however, only works twice, after that it throws a "display object must be a child of the caller" warning.

ActionScript Code:
public class Path extends MovieClip {
var tInterval:Timer=new Timer(50,500);
var pathArray:Array=new Array  ;

[Code].....

View 2 Replies

ActionScript 3.0 :: Adding And Removing Objects

Feb 22, 2012

I'm making a banner rotator that reads image urls from an xml file and adds them to a sprite on the stage, then tweens them into position. Here's the relevant code:

[CODE]....

View 2 Replies

ActionScript 3.0 :: Best Practices For Removing Objects?

Apr 3, 2009

I have a question about how best to remove display objects.removeChild(object);Given that there are no other reference to this object, does using removeChild alone make the object eligible for garbage collection, or does it also need to be given a null value as well?[code]In both these cases, I get the classic 1009 error. That leads me to believe that if you use removeChild, you don't also need to give the object a null value.?url...

View 2 Replies

ActionScript 3.0 :: Objects - Removing The Item From The 3D Space

Dec 10, 2008

I've created a navigation system using Flash 3D functionality. It consists of a MovieClip with a rounded rectangle + a text with no-antialias bitmap font. I'm using Tweener to modify the z co-ordinates of the mc to make it "slide onto" the stage. However when the mc is completed animating it is notably blurry (the text at least). I was wondering if it might just be because it's in 3D-space the perspective (which hasn't been modified) is throwing the rendering off. So onComplete of the animation I try assigning null to the z-value in hopes of removing the item from the 3D space. I've attached the package code I'm using to create and animate the navigation feature.

View 1 Replies

Removing Event Listeners And Null Objects?

May 14, 2009

I was just wondering--and it's probably an obvious question really--if I make an object null and that object had one or more event listeners registered, are the listeners removed?

for example:

Actionscript Code:

object.addEventListener(Event.SOME_EVENT,callBack);
function callBack(evt:Event):void
{
object = null;

[Code].....

In this case have I removed 'object''s listener when I made the object null?

View 1 Replies

ActionScript 3.0 :: Removing Display Objects Using Timer?

Jan 1, 2010

I have an animation of footprints being left on the ground as if by an invisible man or ghost. the animation consists of:

1 movieclip containing --> 5 footprints each one is an individual movieclip. Each print fades in and out using the Tween class with an alpha effect

The main timeline uses the following code to create random instances of the animation:

var myTimer:Timer = new Timer(12000);
myTimer.addEventListener("timer", timedFunction);
myTimer.start();

[Code].....

so it looks like the function is being called correctly and removing the first instance of FOOT from the stage. but the 2nd iteration generates the error. Is this is a problem with the timer? I would like to send this to someone for examination and assistance.

View 3 Replies

ActionScript 3.0 :: Removing Unreferenced Objects From Memory

Oct 15, 2009

I'm trying to make a Starfield program as practice for ActionScript 3. I'm using a timer event in the document class to create Star objects which are defined by an object class connected to the movieclip Star in the Library. The object class has a timer as well, and at each tick it repositions itself a few points away and scales up, creating the image of a star shooting towards the sides of the stage. When the star has gone past the boundaries of the stage or when it has scaled to a certain size, it removes itself from the display list with the command: this.parent. removeChild(this);This removes the star from the display list just fine, however after that I can't get the star to set itself to null so that it will be removed from memory, and I'd like some suggestions on how to do this properly. An idea I had was to make a function in the document class that the child objects can call, something like this.parent.KillMe(this) which would give itself as a reference to the function, which could then use a local variable reference to set the child to null, removing it from memory. This all seems terribly complex, so I'm sure there's another way.

I haven't noticed a memory leak or slowdown, however, so I'm curious if objects without references that are removed from the display list are automatically removed? That could be both good and bad, as the object might want to add itself to the display list again at a later time; not in this Starfield program, but perhaps in another I write.

View 11 Replies

ActionScript 3.0 :: Removing Listeners In Child Objects?

May 1, 2010

I'm moving two objects accross the stage at different rates using the same function:

Code:
function moveClip(clip,speed){
clip.addEventListener(Event.ENTER_FRAME,moveIt);
function moveIt(event:Event) {

[Code]....

In AS2 I'd just use dot notation as above and it would work from anywhere or perhaps _root.red....

I've tried root. stage. childbyname Not sure where to from here.

View 2 Replies

Flex :: AS3 - Removing Objects By Array Item Reference

Jan 2, 2010

I am trying to add some Sprite objects as the contents of an array, and I would like to be able to "clear" them from the stage. I would assume that if there are loaders involved, I need to do
_imgArray[i].close();
_imgArray[i].unload();

And if I am using a sprite, I can do:
removeChild(_imgArray[i]);
None of the above work.

Currently I try:
for(i = 0; i < _localXML.length(); i++) {
var tmp:BMLink = new BMLink(_localXML[i], _bw, _bh, i);
_imgArray[i] = tmp;
_imgArray[i].x = (_bw + _mainpad) * i;
_base.addChild(_imgArray[i]);
But this doesn't work.

The class instances that are populating the array are all extending sprite, but they have their own individual loaders inside w/ progress events etc.

View 2 Replies

ActionScript 3.0 :: Any Number Command / Removing Objects From Arrays?

Apr 18, 2011

I've got an array of coins, which are called within the array coin1, coin2, coin3, coin4 etc. I'm trying to reference them to say if the character hits coin 2, then coin2 will disappear. Here's my array (so far):
ActionScript Code:
var coinArray:Array = [coin1, coin2]; //an array which contains all of the coins

And here's the script I'm working on:
ActionScript Code:
function coinCollect(evt:Event){
if (collisionTest (character, coin/*[n]*/){
var i:int = /*the number from coin[n]*/ - 1
remove coinArray[i]
}}

But I'm missing some major things, mainly how to reference which coin has been hit, and how to take the number from that coin and take 1 from it to reference it's correct position in the array? (the code in /* */ tags represents things I'm not sure on the code of).

View 2 Replies

ActionScript 3.0 :: Removing An Object Removes Its Instances Objects And Events?

Mar 7, 2011

Im creating a game. When the current game has finished, I thinking to do this:
 
removeChild(game)
game = null 
then
game = new Game()
 
Doing this way, it automatically removes the games object instances? It automatically removes the games object instances events? That would be an easy way to restart the game, if yes for both questions.
 
Can I do like that, or I have to remove all objects and events manually?

View 4 Replies

ActionScript 3.0 :: Removing A Bunch Of Objects Added At Runtime Via A Timer?

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

ActionScript 3.0 :: Removing Loaded Objects / Events From Player Memory?

May 31, 2010

Is this at all possible? I just finished re-building my entire portfolio site in AS3 because I can't change the frame rate for loaded content in AS2. Now I find out after completely rebuilding this thing that AS2 content gets stuck in Flash Player 9's memory and won't erase on Loader.unload. All my work from years back is in AS2.

View 0 Replies

ActionScript 3.0 :: Removing Objects In Tree Structure From Display List

Mar 21, 2011

I've asked this question before but had no answers... so here I go again I have a structure of objects: Top object A has as children (addChild children that is...) one or more objects B_1 to B_n. The B_n may in turn have one (1) associated object A' (Same type as top object, not displayed to begin with). When I click a B_n two things may happen:

1. If it has as associated object a A', put it on the stage (as child to B_n).

2. Otherwise it is a leaf and it does other things.

If '2' happens I want to collapse the tree, that is remove the top and all children of same type from being displayed. I thought a recursive approach should work:

[Code]....

View 4 Replies

ActionScript 3.0 :: Adding/Removing Objects To/from An Array Based On A Variable?

May 8, 2009

So a small example of my situation...On my stage I have 5 items labeled item1_mc, item2_mc, item3_mc and so forth...they all have two keyframes on their respective timelines, one labeled "active" and the other "inactive". My code contains 2 arrays, inactiveArray and activeArray and a variable known as energy that regularly goes to and from 0 - 100.

What I am looking to achieve is basically the function of...

if energy >= "insert given items 'active threshold' 20, 40, 60, etc..." then add it to the activeArray, if it is not, remove it and add it to the inactive array.

all objects in activeArray gotoAndStop("active");

all objects in inactiveArray gotoAndStop("inactive");

I have tried many different ways of achieving this effect but I always end up with duplicates and extras or something doesn't move when it's supposed to, where it's supposed to, it just ends up into a giant cluttered mess and I start from scratch.

View 8 Replies

ActionScript 3.0 :: Removing Parent MovieClip Erase All Children Objects?

Jul 14, 2010

I have a movieclip which contains other movieclips/loader. Does removing the parent movieclip removes all the children objects?

View 5 Replies

Flash Button Stays Down

May 24, 2011

I'm building in flash a house. Now I want when I click on a door it stays open.
I'm using an button for the effect.

I think I need some code to keep te button in the down state after I clicked it

Here's my Actionscript 3

import flash.ui.Mouse;
import flash.events.MouseEvent;
// SOUNDS

[Code]....

View 1 Replies

ActionScript 2.0 :: Flash 8 Button Stays In Down State When Clicked

Oct 23, 2009

I used the tutorial here: [URL] to achieve the above, which I did. Then I tried putting AS on the buttons I made to import external clips and they stopped working completely. I've tried putting the AS on the main time line as well as on the btn itself, I've even tried recoding the script from the tutorial. I've attached the file which should work to me. if the btn code is deleted from the main timeline the menu acts as it should but doesn't link any where.

View 1 Replies

Flash :: Element Stays On Stage After Manipulating The Index(depth)?

Mar 24, 2010

Here is the problem I have: after I change the index of one movieclip using this code

oldIndex=getChildIndex(DisplayObject(e.target));
setChildIndex(DisplayObject(e.target), numChildren - 1);
when I give the object its old index
setChildIndex(DisplayObject(e.target), oldIndex);

and go to another frame of the movie, this element I have changed the index of stays on top of all elements on the new frame. My question is am I doing something wrong and if not, what can I do so that this element stays only in the frame it is placed.

View 1 Replies

Actionscript 3 :: Flash - Fullscreen Mode - Screen Stays Black

May 8, 2011

i'm trying to create a fullscreen slideshow with as3. My problem now is that if I click the fullscreen button too quick (--> before the image has been loaded and hasn't therefore been added to the stage) the screen just stays black and nothing is working anymore (the following images aren't loading either. Here is a demo of the problem:
[URL] Here is the code:

[Code]....

View 1 Replies

ActionScript 3.0 :: Flash Movieclip That Stays Within The Perspective Of The Page User?

Feb 19, 2012

I need a movie clip that will stay in the same place on the x axis, but will scroll up and down with the page viewer on a website. staying in view.

View 1 Replies

Professional :: Replacing Images In Flash Presentation But Slideshow Stays On First Image

Jan 3, 2012

I have used this slideshow for few projects and all I've done in the past is import new images (about 100k) and publish. The image are bit map of type (png) not big about 100k size.
 
Without saving the file I do a "test movie". Instead of doing the slideshow it displays the first image but doesn't loop through the rest.
 
I'm at a bit at a lost here. The path to the image in bitmap properties on the origanal file in imported is relative but when I select a new image its full path. 

View 1 Replies

Flash - Make Sure Children Stays Inside Parent Movieclip's Shape?

Mar 17, 2010

Red: Shape inside parent movieclip,

Yellow: Children inside parent movieclip

I'd like to animate the yellow dots, but make sure that they never gets out of the red shape's boundary.

View 3 Replies







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