ActionScript 3.0 :: Clear Variable From Memory?
Jul 10, 2011How do you clear a declared variable from memory?
View 1 RepliesHow do you clear a declared variable from memory?
View 1 RepliesI have a menu and each button reveals a hidden layer which includes it's submenu (another swf).The submenus have sub-submenus in the same swf.
When I take the mouse away from these layers the submenus hide again.All these work.
The problem is that when a sub-submenu is opened and then the layer hides, when it's shown again the sub-submenu is still opened.Is there a way to clear memory or unload a swf file through html or through the main menu swf?
The code below works but NOT properly. After few minutes, the flash animation slows down and also any other program that is running in the computer. I suspect that these routines flood the memory ( probably the stack memory because it uses recursion ) which then starts using slow virtual memory. There are two recursive processes initiated by two Timer types (Timer_1 and Timer_2 ) of addEventListener(). The functions that they call use a lot of.draw(0 and .clone() methods to manipulate memory-demanding bitmaps.For clarity sake I removed the lesser relevant part of the code.How to dynamically clean memory inside these routines and avoid them flooding computer's RAM memory?[code]
View 1 Repliesi have a movieClip. On it i draw a few rundedRects, when i resize the window i use graphics.clear to remove it, and then reDraw the Rects. Will this result in memory leakages? or will flash reuse the memory address as long as i draw on the same sprite?
View 1 RepliesI have a question how can I clear/free memory in flash? For example I am finishing game and I want to start from beginning and if I will just jump to the first frame all the objects there are still in this memory, is any possibility to force cleaning memory? Can I free memory for an object? for example I removeChild(something) - and I want to free memory for an object as I will reuse it? How the engine works?
View 3 RepliesI have a menu and each button reveals a hidden layer which includes it's submenu (another swf).The submenus have sub-submenus in the same swf.When I take the mouse away from these layers the submenus hide again.All these work.The problem is that when a sub-submenu is opened and then the layer hides, when it's shown again the sub-submenu is still opened.Is there a way to clear memory or unload a swf file through html or through the main menu swf?
View 2 RepliesI have searched the Adobe documentation for some insight, but apparently I am not looking in the right place. Here is a simplified code example:
[Code]...
I'm working on a game whose background has many layers that each scroll at different speeds.
Inside each layer I have a Sprite, I've started using graphics.beginBitmapFill, but what I've found is that the graphics.clear() function doesn't actually clear the contents set by the previous call to graphics.begin.BitmapFill. Each frame, I adjust the matrix to shift the layer as needed. Then, I call graphics.clear() and graphics.beginBitmapFill() with the adjusted matrix. Since my layers have alphas in the bitmap, I can see the contents that was drawn the previous frame.
I wonder what the most common reasons for memory leaks in AS3 are.First thing what I am not sure about is: is it better to have a variable reference inside a function or outside it. Will the variable be null-d automaticly inside a function or when do I have to null it and when not?I have massive problems with my game with memory leaks. I noticed I reference some of the clips of the timeline even inside my debugging clip to display propertys and this was causing collecting huge amount of memory.But even before I go into the game with bigger objects the System.memory is slowly growing and growing.I just have a socket connection and some interval loops and enter_frame events.
View 5 RepliesI 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?
1- Variable Scope : Accessibility and existence are used almost interchangeably in various documents I've read. I'd like to know if a local variable physically exists (in memory) outside of the function it was declared in, and is not accessible from other methods, or if its existence ceases outside the function.
2- Classes : When do you create an instance of a class versus importing it only, specifically in the case of classes used only as say, calculators ?
I was thinking about how to streamline my code the other day and looked through my classes checking for possible memory leaks. I wonder when are variables declared inside of methods clear for garbage collection? or are they not and just hang around? For instance if I have a class like this:
[Code]...
Since the variable was declared without reference into the class how long does it stay in Flash's memory, or does it stay indefinitely because it cannot be nullified?
I have a bit trouble with LoaderMax memory occupy, i have a queue, and i am keep loading images depend on user's action. if they click load more and it keep load, but i would like to clean the memory which been occupied by the previous queue (i have remove all the children been added by the loading previously). is there a way i can do it? the behavior like this.
[Code]...
I have an FPS monitor running and notice that I am getting choppiness here and there, bringing my game from 40 to 27 fps and back and forth at certain stages. I have an idea of where it is happening, but do not know for sure. I looked up quite a few memory monitors but haven't found anything decent yet. Is there a memory monitor that allows you to see the memory leaked and find its location? If not, how about just he memory leaked?
View 4 RepliesI'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[Code]...
doesnt clear the line when mc1 moved ? How solve tihs problem?
I'm making a calculator using Flash MX that works the same way as the basic calculator found on windows (not the scientific one). But having the user input a number, store it as a variable, store which function the user wants to perform and clear the text field then store the new input in the same text field as a different variable and multiply or add or divide or subtract the 2 numbers and getting the equals sign to display the answer when clicked is harder than I thought it would be.
View 3 RepliesI wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.
View 2 RepliesI am creating a wizard-like form. At the end, I give the users an option to start over.At this point, I want to blank out all TextInput fields in the application.I wrote some code that does the trick, but I am wondering if there is a better way?
Code:
private function clearText(obj:Object):void{
try{
[code]....
I have a project I am working on in which I would like to teach how to cash a scratch off card. I have made the scratch and made it so it will "scratch", however my masking technique seems to not be working how it should...
The idea is that the user would "scratch" the card and then hit "Next" after that it would load a new frame (Progress Bar would move) and then do what they need to on that frame, and so on.
However it would seem that Flash is keeping the users "drawing" and still allows them to draw after the first frame, which is not what I want.[code]...
this might be a very simple thing to do, buuuut... I've got two UILoaders on my stage, when you click various buttons it makes various pics appear in them, I want to put a button on my main stage that would clear the images out of the UILoaders when it was clicked, and would just leave them blank. Is this possible?
View 1 RepliesI have a similar problem where I want a text field that by default has the word NAME in it, to become empty when a user clicks on it.
The text field has the instance name 'nam' and is inside a movie with the instance name 'input_text'.
I've searched around and found samples of code where everyone keeps suggesting this:
Code:
textboxinstancename.onSetFocus = function() {
textboxinstancename.text = "";
};
[Code]....
Code:
var moo : Vector.<SomeClass> = new Vector.<SomeClass>();
moo.splice(0);
[code]......
I'm doing 3d gallery in AS3 and i have run in to huge problem. After ActionScript creates 3d sphere it doesnt go away no mater if i go forward or backwards in timeline.
View 0 RepliesAt the moment I have Clock and if I start it a message appears just above the clock saying "Timer started" and if I press the stop or reset, another message appears saying "Timer stopped" or "Timer reset", the only problem with it is that the previous message(s) are still on the screen.
I have an example attached below. I am wondering is there any way to get the textfield to refresh/remove the previous message before showing the current one?
I've got a video page with an XML based playlist all contained in one swf. I can us flash vars to load in variables to the swf to make it play a specific video (eg.[URL]), if you would like to link directly to a video.Is there a way that when i than click to play another video from within the playlist, that it would also clear the variable from the URL? Or have it update the variable (so it would switch from ?vidID=13 to ?vidID=20 for example), and do so without reloading the swf? (the swf loads with a main video page, which lists new videos etc., and than you can choose videos from the playlist)Right now, when you direct link to a video, than choose another video to watch it keeps the same video ID within the URL... which can be a problem if people just copy the URL thinking that is the correct one.
View 2 Repliesit looks like the problem is that the interval has not been clear so every time i click away from my slide show (for example navigate to my contact swf) and then come back to the slide show the pictures keep looping on top of each other and fading at the wrong times too.
var id, current;
var k = 0, p = 0;
var slide = 1;
function loadXML(loaded) {
[code]....
I have two key frames on the Stage. The first one is empty; the actual movie starts from the second frame. Under some circumstances I have to clear everything on the stage and reload the movie. I remove all the movie clips and go back to the first frame. Unfortunately, it doesnt work with components. Can somebody tell me how I can remove everything from Stage? I tried btn.destroyObject(btn._name) but it seems it doesn�t work (the object cannot remove itself). And after several times I move back to the first frame, the components go broken
View 3 RepliesI have a mp3 player in my site and i have 4 difrent albums in 4 difrent XML files..how to unload-clear XML.When i stop sound and try to load new XML it still play songs from previous XML file
View 1 Repliesf you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:
PHP Code:
<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>
and it would display "success"...or like this:
PHP Code:
<?php$foo = "haha";$$foo = "success";print $haha;?>
and it would also display "success".