Actionscript 3 :: In Flash Does Extending An Object Use More Memory Even If The Object's Methods Aren't Used
Jul 20, 2011
I am creating an object pool to cache some recyclable objects in memory at the outset of my application in order to avoid (as much as possible) the performance issues caused by GC running; if possible I'd like to minimize the memory my object pool reserves, so I'm attempting to pool generic forms of the objects (with no methods) and then casting the generic variants to more specific and complex object types which extend the generic form when I actually want them on the stage.
The trouble is that to do this requires the generic variant class to import/extend MovieClip (because the more complicated objects are themselves MovieClips and make use of DisplayObject methods)-- does simply importing and/or extending a class add to the memory an object takes up when instantiated even if it never uses methods from the inherited class? It makes sense that it would, and some light profiling seems to suggest that it does, but I'm not 100% certain. About how large should an 'empty' MovieClip instance be in bytes?
View 1 Replies
Similar Posts:
Nov 17, 2010
This has been a long-standing curiosity of mine, and I haven't gotten around to profiling to find out, and haven't seen it asked yet (for AS3):Let's say that I have a class:
class MyClass {
public function myMethod():String {
return "some return value";
[code]....
View 1 Replies
Nov 17, 2011
So I am writing a program which uses Dictionary to store objects. For example
var dictionary:Dictionary=new Dictionary();
var myObject = new myObject(var1, var2, var3);
dicionary["key"]=myObject;
where var1, var2, and var3 are simply means of assigning values to variables in myObject.can I access values or functions that are found in myObject? In myObject class I have some getters and setters. Can I use a getter to get the value of var1 for example.
dictionary["keys"].getVar1()?
View 1 Replies
Dec 7, 2009
I have a class file named Main.as and another class called icon.as
package {
import icon;
public class main {
public var _time:String;
function main() {
[Code] .....
How do I get the current update from the main class without calling the MainObj repeatedly. Is this possible in Flash AS3, or any other alternate method for this idea.
View 2 Replies
Jan 12, 2010
This might be a dumb question. I think I already know the answer, just clarify. If you declare a object in varible1 and then pass the value into varible2. If you decide to null varible2 would that kill just the reference or the object itself as well. I want to say no, but then again, everything you do to the reference it self, also affects the space in memory.these are the 2 varibles in my class.
private var objects:Array;
private var viewableObjects:Array;
above are class varibles. Later on in my code I add an object to the objects arrayobjects[0][4] = new Enemy1();When i trace i get the following[object Enemy1]I then add it to viewable objects arrayviewableObjects.push(objects[0])
View 2 Replies
Oct 18, 2010
If an asset (say an swf) is already loaded. Does it increase memory use to add and object to the display list?
View 4 Replies
Mar 9, 2010
I've recently come to a roadblock in my code for a non-visual class I created; a sound class if you want to know. At first I coded with it extending Sprite (I can't remember why I started it out that way, but that's the way it was). When I came back to this code, I thought that extending sprite doesn't make any sense if it's an audio class and non-visual, where is no real reason to add something to the stage if you can't see it. So I removed "extends Sprite" from the class and errors started popping up around "dispatchEvent" coded areas. I then tried putting back the extention with "extends Object", hoping that would solve the problem; got the same thing. I've searched with google on why I can't use dispatchEvent on objects or classes not extending anything, but it only came up with how to use dispatchEvent with the usual MovieClip or Sprite tutorial.
View 3 Replies
Dec 29, 2010
extending Object on a custom class that would normally be unextended?
package qnx.notificationManager
{
public class Notification extends Object
{
View 1 Replies
Mar 22, 2010
I'm recording and playing back mic input using Flash Media Server, and even though it's just audio, we're saving the output as FLV. I'd like to get a waveform of the recorded audio. Ideally, since we already have a lot of saved/recorded audio, I'd like something that can take a loaded FLV and get the waveform, as opposed to generating it at record or playback time.
AS3 has the new Sound.extract() method that can be used for this (plenty of online tutorials), but it seems like it only works for MP3. Is there a way to use this method on FLV audio? Or is there another to extract a waveform from a FLV?
View 1 Replies
Sep 30, 2010
How do I get the list of all methods from an object? I know I can get the object class in this way:
var className:String = flash.utils.getQualifiedClassName( myObject );
var objClass:Class = flash.utils.getDefinitionByName( className ) as Class;
In JavaScript I can iterate over the prototype of an object to get its properties and methods. Is that possible in ActionScript 3? Do you any good source for metaprogramming/reflection over ActionScript 3?
View 2 Replies
Aug 18, 2011
my understanding of extending classes is that you gain all the functions and methods of that class thus You could over ride any one of them. How ever I am confused on weather or not you inherit and can over ride private methods of the class you are extending or if you have to have all methods public in an extended class.
[Code]....
View 2 Replies
Oct 27, 2010
-I know one can call javascript functions from as3 using ExternalInterface, but in all the examples I've seen the function has been a standalone function on the page. Can methods on objects (that are on the page) be called. E.g: obj.someFunc() rather than just someFunc()?
-The return value can be stored as well using ExternalInterfaces. Can this return value be a javascript object? If so, its methods be called from it directly?
View 6 Replies
Mar 9, 2009
I'm having problems with my usual eval methods of creating objects to read off dynamic values programmatically using concatenation. I've found the set command doesn't seem to work with objects that are dynamic....
Code:
function createobject(item){
//create it and store something in it
set ("_root.item"+item.stored, "data storage test for item "+item);
}function checkobjects(){
for (i=1;i<5;i++){
checkit=eval("_root.item"+i);
trace("_root.item"+i+".stored="+checkit);
[Code] .....
Running this produces the output of...
Code:
_root.item1.stored=undefined
_root.item2.stored=undefined
_root.item3.stored=undefined
_root.item4.stored=undefined
How to do this - basically I'm trying to load data, then use that to create dynamic objects and values within it, then I'm trying to work with those values by again using loops to read off the dynamic values during runtime. Obviously if these were "fixed" variables, then it would be easy, problem is that its impossible to use the new Object() command with dynamic names!
Previously I've used this:
Code:
checkit=eval("_root.item"+i+".stored);
trace("value is "+checkit);
Is it my imagination, or was this stuff a lot easier to do in AS1?
View 2 Replies
Jan 28, 2011
I am still very new to Actionscript and have an okay working knowledge of Flex. I am working on an AIR application that runs a SQLite database underneath. The database is only 3 tables (projects, items and types). I was wondering if Actionscript best practices are to use a data access object or layer to store all of my database functions or to just run them inline as needed. I would assume an access layer would be best for interacting with the database for usability, but I can't seem to find much documentation for SQLite in AIR.
View 1 Replies
Jun 18, 2009
My situation like this:IHost.as:
Code:
public interface IHost {
function doSomething() : void;
[code]....
View 2 Replies
Jan 9, 2012
Let's say I have a defined ClassA. ClassB extends ClassA and there's a Movie Clip instance on the stage linked to ClassB. How would ClassC access the properties and methods of ClassB without extending ClassB or creating a new instance of ClassB? The way I'm currently doing it is by referencing the stage instance linked to ClassB and then using the dot syntax to access ClassB instance variables, and this works only if the the accessed variables are public or internal, depending on what package ClassC is part of. I would like to know if there's a better, cleaner way to accomplish this.
[Code]....
View 2 Replies
Jun 18, 2011
Maybe i didn't get the real meaning of the ArrayCollection, but first of all some code
[Code]...
View 1 Replies
Jan 12, 2006
Been doing some actionscript magic lately, done a nice interpolator class. The class, whenever an update occurs, calls a previously specified callback function. Normally, setting a variable of funCallback:Function and calling it works fine. However when I wanted to specify an *object's method* as the callback for the interpolator, it apparently called it as if it would be a static method.
And it isn't.What I need to do, simply speaking, is to be able to call an object's public method, having just th object's reference and function name, just like the second variant of setInterval does ( the one having "object, string" as the first two params, not "function").
View 12 Replies
Oct 11, 2009
what I have is:
- listener added with weak refference, therefore it shouldn't keep the GC away
- object set to null
- trace of the object m shows null
- debugger shows the value of m as null
But the "frame" trace still keeps on appearing, so where exactly is that object and how to check for it, how to delete it and kill it. I know that listeners keep objects in the memory, but then how to find them, and at the end of the day also used weakReference=true while assigning it, so that should take care of it. What exactly is going on here?
View 2 Replies
Dec 18, 2008
When debugging, I see an objects memory reference next to its value. Is it possible to get that as a string or assign a variable based off memory location?
var myInt:int = 5; debugger shows(@afff222)
var copy:int = memor(@afff222);
View 2 Replies
Aug 5, 2011
I have this line
Code:
this.parent.removeChild(this);
So basicaly the object is removing it self from the parent object,but I still think that it exisits in memory and doing its backend job.How can I remove it completely from memory?
View 8 Replies
Sep 3, 2009
Load external SWF file, an error: TypeError: Error #1009: Null object reference can not access the properties or methods.
View 0 Replies
Jun 9, 2010
I am getting problem of memory of having repeating object. Below is my code.
import flash.system.System;
var counter:Number=0;
var systemMemory:TextField=new TextField();
systemMemory.x=200;
stage.addEventListener(Event.ENTER_FRAME,showNext);
function showNext(event:Event){
[Code] .....
Above code does repeat textField Object continuously. Now I want to destroy previous created textField Object. So that my memory will not be hang. I got some where in the blog that with System.gc() could clear garbage collection. But currently I am not working with system.gc any more I want to clear previous object in programatically way. Is there any way that I could destroy previous created object?
View 2 Replies
Jan 15, 2010
There are a number of posts on here about merging XML with Java, but I can't seem to find any reference to Actionscript for the same task. I have a group of XML files that I need to load. I want them to sort into one XML Object in memory. For example, let's say these were my XML files:
[Code]...
View 1 Replies
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
Mar 26, 2004
Is it possible to delete a LoadVars object from memory, as well as its contents? Say I load 20k of data into a LoadVars, and I delete the LoadVars Object, does it stop loading variables into memory, and does it delete the memory that it importing?
View 1 Replies
Mar 26, 2004
Is it possible to delete a LoadVars object from memory, as well as its contents? Say I load 20k of data into a LoadVars, and I delete the LoadVars Object, does it stop loading variables into memory, and does it delete the memory that it importing?
View 1 Replies
Feb 20, 2010
How to write an AS3 object's memory location for example to a label?
View 3 Replies
Nov 12, 2010
Can i load an in memory XML, returned by a linq to SQL query, to an SWF object? And here comes the long version. The purpose is loading an in-memory XML file, to an SWFobject via a querystring.
Currently i read and load the XML file from an absolute path.
[Code]...
View 1 Replies
Apr 1, 2011
If my class has declared a private var _iDontGetDefined:EnormousObject; but never creates anything to be stored there, does this impact performance or use a significant amount of memory?
View 1 Replies