ActionScript 3.0 :: Ghost Object On Stage After Using RemoveChild?
Mar 15, 2009
I'm working on a project which uses timline animation. The animated objects are involved in a collision detection script.
When they collide with other objects, their timelines are told to stop() and they're removed using removeChild. At this point they have a value of null (I've tested this.)
Strangely however, they invisibly re-instantiat themselves when the timeline animation loops back to frame 1. There's no code telling them to play anywhere in the program. They still have null values, but their collsion code still affects other objects.
View 6 Replies
Similar Posts:
Nov 21, 2011
I am using removeChild() to remove a MovieClip. And via tests, I can confirm that it's working fine ( stage.contains(mc) returns false ). But the MovieClip still does not seem to be removed, as if the stage is not updated correctly.
View 1 Replies
Apr 4, 2010
If I removeChild an object from the stage can it still be detected by a hittest? I have objects that are tweening off the stage and if they hit other objects they stop their tween i use removeChild to remove objects that I don't want a hittest to occur on which is the nature of my question.
View 1 Replies
Aug 26, 2011
I have a removeChild and null question. I know removeChild removes my object from the stage but stays in memory until I call null on it. My question is, if I set the object to null, do I have to removeChild it at all? For example, I have a movieclip where I addChild lots of objects to it. So If I want to completely remove all traces of said movieclip and all its children, can I just set movieClip = null, or do I have to removeChild all its children and the movieclip itself beforehand.
View 6 Replies
Aug 11, 2011
If im usin function to add a mc to the stage like so:var myChild:MC= new MC();
function somefunc()
{
stage.addChild(myMC)
[code].....
View 4 Replies
Jul 28, 2010
I have 4 movies that need to be loaded in sequence. The first movie loads the second one, the second one loads the third, then the third one loads the fourth. What I can't figure out is how to make sure there's only one movie loaded at any time. I've tried removeChildAt(0) and other methods. What's the best way to load a movie to the stage and wipe out what was on the stage?
View 4 Replies
May 29, 2010
I have a website with a homepage in which I have a movieclip called "menutopmc" which, as the name says, is a menu on top of the stage and it is an MC as instance. Inside this mc I have 5other mcs and each of them works as button.On the stage I have an other mc called "website" in which I load the several pages of the website.Here is some code to understand better what I'm doing:code on the main stage where I automatically load an swf when the website loads:
ActionScript Code:
stop();
var websiteRequest:URLRequest = new URLRequest("azienda.swf");
[code]...
and here is the code I have inside the mc menutopmc in order to change the child previously loaded on the stage:
ActionScript Code:
function btn_content(eventObject:MouseEvent):void {
MovieClip(parent).website.removeChild(websiteLoader);
[code]...
Now, the new addChild in the function btn_content works and it loads the new child on stage but the removeChild doesn't work and this is the error I get:
1120: Access of undefined property websiteLoader.
View 9 Replies
Nov 2, 2008
If I add a movieclip to the stage like this:
Code:
var feedbackBox_mc:feedbackBox = new feedbackBox;
feedbackBox_mc.x = 807;
[code].....
View 7 Replies
Mar 25, 2011
I'm working on a simple Flash game for school. In one level, multiple enemies spawn and the player is supposed to shoot them. I used removeChild() to get rid of the enemy that got shot, but when I click (hit) an enemy, everything on my stage gets removed; it goes completely blank.The function to populate my stage with enemies is the following:
private function Game2():void{
for (var i:uint=0; i<50; i++) {
var man:MovieClip = new man_mc();
[code].....
View 2 Replies
Jul 25, 2011
I have several objects created at frame 2 of my fla file, like:
Code:
stop();
var rotatorek:Rotator = new Rotator();
addChild(rotatorek);
var rpm:engine = new engine();
addChild(rpm);
etc...
After endGame is changed to true within one of my .as files, I got this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at Rotator_fla::MainTimeline/ruszMaszyna()[Rotator_fla.MainTimeline::frame2:94]
Frame 94 is first removeChild(rotatorek).
Why I can't remove all those children? I need to go to frame 1 without any instanced objects and cleared listeners.
View 3 Replies
Apr 15, 2010
I have a parent swf that loads in 6 little swfs. However, I have a button which should remove the loaders from the stage, no matter which one it is from the 6. At the moment I can only remove one of them because of the way I have coded the application. So, when I click on the button which is supposed to remove whatever loader is currently sitting on top of my parent movie, it only removes one of the loaders - the one which is named first under my resetAssets function.
I can not have:
removeChild(ldr);
removeChild(ldr2);
removeChild(ldr3);
etc.
Because only one of them is being displayed at the time and flash goes like "hey dude! where are the others you want me to remove then!?" I suppose the whole code has been built up poorly and I should loop the swfs through one loader instead of having a loader for each swf.. Then I could just remove the loader no matter what sits in there..?
Code:
//imports
import flash.filters.*;
import flash.events.*;
import flash.display.Loader;
import flash.display.Sprite;
var ldr:Loader = new Loader();
var req:URLRequest = new URLRequest("load_XML.swf");
[Code] .....
View 1 Replies
Nov 17, 2008
So, I have a file where I've added 27 movie clips to the stage using a for loop to cycle through items in an XML document. Here's the pertinent part of the code I'm using, it's AS3:
So, I end up with 27 instances of mini_mc, each named 0, 1, 2, 3, etc.
I'm trying to write code to remove them at a certain point in the movie but having problems. Here's what I'm using[code]...
View 5 Replies
Aug 12, 2009
I'm having a problem removing a child from the stage that is added dynamically. Shouldn't this work...
[Code]....
View 3 Replies
Jul 21, 2011
I got some problems with removing a child from stage. The timer is still active I try to get rid of it with a killMe function. Called by REMOVED_FROM_STAGE event. But it doesn't work.
View 4 Replies
Nov 7, 2009
I'm new to AS3 and have been making a Snake game. I've come up with a problem with the code (Yes, I have magically created problems trying to program Snake...It's going to be a long day). My problem is, with removeChild...I'm getting strange errors being throw at me. Not only that, but my Movieclip (myFood) is not being removed entirely, only the visuals of it are.
That being said, here is, what I believe to be, the most important chunk of code for this problem, along with the error it gives me.
Code:
/*
* Code for the Snake and whatnot extras.
* Also, Snake and Food are classes.
*/
var myFood:Food = new Food();
stage.addChild(myFood);
function snakeEatFood() {
[Code] .....
View 2 Replies
May 3, 2011
New to flash as3, cant seem to get past a 2025 error when remove child is used. My player hits of an object called present_mc2 and is removed but an error comes up on stage.
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at VinnieBaggeB00033245_fla::MainTimeline/detecthit()
Here's my code:
var present2_mc:MCpresent = new MCpresent();
stage.addChild(present2_mc);
present2_mc.x=87;
present2_mc.y=305;
stage.addEventListener(Event.ENTER_FRAME, detecthit);
function detecthit(event:Event):void {{
removeChild(present_mc);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detecthit);
}}
View 2 Replies
Jul 27, 2011
I'm currently working on a script which depending on various factors will add different movie clips to the stage. When the factors change so do the movie clips. I know that I can use removeChild(myMC); 100 times and wipe the stage, so I was thinking it would be possible to add all the movie clips to an array and use removeChild(myArray); to get rid of them but I'm coming up with the compiler error: Code: 1067: Implicit coercion of a value of type Array to an unrelated type flash.display:DisplayObject. so obviously I'm missing something. Is this even possible? is there a more effective way to remove Movie Clips from the stage?
View 6 Replies
May 4, 2010
I first noticed it when this function started throwing a 1009 error:
[Code]...
were throwing the 1009 error. Which is wierd on two accounts. First, if I remember right, error 1009 comes about when referering to an object that is not on the stage. Which makes NO sence when getting it from an addChild! Second, this error only starts to occur the second time I use the function.
[Code]....
View 7 Replies
Feb 9, 2011
All of the bullets are of the "Bullet" class and are stored in an array called "bullets" in the main class. When bullets exit the screen, removeBullet(bulletID) in the main class is called.
private function removeBullet(id:int)
{
removeChild(bullets[id]);
bullets.splice(id);
}
In my Bullet class I have an enterFrame listener that traces "stillHere". So as soon as a bullet is added to the main stage using addChild, "stillHere" starts popping up in my output panel.
My problem is that even after I call the removeBullet, "stillHere" keeps popping up in the output panel, which tells me that the object which I tried to delete is still sticking around somewhere in the memory.
View 2 Replies
Jul 6, 2009
I have strange problem. I remove sprite object from container and its not visible anymore but still behaves like its existing. here is how i add object to container:
[Code]...
I think that all listeners and vars has been removed from the object but probably not because GC does not remove the object comepletly. Why object is still at its place ? Is there easy way to check what has to be removed from object so GC can collect it?
View 11 Replies
Jan 25, 2010
Here's the code I'm having trouble with:
function offNav(e:MouseEvent):void {
if (mouseX >= 0 && mouseY >= 0 && mouseX <= 36.45 && mouseY <= 325) {
TweenLite.to(navPanel,.5,{x:0});
TweenLite.to(home_btn,.5,{x:15.65});
TweenLite.to(work_btn,.5,{x:11.5});
[Code] .....
The problem is with smallImg_mc. Later on when it is clicked, it gets removed using the removeChild(smallImg_mc) command, and my question is how do I signal it through an if statement where it says
if (smallImg_mc.visible !== false) {
setChildIndex(smallImg_mc,1);
setChildIndex(logo,1);
}
It's causing annoying output errors.
View 1 Replies
Nov 30, 2010
If you dynamically create a parent movieclip, and dynamically add a color picker to each clip, and add an event listener for each color picker, does a removeChild on the parent movieClip remove event listeners belonging to any of it's children?
View 2 Replies
Jun 25, 2011
Here are my classes
Main - creates preloader
Preloader - createas Website
Website - creates MainMenu
When a button in the main menu is clicked, it creates an object. And when another one is clicked, that object needs to be removed. The removing part got a little bit messy.
package src {
import com.greensock.TweenLite;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
[Code] .....
View 1 Replies
Mar 29, 2010
I'm trying to build a conditional statement that will addChild and removeChild at different Timer Delays. Before I go any further, I thought, I should mention that I'm usinig TweenMax to ease the alpha of ease Child from 1 to 0 and back during the process to imitate a fade-in/out.
I'm getting issue with only one line - inside a conditional statement.It's running "OK". The movie runs as I want it, but the remove/addChild transitions are not at the speed I want it at. I am getting an error message in the output, but other than that, the movie runs fine.
stop();
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
[code]....
View 2 Replies
Aug 7, 2003
The code below creates a grid fade effect when put on a blank key frame of the main timeline and when a MC is given an identifier of 'cube' in the linkage section of the 'create new symbol' dialog box.what i can't work out is how to get rid of the 'ghost' of the animation once it has completed its effect, in fact is it at all possible to get rid of the ghost??[code]
View 2 Replies
May 9, 2010
When I'm removing an object from the display list (via removeChild), I'm performing a splice on all of the arrays that the object has:
[Code]....
My thinking was that this frees up some memory similar to disposing a bitmapdata. Does this even do anything? Or, will arrays be cleared and the memory usage restored when the object is removeChilded?
View 3 Replies
Aug 19, 2003
I have the code below which rotates a MC and fades it in to 100alpha and then fades it out again to 0 alpha. bearing in mind that all this happens on one frame, is there a way to get rid of the ghost image of the MC once the alpha gets down to 0?
I've tried to achieve this at the foot of this code with the removeMovieClip() but it doesn't seem to work.I know i could just let the timeline play to another frame once the animation is over to get rid of the ghost image but i'd really like to keep the animation to just the one frame...
onClipEvent (load) {
amount = 5;
count = 0[code]..........
View 3 Replies
Jan 19, 2012
I'm trying to remove a movieclip that I added in the same class but keep getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.Here's my code:
public function wallDown():void
{
_asTrans = new ASTrans();[code].....
I also tried to use _gameModel.screen.removeChild(_asTrans); as I said above but with the same results.
View 4 Replies
Dec 25, 2010
I have a simple Flex RTMFP P2P video app in the same mold as the Adobe Cirrus VideoPhone Sample application. A problem I've been encountering in developing this app (the same problem occurs in the sample) is when you try to connect to a ghost Stratus instance i.e you try to call someone whose Stratus id is in the database but who is no longer on the page. So here's an example of what I mean:Let's say you go to the Adobe Stratus sample and connect as Dan. Then open up a new tab, go to the sample again and connect as Fred. If from this point, you (as Fred) call Dan everything will work fine. But, if you close the tab in which you connected as Dan, and then from the Fred tab try to connect to Dan the program will just hang.
I would have thought there would be a NetStream event that would be triggered if you tried to connect to a Stratus instance that is not longer online but I can't seem to find anything besides NetStream.Connect.Rejected which doesn't seem to be called.
View 1 Replies
Sep 20, 2009
have created a gallery which has a button behind it so that you cant press any of the stuff behind it. Which all works. However, when I put it in html it only covers my flash movie and not the whole page which is really what I want.
View 1 Replies