ActionScript 2.0 :: Deleting A MC From Inside Itself
Nov 26, 2004I 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]....
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]....
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.
I am trying to make a simple game where there are five balls that bounce around the screen and speed up at set intervals. You have to dodge them for as long as possible. Right now I have the game set up so that you dodge for 15 seconds and you win - but I can't delete the balls that are bouncing around, and I don't know how to put in a reset button. I have also tried increasing the variable this.speed inside my interval statements but it doesn't work.
View 3 RepliesI'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?
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 RepliesI have this XML structure:
<numb>
<variable>
<name>john</name>
[code].....
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?
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?
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 RepliesWhats 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 RepliesI'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 RepliesActionscript 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?
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 Repliesfunction 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,
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].....
Is it possible to write some code that would search to see if a NetConnection and a NetStream object exists in the scene, and if so to delete them (or *.close(); or whatever)? I would like to be able to 'see' (with traces) these 'non-visible' sorts of objects to have a better handle on when/how/where these things are created .The same goes for all of these *.addEventListener's that I keep creating all over the place in AS3.Is there a way to step through all these 'hidden' objects in a scene and get some sort of status on them?
View 7 RepliesI'm having a problem where I load my SWF (Advertisement) into the dom after an event happens in a flash game. After viewing the ad, the SWF is removed with JavaScript and users continues to play, this continues several times without ever reloading the page.
The problem I am running into is in IE 8 & 9 performance of the game drops and frame rate becomes choppy after several ads are shown. Each advertisment has a timer built in and my thought is that the ad is not being fully removed from memory hence causing a slowdown.
Is there a way to ensure a full removal of the ad or at least a way to detect within the ad that it is no longer on the page & kill the timer?
I think I discovered a bug. Say this is a line with anchor points:
x---x---x---x---x---x---x
And this is what I want to achieve using the Delete Anchor Point Tool:
x-----------x-----------x
Then this is as far as I'm actually able to get:
x-------x---x-----------x
Because for some reason, if I delete the 2nd anchor point, the 3rd will be deleted too. I can, however, delete the 3rd without deleting the 2nd.
It is only after I've moved the 3rd further away that I'm able to delete the 2nd, but this gets tiring after a while.
I have button that adds text to a movie, and u can resise it and change the color and stuff like that, the txt comes in as a movie clip,but i want it so the user can also delete the text. what script do i apply to a button to delete the movie clip?
View 2 Repliesvar my_arr:Array =['das',2,jack',4,5];i need to delete the element by refering thier index number.
View 3 RepliesWhy doesn't this code work?
Code:
onClipEvent (enterFrame) {
this._x = this._x+20;
if (this._x>300) {
[code]....
I have an XML file which consists of x/y coordinates...from this I draw shapes in a movieclip on stage when the user chooses(from list component) an xml to load...how do I clear the contents of the mc so that when the user chooses another xml file from the list component the new xml is drawn in the now emptied mc from before??...
View 1 RepliesI have a main swf which I am loading other swf's in to using a container. On each of the swf's I am loading I have an unload button which I placed the actionscript below on. The swf unloads fine, but it seems to be unloading the container as well. After I unload one video the others will not load. I don't know if it is because the unload button is on the swf being loaded and is not on the main swf or what. Is there anything I can put in this to make it unload the external swf and not the container on the main swf?
Code:
on (press){
this.onEnterFrame = function(){
if(this._alpha > 0){
this._alpha -= 8;
[code]....
im making a game and it has enemies randomly spawning at the top of the screen going down to the bottom, so far it all works fine, except for when i try to remove them when they reach the bottom of the screen I get this error
Code:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at spaceavoider/deleteenemy()[/Users/bobbymoranville/Desktop/space
[Code]....
not elements in arrays but arrays themselves;
I am generating lots of arrays in a for loop again and again.It it possible to delete these subArrays from the mainArray so that they dont exist any more?
Code:
var mainArray:Array = new Array();
for (var i:int = 0; i< columns; i++) {
var subArray:Array = new Array();[code]....
I forgot to write:I am pushing movieClips into these subArray in this same for loop and later on, I am removing these movieClips from subArrays, but these subArrays (after being cleaned) still remain in mainArray, dont they?
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].....
Only been working with flash/as3 for about 2 months now so I'm still a little green but in a nutshell, I make interactive Flash presentations, aimed at educators as a tool to make their teaching seem a bit more interactive with their pupils, and we are in the process of developing a tool that will allow our users to create their own flash presentations similar to the ones that we provide for them.One of the features I have is the ability to delete something off the screen which they may have added accidentally or no longer want on the screen. This is done by simulating something similar to the recycle bin.
They can click and drag items onto the recycle bin and it removes them from the stage, however as you might know, the movie clip for that item is still in memory, so when the presentation is exported (it exports as an xml file) the "deleted" movie clip is still there.When exporting the presentation, the xml elements are generated by looking at the children of the container movie clip for different types of movie clips(static images, images with rollover effect, animations).I know the problem with that, and according to another post I must set the movie clip to null in order to get around this. But here's my problem:I have a click listener on the stage objects - which enables the drag and drop, when dropped, the listener calls a function to check if the movie clip has been dropped in the bin, and passes the mouse event onto the function.
Code:
function checkHitArea(evt:Event)
{
[code].....
is there a way to delete from the middle of an array?like if i wanted to take bananas off grocery
PHP Code:
grocery = ["apples", "peach", "bananas", "mangos", "pears", "tomatoes]
Basically I have a few functions to check to see how many lines of text the user types into a text box.If the text exceeds 1 line I make the text box red, once they click in the text box again to shorten their input I change it back to white.So I'm using the following code
Code:
// nick name
if(temp_pref_name_height > maxHeight){
[code]....
I'm making a very short text adventure, not one that will be all that fun, but just so I can learn a little as3. So I was designing a system that splits the persons input into an array of words, and then goes through and takes out unimportant words like "on." To test this out, I quickly (and messily) coded it up, and the only thing you can do is sit on a box. but it doesn't seem to be working. if you type "sit box" it works, but "sit on box" does not.
[Code]...