Trying To Delete Movieclip
So i'm creating an alert box, with an [x] to close it. basically the X is a movieclip with a MouseEvent that tries to do
ActionScript Code: function btnClose_Clicked(e:MouseEvent) { parent.removeChild(this);this.parent.removeChild(this);//neither worktrace('btnClose_Clicked'); }
so the above is getting set in the timeline, first frame ,actions layer like this;
ActionScript Code: var alertBox1:alertBox = new alertBox("hey",true);addChild(alertBox1);
anyways, when i click the x i get the following -
TypeError: Error #1034: Type Coercion failed: cannot convert global@2a451101 to flash.display.DisplayObject. at MethodInfo-670()
So basically the question is, how does a sprite/movieclip delete itself from the parent?
Any help greatly appreciated!
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 05-09-2008, 10:13 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Delete Movieclip?
How do I use actionscript to delete a movie clip after a collision? Basically I am making a game where when "Bob" collides with a coin the coin needs to disspear. This is what I have so far:
Code:
onClipEvent (enterFrame) {
if (_root.coin2, hitTest(_root.bob)) {
_root.text = "You found Coin 2!";
}
}
I have tried using a few different functions but none of them work. (clear, removeMovieClip). Thanks in advance.
Delete Movieclip W/ AS?
Need to delete a movieclip off of the stage. It's messing with my button focus.
Setting it to invisible isn't helping.
Delete MovieClip
Hi,
Check this simplest code
Code:
public function DoStuff():void {
var mc:MovieClip = new SomethingBig();
mc = null;
}
DoStuff();
the MovieClip "SomethingBig" is a movieClip of 7000x7000 with a lot of animations and stuff. Read here : LOT OF MEMORY WHEN IT'S PLAYING.
So, the problem is, if I called DoStuff(), my MovieClip is not deleted after the function. There is no reference at all, there's nothing more then that stupid function but still, my memory keep growing because the movieClip is played.
If I stop all the children of the movieClip, the memory stops to grow, but still, I'm guessing that the movieclip is still alive, and I want him dead cause i'm evil.
Any suggestions ? Remember, there is no reference to it. Attached is an exemple of the bug.
Thanks !
Lachhh
Delete Movieclip W/ AS?
Need to delete a movieclip off of the stage. It's messing with my button focus.
Setting it to invisible isn't helping.
Delete A Movieclip
I have a want a certain movieclip to delete itself when finished playing. I have a blank keyframe at the end of the movieclip, what code would I put to make it delete itself?
Thanks in advance!
User Able To Delete Movieclip
I am new to flash I created a graph. underneath the graph is a few images that the user is able to drag and put on the graph. I want them to be able to click on the image that they just dragged to the graph and hit the delete button and it should delete. The dragging part is working how do I get the user to be able to delete the movieclip? All help is greatly appreciated
How Do I Make A Movieclip Delete Its Self
how do i make a movieclip delete its self when it reaches a certain frame. i cant just press "delete" at that frame because it still leaves an empty movieclip.
thx
Destroy/Delete A Movieclip?
Hey every1.
I have a question (I'm sure somebody asked it before, but I didn't find the threat...) :
How can I delete/destroy/whatever a movieclip during a movie? I made a game, in the game there is a zombie (movieclip), and when its life (life???) reaches zero, it should be destroyed. I tried "removeMovieClip(this)" and much more, but it didn't work, but also there were no errors.
Lifetime Of A Movieclip? How To Delete After A While?
Hi! I've used a text effect here in flashkit click here to see and I've altered it a bit so it won't overflow over the text like it does in the example. The only problem is that if after about 10 minutes the swf is still opened, the computer starts running slow and so does the animation.
What I would like to know is if there's a way that after some time, say 2, 3 minutes of the snowflake appearance, it can delete itself, so the animation won't get too heavy.
Is it possible to be done? What kind of actionsctipt can I use? Thanks!
Movieclip Target Otherwise Delete.
I am trying to make my duplicated movie clips produced from the blue ball only clip on to the greenRect onRelease, if the duplicate is dropped not on the greenRect onRelease it is to be deleted, i know this is somehow possible with a target command however i am unsure how to implement this when i am using duplicates of movieclips as my instances to stick to the targets as opposed to the main movieclip? Should this even be a concern in my code?
Is It Possible To Delete MovieClip Methods?
ok so Flash doesn't propogate button events into nested movieclips... http://senocular.com/flash/tutorials/buttoncapturing/
I was hoping that I might be able to delete a movieclip's onRelease handler so that I would be able to use the buttons within that movieclip.
is this possible?
MovieClip: Play Once Then Delete
Hi,,
I'm struggling away making a game in Flash MX 2004.
The game waits for a mouse input to place a bomb on a grid. Under certain circumstances the bombs will explode. I have a movieclip for the bomb and a separate movieclip for the explosion animation. (This is because there is only one explosion and many types of bomb. I think it would be very inefficient to have explosion sequences in every bomb clip).
Anyway, when an explosion occurs, I attach the explosion movie clip to the stage at the position of the bomb. I want the explosion to delete immediately after reaching the end of the frame sequance. When I use gotAndPlay, the animation just loops.
Can someone help me please.
Thanks,.
Thomo..
How To Remove/delete A Movieclip?
How can you remove or delete a movie clip that has not been attached with attachMovie?
And along similar lines, how can you delete a function?
Delete Childs Of A Movieclip
Hello everybody,
First post in this forum..So here we go:
How can i select some child clips, with let's say depth above from 5, and delete them?
Is it safe to overwrite a clip in the same depth instead of first deleting? Do i have memory leaks?
Thanx in advance...
What Is An Instance Name? Delete A MovieClip
I am trying to delete a movie clip. I gave it an instance name and found .removeMovieClip(); but it doesn't seem to delete it.
what exactly is an instance name? is it a pointer to the movie clip?
Is a movie clip an object?
am I simply deleting the pointer to an object?
Although I need help deleting a movie clip using an instance name, I would like to know exactly how flash is set up. I have scripting language xp and c xp. So I am trying to understand action script based of that knowledge.
Delete Movieclip Permanently
Hi,
I have a problem with deleting a movieclip permanently from Flash. I have used removeMovieClip() functions that does clear the stage nicely but Flash somehow leaves some infromation to the player.
Is there anyway to delete (garbage collect) the movieClip permanently?
Thanks
FC
MovieClip Wont Delete
Hi all,
I have some movie clip objects that I create dynamically and inside them I add a TextField. I need to remove them and then recreate them but for some reason removeMovieClip() doesn't work.
After several removals and recreations I check that:
for (key in _root) trace(key + " " + _root[key]);
and I can see multiple entries of movie clips with the same name
I have also tried to use "delete _root["mcX"];" but it doesn't do much.
All this happens in Flash 8.
Does anybody have any idea of what can possibly go wrong here??
TIA
Alex
Delete All Content Of A Movieclip
How do I, in actionscript, say "delete all content of a movieclip"?
there doesn't seem to be a function called
" _root.movieclipname.deleteContent(); "
I know an awkward way of doing it; deleteing the movieclip and replicating it in the same coordinates with the same name, but this is a terrible way of doing it..
how is it then? please help, thanks
Cut/delete Parts Of A Movieclip
Hey,
I don't even know what to ask for, but here is my problem:
I want to draw a line as part of a graph.
Then I want to draw a hollow circle over the line, but I want to cut out the center of the circle, so it shows the layer under the line.
At the moment, drawing an outline of a circle the line still shows.
Hm, ok I draw the line:
------------
Then I draw the circle:
-----O------
But when I do this in flash I still see the line, the circle is not hollow:
-----(-)-----
How do I 'cut' the middle of the circle out? Instead of beginFill, I want to do beginErase
Thanks :-)
monk.e.boy
Delete Movieclip In Run Time
how i delete the movieclip in runtime.
i gave one sample swf like this : sample.swf
source file : original file.fla
solve my problem..........
Delete Part Of Movieclip
I just wondered if it's possible to delete a part outside an area in a movieclip. I'm creating a graph that follows a Math.cos formula and it has a constant xspeed and the movieclip goes in the opposite x direction so the graph just draws constantly. But I only want to show part of the graph.
I could just use a mask, but since the movieclip gets bigger and bigger, the movie will be harder and harder to run.
So I want to delete everything outside of the box.
You can see the movie here:
http://www.rudolfsen.info/peter/graph.swf
[Flash 8 Actionscript 2.0]Prob With Delete Button On Dynamically Created Movieclip
The plan? Create a color swatch creation tool that dynamically loads an image and allows the user to create a multi-color swatch by choosing different pixel locations.
I borrowed the pixel selector code from a tutorial that this guy had posted:
http://www.flashcs.org/
I am successfully loading a dynamic image to his code and saving the chosen colors into an array.
In the color select function I loop through that array and create dynamic movieclips for each pallette color chosen. I would like to create "delete" buttons for each individual color so that the user could remove a color that he/she didn't like. This is where i'm not successful.
this code has problems, that's where i need someone's help.
Code:
for(var i =0;i < topLimit;i++){ // loop through array
xPos = this.xColorList; // set x and y position based on config variables
yPos = this.yColorList + (this.yColorListJump * i); // yColorListJump is an offset between the swatches
_global.swArr[i] = this.attachMovie("selectedColorInfo", "selected"+i, 1000+i, {_x:xPos, _y:yPos}); // create an array to hold the swatch movieclips - i'm using the _global because i was trying to maek the swatch arrary visible to the onPress function below
_global.swArr[i].id = i;
newSelColor = new Color(_global.swArr[i].sampleChosen1); // Create as new Color object so we can setRGB
newSelColor.setRGB(list[i]); //setRGB is a method of the Color object
_global.swArr[i].hex.text = list[i]; // set the text name of the color
var butArray:Array = new Array(); // create an array to hold each button
//create button
butArray[i] = this.attachMovie("deleteBut","del"+i,2000+i,{_x:xPos+40 , _y:yPos+20}); // place the delete button beside each swatch
butArray[i].id = i;
butArray[i].swatch = _global.swArr[i]; // tried to place the swatch array inside the button array as a property ***not working***
butArray[i].onPress = function () { // my delete function, it deletes the button but not the swatch
removeMovieClip(this);
//removeMovieClip(_global.swArr[this.id]); // commented because not working
}
}
}
Can anyone help me?
Delete Var
Hi all,
I made a simple mailscript in ASP and I managed it to work with Flash. It simply gets all vars from Flash and mails it to the specified address.
The problem is that I don't want ALL the vars to be send. A status check var for example shouldn't be mailed.
Is there any way I could delete (or deconstruct) a variabele in Flash?
Greets Rik.
Delete This.?
Good Morning, Afternoon, Evening FlashKit. Ive got a menu/menu slider (with jazzy fx) that works like a charm on my maintimeline (frame 1). Problem: when it jumps to frame 2, Im still left with my menu slider sitting, smiling at me . Ive been researching types/ways to eliminate this and do not have the creative fortitude this morning to be able to apply such methods effectively any help would be greatly appreciated. ThankYou.
Geoff
Code:
menuButton = new Array();
menuButton[1] = "standard";
menuButton[2] = "negative";
menuButton[3] = "singlesample";
for (i=1; i<=4; i++) {
_root[menuButton[i]].onRollOver = function() {
if (!_root.slider) {
_root.attachMovie("sliderID", "slider", 1);
_root.slider._y = _root[menuButton[i]]._y+145;
}
_root.attachMovie("fxID","fx"+i,2);
_root["fx"+i]._y = this._y;
_root["fx"+i]._x = this._x;
_root.slider.xtarget = this._x;
slider.onEnterFrame = function() {
this._x += (this.xtarget-this._x)/4;
if (Math.round(Math.abs(this.xtarget-this._x))<.5) {
delete this.onEnterFrame;
}
if (_root.slider.xtarget) {
_root.attachMovie("flashesID", "flashes", 3);
_root.flashes._x = _root.slider._x;
_root.flashes._y = _root.slider._y;
}
}
}
_root[menuButton[i]].onRollOut = function(){
_root.removeMovieClip(_root["fx"+i]);
removeMovieClip(flashes);
}
_root[menuButton[i]].onPress = function() {
gotoAndPlay(2);
}
}
Delete
I have a dude and a star.
When the dude walks against the star the score rises with 100.
But the star also has to be deleted.
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_parent.dude)){
_root.score += 100
}
}
Please adjust this script so the star will be deleted if the dude walks against it.
DELETE ME
Nevermind, wrong forum. Kill me now
Delete Everything
How would you say "delete all the movieclips on the stage except for _"?
Delete
Mis Post - Admin, Please Delete
Delete Mcs
how do i delete movie clips?
i know ive seen this some where before...
Delete Me
I'm not sure how you can do a roll off, what I'm talking about is buttons, I'd like to play animation when you roll off a button.
Delete AS With AS...
Is it possible to delete Actionscript on a movieclip by hitting a button?
What I want to move something around in my animation while it is playing with the arrow keys, which is easy enough. But then, when I hit enter (or some other button) I want it to remain stationary until it gets deleted later on (since I'm probably going to put in another movieclip that is moved with the arrow keys, remains stationary, and then gets destroyed). So I was thinking that I would delete the actionscript inside of the movieclip once I get it to where I want it to be.
Is it possible to delete lines of code using lines of code, or is there an easier way to solve the above problem that I'm not thinking of?
P. S. Using Flash 8
Delete This...
Curse my bad internet connection and its double-postitis.
Delete BTN
I have a movieClip that has two actions on it 1. a drag and drop 2. and enlargement when released
My issue is I have a BTN that will delete the movie clip, but I need an action that will make the BTN visible on release of the movieClip and delete it's self(the BTN) when it deletes the MC.
any help thanks
http://www.gardengatestore.com/flashTest.html
Will You Delete Please?
hi, Today, I would like to know how to delete a variable.
i have a abc.as
Code:
class abc
{
function delme()
{
trace("prepare to delete...");
this=null;
delete this;
}
}
im my scene:
Code:
var del:abc=new abc();
abc.delme//output prepare to delete ...
abc.delme//output prepare to delete ... <<I do not want this...
...but HOW? thanks!
Web --> XML Delete ?
im building a web and im targeting different frames to show contents... son frame 15 im building a Signature Book by AS3 ... the problem become when i return to previous frames, the xml document are still IN.
Its supposed to be a delete method on change frame?
my code more or less is like :
Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("text/book.xml"));
function loadXML(e:Event):void
{
var xml = new XML(e.target.data);
Firmas(xml);
}
function Firmas(firmaInput:XML):void {
var textio:TextField = new TextField();
var textf:TextFormat = new TextFormat();
var fuente:Font = new Font1();
textf.font = fuente.fontName;
textf.size = 13;
textio.defaultTextFormat = textf;
textio.embedFonts = true;
textio.width = 400;
textio.height = 400;
textio.y = 50;
textio.text = "DEJA TU FIRMA";
var textio2pos:Number = 0;
for each (var item in firmaInput.firma){
var textio2:TextField = new TextField();
textio2.defaultTextFormat = textf;
textio2.embedFonts = true;
textio2.text = item;
textio2.height = 400;
textio2.width = 400;
textio2pos += 100;
textio2.y = textio2pos;
this.addChild(textio2);
}
this.addChild(textio);
}
? maybe can i make some IF statement on changing frame to delete all variables ?
How Do I Get Rid Of A Delete...
Code:
_root.nowPressed = " ";
buttons = [SX1, nokia6600];
if (_root.nowPressed == " ") {
for (j=0; j<buttons.length; j++) {
buttons[j].onRollOut = function() {
SX1._alpha = 100;
nokia6600._alpha = 100;
nokia3650._alpha = 100;
};
}
}
SX1.onRollOver = function() {
nokia6600._alpha = 50;
nokia3650._alpha = 50;
};
Nokia6600.onRollOver = function() {
SX1._alpha = 50;
nokia3650._alpha = 50;
};
SX1.onPress = function() {
delete this.onRollOut;
delete this.onPress;
_root.nowPressed = "SX1";
attachMovie("c01", "c01", "this");
c01._x = 412;
c01._y = 158;
//nokia6600._visible = 0;
//nokia3650._visible = 0;
};
Nokia6600.onPress = function() {
delete this.onRollOut;
delete this.onPress;
_root.nowPressed = "Nokia6600";
attachMovie("c02", "c01", "this");
c01._x = 412;
c01._y = 158;
endX = 372;
//SX1._visible = 0;
//nokia3650._visible = 0;
};
The button stops working but how do I get it to rework again?
How To Delete
i have created many shared objects remotely and i wonder if there is anyway i can delete them from the server?
Using The Delete Key
I seem to be having a problem using the delete key to trigger events. The code I'm using is to call a delete function and I've tried it with other keys and they work. I've written
listener = new Object();
listener.onKeyDown = function() {
if (Key.isDown(Key.DELETEKEY)) {
_root.deleteNote();
}
};
does anyone know why this doesn't work? Regards
Delete Please
delete
Edited: 12/05/2007 at 08:56:37 PM by RyviusRan
Delete Me
delete me
Edited: 09/22/2008 at 07:18:37 PM by dmodie
|