ActionScript 3.0 :: Movieclip = Null; Garbage Collecting?

Jul 26, 2010

after strolling through the internet looking for garbage collecting of dynamic movieclips i conceded and justified to myself i should make a forum post.I'm making a small game, with many many explosions. Explosions are random swfs which i cache before using them. Problem is that although i did everything to make them ready for garbage collecting, they seem to overflow the memory.my code:

Code:
package
{
import flash.display.MovieClip;[code]....

the last line, 'e.target.parent=null ', is the way i know how to make movieclips ready for garbage collecting. But if i uncomment the line, I get this error:

Code:
ReferenceError: Error #1074: Illegal write to read-only property parent on example03_fla.MainTimeline.
at Explosions/::doneHandler()
at flash.events::EventDispatcher/

example03_fla is the timeline of the supposed movieclip i'm trying to delete, not the document fla.

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Trace Object References For Garbage Collecting?

Oct 12, 2009

I'm trying to get my head around optimising AS3 code and clearing things out for garbage collection.

I understand that each time an item is referred to in the code it has its reference count increased by one, so I was wondering if there is a trace option I can use to see how many references each of my objects has?

I can then see where things are getting left behind (if they are) and where I can make optimise better.

I think it would help me work out several issues if I was able to do this

View 1 Replies

ActionScript 3.0 :: Garbage Collecting - Make Sure There Are No Memory Leaks?

Feb 9, 2010

What's necessary to do when removing an object to make sure there are no memory leaks? Do you have to remove all children? Or just remove all event listeners? Or both?

View 1 Replies

ActionScript 3.0 :: TweenLite CPU Optimization - Just Stacking And Never Garbage Collecting?

May 12, 2011

I'm currently working on a game where every "Step" - defined by a global time modifier - everything on screen calculates where it's next position will be, then uses tweenlite to animate itself to that location. This program runs for about 10 seconds before it eats 100% of my CPU. iMac i5 quad core, so it's not the hardware.

The problem is specifically in the following snippet, and the peculiar thing is if I teleport everything to it's next position (i.e. don't tween it there) the CPU is stable at 6% (where flash IDE consumes 4%). Does anyone know why these tweens are just stacking and stacking and never garbage collecting? (This is what I assume the problem is, as I can't find another explanation as to why the problem only exists when i TWEEN to the next location)

[Code]...

View 3 Replies

Actionscript 3 :: Marking A Variable For Garbage Collection, Null Or Delete?

Jan 28, 2011

If you have a variable that is a MovieClip, Sprite, String, Number, int, uint, or a Boolean, do you remove it's reference by adding:

myVariable = null;
OR delete(myVariable);

View 2 Replies

ActionScript 3.0 :: Garbage Collection And Arrays - Set It To Null, That Space Should Be Deleted?

Sep 25, 2009

I have a question about garbage collection in AS3. Let's say that I create a simple class, Item and link a movieclip in my library to this class. Now, in my main program, I create an array of Item's as follows:

Code:
var problemArray:Array = new Array();
function myTest()[code]....

Have the three references in the array that point to the three objects been deleted??? I made sure to set weak referencing on the event listeners that I attached, so I would think they would be marked for garbage collection. I am used to working in C++ so I usually delete all of the items myself and use a destructor in my classes, but since flash uses the garbage collection, I can't even seem to see what the reference count is to even know if my objects are marked for garbage collection. My thought is that an array is just a space in memory and if I set it to null, that space should be deleted, but I'm not sure if it is truly deleting these references or not.

View 3 Replies

Actionscript 3 :: DisplayObject Be Garbage Collected If Its Reference Is Set To Null, But It's Not Removed From The Display List?

Oct 6, 2011

Will a DisplayObject be garbage collected if the only reference keeping it in memory is set to null, but it's not removed from the display list?

View 1 Replies

ActionScript 3.0 :: Removing MovieClip And Garbage Collection

Nov 24, 2010

I have some odd behavior while removing a MovieClip. I create a MovieClip (character) in an empty project on an empty stage (the movieclip is made up of several other clips for arms, legs etc.)[code]Then it keeps climbing for a while and then jumps back down to:126095360.Then it keeps climbing again -> jumping back -> climbing - jumping back. But each time it jumps back it has a little extra memory added. I can understand the first time memory increases after adding and removing the movieclip. Obviously the Garbage Collector needs some time before kicking in. However, why does it start to increase again and again?I noticed the memory usage instantly jumps back once I remove the MovieClip. However, It will still be increasing afterwards.

View 4 Replies

ActionScript 3 :: Garbage Collection - Removing MovieClip From Display List

Feb 21, 2010

If you're removing a MovieClip from the display list, and that MovieClip in turn has child MovieClips which have their own event listeners, is it necessary to remove ALL listeners from the child MovieClips? or just the parent MovieClip that is being directly removed from the display list?

View 2 Replies

ActionScript 3.0 :: Collecting User Data?

Aug 24, 2010

I've got to create a form with 2 fields (Name, email adress) that users can type their information into, but i then need to collect the data and store it somewhere (so i would then have a file showing everyone's names and email addresses that have been entered).I have quite a good knowledge of flash front end development but don't know alot about hooking stuff up to xml/php whatever

