Actionscript 3 :: Difference Between Primitive / Non-Primitive Objects For Memory Management?

Jul 4, 2011

my understanding is that primitive types (uint, string, Number, etc.) of a class do not need to be set to null for garbage collection.

for example, i am not required to write this dispose() method in the following class:

package
{
//Imports
import flash.display.Shape;

[Code]....

if this is true, which i believe it is, what is the difference between objects of primitive types and objects of non primitive types concerning memory allocation?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Referencing A Primitive

May 26, 2011

I wish to pass a reference to _camera.y, but _camera.y is a primitive and gets passed as a value.Here's the code for a little debugging class.

ActionScript Code:
package
{
import flash.events.Event;[code]..........

If I call watch("Cam Y", _camera.y) I get "0" traced out all the time - I assume because the y position of the camera is being passed in as a value.I want to pass it in as a reference so that this little class will keep an eye on the y position of the camera.

View 2 Replies

Possible To Tween Oval Primitive From Within Flash?

Jan 14, 2011

Is there a way to tween the oval primitive from within flash? I would like to do a tween where I move the start angle, but I can't seem to be able to tween the oval. Is this possible?

View 1 Replies

ActionScript 3.0 :: [Papervision] Plane Primitive Backside Material?

Mar 16, 2009

I've searched around the web trying to find out how to set the primitive Plane backside material in papervision. Unfortunately without luck. That is why I'm turning to you,My question is simple (as written above):How do I set the background material of a Plane primitive in Papversion 2.0?

View 1 Replies

ActionScript 3.0 :: Edit A Primitive Oval Object Thats On Stage

Dec 7, 2007

I code other languages, Javascript,PHP, XHTML, CSS etc. I hope to get into this. I was just wondering how I can edit a primitive oval object thats on the stage in actionscript.

View 7 Replies

Flash :: Clipping Due To Segmentation In Plane Primitive In Away3d

Nov 28, 2011

I have a Plane and I try tweening a MovieClipSprite on it. I run into trouble when I try to tween near the points where both segment triangles meet (I have kept both segments as 1), While moving near these points the Sprite disappears. I can tell it goes beneath the Plane because when it reappears it does so gradually and I can see it's lower half appearing as it moves away from these points. Increasing the segments obviously deteriorates the performance further as this begins to happen at other points as well. I am pasting some relevant code var planeMaterial:BitmapMaterial = new BitmapMaterial(texture.bitmapData, {smooth: true, precision: 4});

[Code]....

View 1 Replies

ActionScript 3.0 :: Keeping References To Primitive Data Types/Properties?

Oct 26, 2009

Primitive Data Types (Boolean, int, Null, Number, String, uint, and void) are treated as "values" rather than Objects, so when you pass one of them into a function, instead of passing a reference, it basically clones the information, and creates a new instance. It does the same thing when when you use "primitive1 = primitive2", and instead of passing on a reference, clones it.I thought there might be a slim possibility Flash allows me to reference primitives if I treat them as objects instead of (in this case) ints.

Code:
var num1:int = 5;
var num2:Object;

[code]......

View 6 Replies

ActionScript 3.0 :: Change Fill Color Of An Existend Rounded Rectangle Primitive?

Feb 12, 2009

Can i change the fill color of an existend rounded rectangle primitive?[code]

View 7 Replies

ActionScript 3 :: Memory Management - Adding Custom Objects To Stage

Jul 3, 2010

My AS3 application basically does the following (pseudo code from main application class) 3 or 4 times by adding custom objects to stage:

_movieClipClassVariable = new MyCustomSpriteSubclass();
_movieClipClassVariable.addEventListener(MyEvents.READY, function(event:Event):void {
_hideLoading();
mcHolder.addChild(_movieClipClassVariable);});
_movieClipClassVariable.addEventListener(MouseEvent.CLICK, myClickHandler);
private function coverClickHandler(event:Event):void {
}

What is the right way to allow Garbage Collector to recycle _movieClipClassVariable after it is not necessary? Assign null to it? Remove all listeners? Use weak reference for listeners?

View 2 Replies

ActionScript 2.0 :: Memory Management - Take Less Memory For Scrolling

Aug 2, 2007

I'm making an isometric game and I need to know which takes less memory for scrolling, making everything invisible that you can't see? Like if(!this.base.hitTest(worldHitter))this._visible = false; Or would it be better to remove the movieclips unseen and then reattach them when i should see them?

View 2 Replies

ActionScript 3.0 :: More Memory Management Headaches

Aug 29, 2008

I previously asked about some FLV files that I was loading externally, and having trouble with memory being released. Having sort of solved this, I am having the same problem with loading external resources and then getting them to be cleared out of memory when I'm done with them. I have seen kglad mention more than once that GC in flash 9.0.124.0 is broken, but where does that leave us? I have also tried my project in FP 10, and the memory still continues to go up and up. If I load an external resource - in this case I have a class that builds a VR room with papervision - and then close it, set it's instance to null, my memory never goes down.

This is a total guess, but could it have anything to do with using Tweener in my project? Is there any way that the Tweener class could be keeping some of my objects in memory and keep them from being GC'd? I am using weak references in my listeners, setting any variable I can find to null... I can get over how frustrating this is to just see memory go up and up but find no reason. The class I am using also uses a few subclasses to build itself, but I end up with one instance of my VR on the stage. If I have set that instance to a name - myVR - and then removeChild(myVR) from the stage and set the name to null - that should do it right? Boy, this is frustrating.

View 3 Replies

ActionScript 3.0 :: Memory Management / Garbage Collection?

Nov 7, 2008

I have done a lot of searching / reading to find out how to clear my memory. But I still can't really work out how to clear the memory, it just never seems to come down. I have a few MovieClips that contain other MovieClips with pngs inside them being added to the stage.

As fare as I can tell all Event listeners are removed and refrences I remove the clip, with removeChild I "null" the variable I am using the "LocalConnection()" hack to try and force a clean up, but no movement on the memory count. Are there any examples of a *.png being added and removed from the memory?

View 7 Replies

Flex - Degrafa States Memory Management?

Nov 10, 2009

I was recently profiling my application that uses Degrafa States in the skins and noticed that doing so uses more memory than I expected. Between the SetProperty and State, they were using about 10% of the total used application memory.

Would it be better to use css for the state changes and a new skin for each state? or Are there some simple tips to reducing the memory footprint of degrafa?

View 1 Replies

Memory Management - Make Flash 'play Well With Others'?

Apr 21, 2010

the Flash Virtual Machine relies on garbage collection by using reference counting and mark and sweep (for good coverage of these topics, check out Grant Skinner's article and presentation). And yes, Flash also provides the "delete" operator, which can (unfortunately only) be used to remove the properties of dynamic objects.

What I want to know is how to make it so that Flash programs don't continue to consume CPU and memory while running in the background (save loading content or communicating remotely, for example). The motivation for this question comes in part from Apple's ban on cross compiled applications (in its SDK 4) on the grounds that they do not behave as predicted with the multitasking feature central to iPhone OS 4. My intention is not only to make Flash programs that will 'pass muster' as far as multitasking in iPhone OS 4, but also to simply make better (behaving) Flash programs.

Put another way, how might a Flash application mimic the multitasking feature of iPhone OS 4? Does the Flash API provide the means for a developer to put their applications to 'sleep' while other programs run, and then to 'awaken' them just as quickly?

In our own program, we might do something as crude as detecting when the user has been idle (no mouse motion or key press) for (say) four seconds:

var idle_id:uint = setInterval(4000, pause_program);
var current_movie_clip:MovieClip;
var current_frame:uint;

[code]....

what's the best way to detect that an application should be shelved? And, more importantly, is it possible for Flash Player to detect that some of its running programs are idle, and to similarly shelve them until the user performs an action to resume them?

View 2 Replies

Flash - Memory Management In Flex Programs?

Nov 24, 2011

I am a flex programmer but i had nothing to do for handle manage memory in my projects. I think lack of memory management is reason for loading lag of swf file. Can any one help me to how to handle manage memory in flex/ as3 codes.

View 1 Replies

ActionScript 3.0 :: Memory Management With An Object Pool

Sep 8, 2009

I've been trying to figure out how Flash does its memory management regarding object declarations but haven't found anything that describes declarations themselves. [code]Basically I want a pool of declared variables that get instantiated only when a certain type is set. I'd have logic in other functions that figures out what the type is and then does certain things to it, but for now I just wanted to know what kind of memory management Flash does with something like this. Does it do nothing until I actually instantiate it (= new Object()) or will space be set aside once I simply declare it (someObj:Object)?

View 2 Replies

ActionScript 3.0 :: Memory Management And Garbage Collection?

Jul 19, 2010

In AS3, after I've removed a display object container B  from another display object container A and deleted all the references to B in A, does that mean that all memories previously held in B will all be released too or do I have to manually delete all the references to objects in B before I can delete B in A in order to free all the memory space held?One more question. I was kind of confused of when to use the delete statement and when to set a variable to null.

View 1 Replies

ActionScript 3.0 :: Loader Instances And Memory Management?

Aug 18, 2009

Hi guys, I'm wondering whether any of you have any opinions on whether you instantiate a Loader into an instance variable, or whether you declare a local variable to hold the Loader object.

I'm coming at this from a memory management / garbage collection perspective.

I only need the Loader object to load the file and register the event listeners. So I don't really want an object-wide instance variable to hold this loader object (which is what Adobe does in most of their examples), since I can always access the loader.data through the event's target property.

[Code]...

View 2 Replies

Actionscript 3 :: Memory Management When Instantiating Extended Classes?

May 16, 2010

I'm developing an AS3 application which has some memory leaks I can't find, so I'd like to ask some newbie questions about memory management.Imagine I have a class named BaseClass, and some classes that extend this one, such as ClassA, ClassB, etc.I declare a variable:

myBaseClass:BaseClass = new ClassA();

After a while, I use it to instantiate a new object:

myBaseClass = new ClassB(); some time after

myBaseClass = new ClassC();

and the same thing keeps happening every x millis, triggered by a timer.Is there any memory problem here? Are the unused instances correctly deleted by the garbage collector?

View 2 Replies

Flash :: Actionscript Memory Management - Garbage Collection

May 4, 2011

This blog (and others) state that you should set object references to null inside your dispose() methods when cleaning up objects. However, Actionscript 3 (with Flash Player 9) uses mark and sweep to clear out circular references for you. So I am wondering: is there really any reason to null out your object references?

View 2 Replies

ActionScript 3.0 :: Memory Management - Creating Instance Variable For Class

Nov 7, 2011

I have a question regarding AS3 memory management. Supposing I created an instance variable for a Class, in this case or type Sound:
public class SoundStore extends Sprite{
var s:Sound;
Then within various class functions I referenced this variable multiple times, each time I wanted to load in a new sound:
s = new Sound();
Am I correct in thinking that each time I created a new Sound I would be overwriting the previous allocated memory?

View 1 Replies

IDE :: Oval / Rectangle Tool And Oval / Rectangle Primitive Tool

Nov 14, 2010

I do know how to use the oval / rectangle and oval / rectangle primitive tools in the tool bar and find them quite useful, but one thing I find confusing is. A oval / rectangle primitive object can be edited later but the oval / rectangle can't. So the point is,how do we use them properly ? when to use ? Why does Adobe Flash still keep the oval / rectangle tool in their product instead of removing them with the oval / rectangle primitive tool ?

View 2 Replies

Actionscript :: Memory Difference Between Arraycollection And Dictionary In Flex

Aug 16, 2011

To optimize my application dictionary is a better option or arraycollection where both satisfy my needs.

View 1 Replies

ActionScript 3.0 :: Does Setting An Array Of Objects To Null Erase The Objects From Memory

Apr 27, 2010

I have an array of temporary objects created in a for loop. The objects are of type class "Tile", a class I created. However, it appears that whenever I create a lot of tiles in the for loop, the program slows down indefinitely.

While the array is whiped at a later trigger point, I am thinking that perhaps these Tile objects are not being erased from memory. They are being created on the fly in a for loop, and the array is being reset to "array = []".

Are the objects still in memory or are they cleaned up when the array is set to []?

View 3 Replies

ActionScript 3.0 :: Difference Between Two Objects?

Oct 7, 2010

I have two similar Objects. I want to compare them to determine if they are different data-wise (see below), and if so, display what the difference is. To complicate things, let's say the Objects are totally anonymous - I have no knowledge of their structure, contents, cannot attach listeners, etc.Comparision turned out to be easy: I'm using the classic "Serialization" approach, which comes from Java:

ActionScript Code:
public function compareObject(obj1:Object,obj2:Object):Boolean {
// serialize the objects
var buffer1:ByteArray = new ByteArray();

[code]...


If the data in the objects is in any way different, the routine returns false... classic Byte-compare. Easy, fast, very efficient.Now here's my question: is there an easy way to determine WHAT the difference is? I'm thinking along the lines of some kind of change object or XML structure that says "This field changed value, that array got this item added, this property was removed, etc".I started playing with complex looping structure and iterators until someone pointed that some object fields/properties cannot be found via iteration.

View 2 Replies

Difference Between Flash And Flex Objects?

Jan 18, 2012

Possible Duplicate: What is Adobe Flex? Is it just Flash II?tell me in layman's term as to whats the difference between flex and flash objects. i know that programmatically there are differences and there are difference in the extension but then why do some flex programs have a .swf extension since the extension for flex is swc ?

View 1 Replies

Actionscript :: Calculate The Difference Between Two Date Objects, In Months?

Feb 16, 2011

I have to validate that 1) the end Date is not less than the start Date and 2) the difference between the two UTC Dates is not more than 12 months. To do this, I need a monthDifference function:

public static function monthDifference(start:Date, end:Date):int;

Since partial months can be confusing, this is how month differences are supposed to work:

The month difference between January 1, 2010 and January 31, 2010 is zero (0).

The month difference between January 31, 2010 and February 1, 2010 is one (1).

The month difference between January 1, 2010 and February 28, 2010 is one (1).

The month difference between January 1, 2010 and March 1, 2010 is two (2).

How can I calculate month difference in ActionScript 3.0?

View 2 Replies

ActionScript 3.0 :: Remove Objects From Memory?

Feb 10, 2010

I have a class "Ball" which display graphical circle ball in random x&y axis and Ifade out it with Event.ENTER_FRAME and specify removeEventListener if it reach alpha<=0 .Now I made multiple object from "Ball" class. Now, In my stage it works nice but when I see my Computer Memory status. my current flash.exe is increasing memory rapidly. Is how to remove my unusual object from my Memory. So that it would not get hang.

View 2 Replies

ActionScript 3.0 :: Memory Used By Individual Objects?

Dec 14, 2010

Is there a way to find out how much memory a single object is used?

View 3 Replies

Actionscript 3 :: Remove Simple Objects From Memory?

Sep 9, 2010

I'm trying to remove simple objects from memory, but when I call removeChildren memory usage rose :/ And I don't why ? And how can I remove objects ?

[Code]...

View 2 Replies







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