ActionScript 3.0 :: Ref Counts And Instance Deleting Itself?
Jan 13, 2010
I understand the basics of reference counting but I am having trouble getting my head around one possibility. What happens while a class function/method is running - suppose the class instance removes the last reference to itself while executing - how does that get dealt with internally and is it dangerous? Perhaps while a class' function is running a temporary extra reference is held or else the garbage collector is otherwise not allowed to delete it.
e.g.
class Something
{
function DoSomething
[Code].....
View 2 Replies
Similar Posts:
May 10, 2010
Basically I have an array map and I want to be able to create a little bit of code that counts how many there are of each number in the map:
[Code]....
Currently there are 3 number 5s but this will change and I want to create a bit of code that can change with them amount of 5s in each map. Unfortunately I have no idea where to start, can anyone give me a hand?
View 9 Replies
Oct 4, 2002
All variables start offset by 1 (a=1, b+2, c+3, etc..)I want the values to all start over when they reach 7.You can see the lower half of code displays these images, basically rotating around a circle.What is most efficient way to script? I assume an array.
a += 1; if (a==7) {a=1};
b += 1; if (b==7) {b=1};
c += 1; if (c==7) {c=1};
[code]....
View 14 Replies
Dec 21, 2006
I know that
Code:
for (var i = 0; i<5; i++)
will loop through some script adding 1 to i until i equals 5
[code].....
View 1 Replies
Nov 9, 2009
I need some help understanding for loop and timers and what I want to do is set the timer so it counts. Every 3 seconds add 1 to the count and then call a function. If the count reaches 3 then reset every thing and start over. But it isn't working the way I want it too.
Code:
//create timer for slide show
var delay:uint = 3000;
var myTimer:Timer = new Timer(delay);
[code]....
View 4 Replies
Oct 24, 2011
Ok I want to make a button that changes a text to count 21+ so lets say we have our button
Code:
button.onRelease = function()
{
[code].....
View 1 Replies
Dec 18, 2009
all my loading functions I got from a book and some other stuff too -- is it ok to use someone elses loading function.
View 2 Replies
Mar 25, 2005
I have this code for my timer, it counts down alright. BUT it is very buggy it most commonly counts down by 2 when it is meant to count down by one I have even watched my brother play our game and it went fron 20 to 7
Code:
var cur_timer = 180;function timer()
{
if (cur_timer > 0)[code]....
View 9 Replies
Oct 30, 2005
Is there a script that counts how many time a projector has been open?I'm looking to make a demo projector that can only open a project 1, 2 or 3 times.
View 1 Replies
Oct 14, 2010
in AS2 I used to use this kind of code to get certain items in a movie clip :
PHP Code:
for (var sItem in this) { // do something with this[sItem]}
How do I do similar things in AS3? I mean, how can I access this[sItem] in AS3?
View 4 Replies
Jan 28, 2010
Does anyone know how to create a numeric display that counts down the time of a flv. For example if the time of the clip is 60, as soon as the clip starts to play it counts down 59 and so on.
View 1 Replies
May 14, 2003
timer = int(80-(getTimer()-/:starttime)/1000);
if (Number(timer) == 0) {
with (_root) {
gotoAndPlay(70);
}
timer = 0;
}
Above is my code on a frame in a movie clip. The movie clip contains a dynamic text box that counts down. The variable name and the name of the clip is timer. when the timer reaches 0 it is supposed to go frame 70 which says sorry you did not make it, instead it goes to the frame that says congratulations... What am I doing wrong?
View 1 Replies
Nov 24, 2011
-Firstly can some one please explain what is meant by Object and Function in a profiling environment.
-Secondly, why does the Object and Function count increase when I repeatedly set the text property of a textfield:[code]
View 2 Replies
Sep 27, 2010
I need to make a ticker counter that starts from 0 - 0 rand and counts up for this portion of dialogue.
a commission of between R6,000 and R12,000 per month,
again depending on the amount of each person's
purchases.
200 customers gives you R15,000 to R30,000.
And 600 customers gives you a return of R50,000 to
R100,000. Per month.
View 1 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Jun 10, 2010
When i use time varaible and then minus the time. Ive noticed that flash does not count down in seconds, but the speed of light. My maths are not very strong so how can i get flash to count in seconds
var time =60;
sprite.onEnterframe = function(){
time -=1; ( this counts faster than seconds)
}
View 5 Replies
Jan 3, 2011
I'm trying to figure out if this is possible?lets say I'm trying to remove the value "3"
Code: Select allvar myArray:Array = new Array("1","2","3","4","5");
myArray.pop(); // removes the last value "5"
myArray.shift(); // removes the first value "1"
How do you remove the value 3 and still have the correct lenght?
View 7 Replies
Jul 24, 2009
i have an image and it is a large sheet with series of poses for a character (like a sprite sheet), and wanted to take them out to be animated and make them into individual movie clips.I did successfully, but I went to delete the original image, however, the movie clips became red fills.Is there a way I can get rid of the original without affecting the movie clip?-If not-I wanted to do this because I thought it may save memory but i am not really sure if it will affect the memory since the sheet itself is not going on the stage, is there a chance that this full sprite sheet in the library won't effect the file size of .swf?And if it does, if I turn it into a graphic, or movie clip, will that compress it?I use Flash CS3!
View 3 Replies
May 24, 2011
I have this XML structure:
<numb>
<variable>
<name>john</name>
[code].....
View 1 Replies
Aug 20, 2010
i was trying to delete a row on a datagrid. basically, i click on the row, then i click a button so that the chosen/clicked row is deleted. here is my code snipet :
Code:
public function deleteRow(event:MouseEvent):void{
selecto0.removeItemAt(dGrid.selectedIndex);
selecto0.refresh();
[Code].....
even though that row exist, i guess the index is not recognised. what do i do?
View 2 Replies
Mar 12, 2012
I can of course use removeMovieClip but I heard there was a more simple solution - attaching all of the MC's to another MC, and then deleting this MC would also delete all attached MC's. I saw some examples (starting with createEmptyMovieClip but I guess I'm having some problems with syntax.
ActionScript Code:
createEmptyMovieClip("movie1", this.getNextHighestDepth());
movie1.attachMovie("whatever", "movie2", this.getNextHighestDepth();
movie1.attachMovie("whatever", "movie3", this.getNextHighestDepth();
...
This code does not work...What I'd like is to remove movie1 so that it would delete all the others. Can it work?
View 5 Replies
Nov 26, 2004
I have a question which probably isent to difficult.. im making a game in which there are some mines which chase a ship... these mines are created with
[Code]....
View 3 Replies
Feb 23, 2003
Is there a way to delete a specific value in an array? For example, the array:"Banana Peel,Hippopotamus Leg,Computer Wire,Keyboard"Would there be any way to delete just "Computer Wire" from the array? I found the Array.splice thingy, but it seems that you need to know the index of the thing. Therefore i guess my question is: Is there any way to find the index of a particular value.In the thing I am making, the value could be at any index in the array (it is put in place by the user), so I could not just say Array.splice(2,1,)
View 14 Replies
May 25, 2005
Whats the AS for deleting a MC? I have a dragable box and I want to create a button to close it...but dont know what the action script is to delete the MC...do i need to use removeMC?
View 3 Replies
Nov 26, 2004
im making a game in which there are some mines which chase a ship... these mines are created with
Code:
dot.duplicateMovieClip("dot"+currdot, this.getNextHighestDepth(), {_x:-100, _y:-20});
currdot=currdot+1
inside the dot MC there is a video , it blinks and roatates and stuff when its just floaring around , and when it hits something
Code:
if(this.hitTest(_root.ufo)){
_root.shieldCurr=_root.shieldCurr-_root.dotDamadge;
trace("hit"+this);
this.gotoAndPlay(73);
}
gotoAndPlay(73);
refers to the 1st frame of the explode animation inside the MC frame 1 to 72 is a looping animation now after it plays the exploding animation , i want it to be deleted ive tried a few different things like...
Code:
_parent.removeMovieClip(this);
which dont seem to be working. So id like to remove the movie clip from inside itself.
View 3 Replies
Oct 11, 2009
I'm using Flash CS4 and I have to trim a .fla file down. I can delete the end frames no problem, but the first 600 frames that I have to remove are proving to be a nightmare. When I use the select>right-click>delete method it doesn't remove these frames, instead it removes the corresponding amount of frames from the end.
View 2 Replies
Mar 12, 2010
Actionscript Code:
var gameObjectArray:Array = new Array();var gameTimer:Timer = new Timer(25);gameTimer.addEventListener(TimerEvent.TIMER, gameLoop);gameTimer.start();
[code].....
So every 25 milliseconds, a block is being created and it pushed into an array. The for loop cycles through the array and moves the x by 1 for each object in the array. If the x reaches past 300 pixels, then I want to delete the object from the game entirely. The way I'm doing it now yields an error, so what am I doing wrong and what should it look like inside of the "if (i.x > 300)" stuff?
View 6 Replies
May 8, 2010
I found what I am looking for when I list all variables. I want to cut out the rest of the menus that create a fan of pages.I removed the SWF's from showing up. But I am still having issues with changing the nMenus = "14" which is the number of menus to show. I want to change the "14" to "9" so there are no spacing in between my 3D Pages.
View 1 Replies
Aug 1, 2010
function countdown(){
timer--;
if(timer==0){[code]....
okay so there is my timer above, the timer counts down and everything else works exept for deleting the function at the end of the level, at the end of the level the script goes to another frame to show you have passed the level and then goes back to the previous frame to play the next level, all the new objects are made but the timer then counts double so its like the timer is running twice at a time so instead of counting down 1 everysecond it counts down 1 every half second, i have tried delete countdown();.i dont know how you actually make this work or how to go about it,
View 1 Replies
Aug 26, 2010
I need to load and unload thumb buttons with images loaded in them. I load an xml, create the clips, then load the images into the clips.
When I remove the clips, I need to unload the loaders first?
Can I store references of the loaders in an array and use the array to unload them?
How should I delete the clips? removeChildAt()? Or use an array?
Here's relevant code:
Code:
function createScrubThumbs():void {
for(var i:Number=0;i<thumbsXml.thumb.length();i++){
var picHolder:ScrubThumb = new ScrubThumb;
[Code].....
View 5 Replies