View 1 Replies

Actionscript 3 :: Collecting And Identifying Functions Within An Array?

Dec 28, 2011

I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.

function doSomething(someArg:Object):void {
if (conditionIsFalse){
operationsToDoWhenConditionIsTrue.push(function(){
doSomething(someArg);

[Code]...

Basically if doSomething is called twice, I only want operationsToDoWhenConditionIsTrue to hold the most recent invocation. Obviously since the invocations are wrapped in function(){} all the functions are the same. Is there any way I can accomplish what I want?

View 1 Replies

Flash - Collecting High-volume Video Viewing Data?

Apr 5, 2010

I want to add tracking to our Flash-based media player so that we can provide analytics that show what sections of videos are being watched (at the moment, we just register a view when a video starts playing)

For example, if a viewer watches the first 30 seconds of a video and then clicks away to something else, we want the data to reflect that. Likewise, if someone watches the first 10 seconds, then scrubs the timeline to the last minute of the video and watches that, we want to register viewing on the parts watched and not the middle section.

My first thought was to collect up the viewing data in the player and send it all to the server at the end of a viewing session. Unfortunately, Flash does not seem to have an event that you can hook into when a viewer clicks away from the page the movie is on (probably a good thing - it would be open to abuse)

So, it looks like we're going to have to make regular requests to the server as the video is playing. This is obviously going to lead to a high volume of requests when there are large numbers of simultaneous viewers.

The simple approach of dumping all these 'heartbeat' events from clients to a database feels like it will quickly become unmanageable so I'm wondering whether I should be taking an approach where viewing sessions are cached in memory and flushed to database when they become inactive (based on a timeout). That way, the data could be stored as time spans rather than individual heartbeats.

View 2 Replies

ActionScript 3.0 :: Triangle Maths - Collecting Stars That Appear At Random Moments?

Jan 13, 2012

i want to finish it in the end! i have this code which generated 20 stars and an ai player collects all of them (going for the one which is closest to it). This code was courtesy of -lauri... the code was

ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;[code].........

what i have currently is a player who moves around with the arrow keys collecting stars which appear at random moments... i wanted to make it so that the ai can also collect these stars and i am pretty sure that the code for that would be linked to what.

View 6 Replies

ActionScript 3.0 :: MovieClip In A MovieClip Is Null?

Jun 29, 2009

I had everything working fine, until I put my menu in a MovieClip so I could animate it entering in.

[Code].....

View 9 Replies

ActionScript 3.0 :: Movieclip Making Itself Null?

Oct 4, 2009

I have a movieclip with a class attached to it, so obviously i can acces it with commands of the kind this.* What i want to do, is delete the movieclip after some time (it's a bullet from a tank and I want it to be gone after explosion). I can removeChild it, but the code "this = null" doesn't work.Is there any way to get it out of my memory? Because now my application slows down and in 5 minutes it's unplayable...

View 6 Replies

ActionScript 3.0 :: Null Object Reference For MovieClip

Mar 27, 2010

My movieclips are being nulled when moving between scenes, they are created on the stage and accessed through as3. I have login screen with three button, one logout, one exits the system and the other takes them to the next scene. When going back to the login scene, and trying to access movieclips like add eventlisterners etc... it comes back with null object reference, claiming that my buttons which are on the stage are null and sure enough if I debug they are. Any reason why my movieclips are being made null when moving between scenes?

View 2 Replies

AS3 :: Android - MovieClip Keeps Giving Me A NULL Object Reference

Dec 3, 2011

I have a Android Air application, where I import a png image to the stage on frame two and converted it to a symbol as a movieclip. I am performing a hovering animation using this image as a movieclip and it works great but when I go from frame 2, where the animation is, and I move to frame 3, 4, 5, or 6, and then I move back to frame 2, my application throws a errors when referencing the movieclip again. The error is 1009 cannot access null object reference. So to me it seems that once the timeline moves away from frame 2 it wipes away the reference to the imported image converted to a movieclip....is this correct? Is there a way I can keep the timeline referencing the this image as a movieclip so I can always come back to this frame?

View 1 Replies

ActionScript 3 :: How To Update Array Automatically When MovieClip Null

Mar 30, 2012

I am trying out the following code, so that whenever I make a movieclip null, the array containing it's reference too becomes null. I understand the following code cannot do this, but I want somehow, the array can provide information, if the movieclip has got null.

import flash.display.MovieClip;
import flash.events.Event;
var a_arr:Array = new Array(a_Mc,b_Mc);
trace(a_arr);
a_Mc= null ;
trace(a_arr);

Output is:
[object MovieClip],[object MovieClip]
But I want something like null, [object MovieClip ]

View 3 Replies

ActionScript 3.0 :: Null Property Error When Trying To Connect To MovieClip From Class?

Jun 28, 2010

Ive been working on a project at the momment and ive been having an issue with accessing a MovieClip that has been created in another file called fileA and i want to access it from fileB the only Problem is that FileB Doesnt know it exists in FileA and it returns back this error

Code:
Error #1009: Cannot access a property or method of a null object reference.

Code below is in fileA

Code:
public var ChangeControlMc:MovieClip = new control();//This one is defined in FileA

My Code for FileB is as Follows

Code:
public var ChangeControlM:AntarcticaGame // this is Defined in fileB
trace("test level 1");
trace("called after super save()" + ChangeControlM);

[code]....

View 1 Replies

ActionScript 3.0 :: MovieClip(root).gotoAndStop(myFrame); Returning Null?

Jul 26, 2011

Ive embeded my game.as file as a movie clip into a new .fla which has 1 frame for the game, 1 frame for the win screen, 1 frame for the loose screen and 1 frame for the intro screen.

So at the end of the game I do MovieClip(root).gotoAndStop(myFrame);

where my frame is either the win screen or the loose screen frame.both screens have a playagain button that returns me to the game frame.Sometimes I get the error after the first win/loss sometimes I get it after I do play again and then when I win/loose.

the error is at:MovieClip(root).gotoAndStop(myFrame);

Im not exactly sure why or how to fix it though any tips?

View 3 Replies

Actionscript 3 :: MovieClip In Array Displays Null, And Aren't Showing Up On Stage.addChild

Apr 26, 2010

why i keep getting Parameter child must be non-null. And my code won't display 5 enemyBlock objects onto the stage but only just one.

returns:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at flash.display::Stage/addChild()

[Code]....

View 2 Replies

Actionscript 3 :: Loading Swf As Custom Class That Extends MovieClip - Getting Null Object Reference

Aug 16, 2011

I followed the example from a previous question and I am loading an external swf using a loader and inside the loader event handler I am trying to cast the loader.content as my custom class PanelReferenceClip which extends MovieClip

When I publish I receive a this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Just to make sure and test that the swf location was correct and the swf was actually being loaded, I changed the type of the content to as MovieClip and it worked fine.

EDIT: I also wanted to add that these swfs are being stored locally and not being pulled across the internet, multiple networks or servers.

I am not sure if I did something quirky in my class so I am providing the source to my custom class PanelReferenceClip

package com.components
{
import com.UI.DevicePanel;
import flash.display.MovieClip;

[Code]....

View 3 Replies

ActionScript 3.0 :: Forum FAQ (work Topic) - My Reference Is Null - Stage Is Null

Dec 19, 2009

I have begun on a list: My reference is null!Stage is null! Convert this code from as 2 to as 3 for me! Crossdomain policies are in the way of my cool idea Dynamic property names I need to use stuff on the parent! I don't want my children to scale when I scale the parent! Classes vs instances. Mod note: I do not want this topic pinned, we will use a fresh topic once we have agreed to the content.

View 9 Replies

Flex :: MessageBroker.getMessageBroker(null) Getting Null Pointer Exception?

Jun 12, 2010

I am creating Dynamic Destinations

MessageBroker broker = MessageBroker.getMessageBroker(null);
MessageService service = (MessageService) broker.getService("message-service");
MessageDestination destination = (MessageDestination) service.createDestination("Group1");

[code].....

But I am getting Null Pointer Exception

MessageBroker broker = MessageBroker.getMessageBroker(null);

View 1 Replies

Javascript :: Flash Embed Error - 'null' Is Null Or Not An Object

Jul 18, 2010

the script i wrote is working fine. but the script attached to the flash player which i have no control over is throwing a script error (im using IE8).how can i fix this? if i run it locally there is no error.

'null' is null or not an object

try { document.getElementById("").SetReturnValue(__flash__toXML(function() { return document.location.hostname; }()) ); } catch (e) { document.getElementById("").SetReturnValue("<undefined/>"); }

but this is from flash script and i dont have control over it. it just say JScript - script block.

View 1 Replies

Flex :: Clicking On Menu So That It Shows (null,null)"?

Aug 15, 2011

I have create a menu but when clicking on menu so that it shows, I get an error on the line because of the line "myMenu.show(null,null)". See function below:

private function createAndShowmyMenu():void {
myMenu = Menu.createMenu(null, myMenuDataProvider, false);
myMenu.labelField="@label"[code]........

View 1 Replies

ActionScript 3.0 :: Remove Child = Null Before Setting It To Null?

Jul 28, 2009

sometimes I remove child and trace it afterwards and it outputs null although I havent yet set it to null, why is that? and do I need to set it to null also in that case?

Code:
trace(holderArr[loadedThumbs].getChildByName("photo_bg"));
//[object MovieClip]
holderArr[loadedThumbs].removeChild(holderArr[loadedThumbs].getChildByName("photo_bg"));

[Code]....

View 13 Replies

ActionScript 3.0 :: Null Object Error That Is Clearly NOT Null

Sep 15, 2010

I have the following piece of code(part of a much bigger program). I this code I am re-using a motion that has been previously used successfully. The trace stmts are used to identify the exact location of the error and the error conditions as best I can.[code]

View 4 Replies

Actionscript 3 :: Why Is Casting Object (null) Not Null

Mar 6, 2012

When you cast null to an object using Object(null), the result is an object.When you cast undefined to an object using Object(undefined), the result is an object.But saying null as Object or undefined as Object remains null.Why is this? I can't find anything in the documentation about this.

The objects that result from these casts can have properties set on and read from them. It's as if the cast created information, or removed whatever special information the null and undefined values have. But there's no indication in the AS3 documentation that the null and undefined special types are actually objects.

View 2 Replies

ActionScript 3.0 :: Parent Is Null, Root Is Null?

Aug 7, 2010

I created a Sponsorbar which dynamically adds sponsors according a XML script.

ActionScript Code:
for each( var imgPath2:XML in xdata.img )
 {[code]...........

View 2 Replies







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