ActionScript 2.0 :: Removing MC After Loading?
Jul 13, 2010So I'm trying to embed a youtube video in my flash and I can't get it to unload properly. It keeps playing after I unload it.
View 5 RepliesSo I'm trying to embed a youtube video in my flash and I can't get it to unload properly. It keeps playing after I unload it.
View 5 RepliesI am dynamically loading and removing movieclips from the stage.I am using this to remove them
ActionScript Code:
var n:int = rootElement.numChildren;
while (n--){
delete(rootElement.removeChildAt(n));
}
The movieclip does remove itself from the stage, yet I can still hear the audio continuing to be played by that movieclip. The audio in the movieclip was not being removed while playing. It is audio that is initiated later in the movieclip. I'm not sure if the delete is overkill, or not.
I am making my portfolio and trying to learn working with as3 at the same time. I have hit a rock now and I tried very hard to deal on my own but to no result I get this error when I tried make my home page load automatically first.
Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
how to make the child to be the child of the caller or figure out another way to load the homepage at the beginning.
import fl.transitions.*;
import fl.transitions.easing.*;
import caurina.transitions.*;
[code]...
having trouble removing loaded child object b4 loading a new one i can load a child object with this script if button is pressed:
[Code]...
but having difficulty unloading child object when just that mc_char.btn_darkangel button is pressed. Cause otherwise it just adds another instance then another and another and the different instances kinda pile ontop of each other my question is how can i incorporate removeChild script so that mc_char.btn_darkangel doesn't just pile instances of image ontop of each other
how to activate the animation that removes the previous page items before loading new page when you click on a menu button. like this website [URL] When you click on a menu button, current items are removed with nice animation before new items appears.
View 3 RepliesI'm trying to get tables to display using flash. Currently I have two scenes, with a table on each scene. I have buttons that switch back and forth between the scenes and each table loads fine when I run each scene individually. The problem is I have no idea how to REMOVE a table from the scene. Currently when I play the whole movie the first table that loaded stays loaded, and the second table just loads over the top of it.
Also, I get an error #1009 after I switch back and forth from one scene to the other. So first table loads fine, click button, second table loads fine, click button, error #1009. I tried commenting out the table load parts on each scene and just leaving the button code and it worked fine. Then I left the first table load sequence commented out, and it loaded the second fine, click, loaded first page fine, click, loaded second table fine again (over the top), click, error #1009.
[Code]....
When I click a button "boardButton" at frame 30 it will load my ext. swf pretty fine. But when I click my button "sponsorButton" at frame 50(I've more buttons) I need to remove the external file, but it won't happen. The trace of removing shows up but the ext. swf is still there...... I tried lots of things but no luck at all (two evenings spent already and no hair left)
View 4 Replieshow to remove duplicate values from xml although it successfully done using array but not in xml
here's my xml data looks like (list.xml)
Code:
<?xml version="1.0" ?>
<gallery>
<menu maker="adobe1" software="flash"/>
<menu maker="adobe2" software="photoshop"/>
[Code].....
What i am trying to do is when i click on a part of an img to delete it.[code]i read on setpixels and getpixels but this did ot help.
View 2 RepliesI have a main. fla with navigation btns activated by GoToFrame actions. Some btns load content and some use the UI loader component.
I have one btn that calls a UI loader "loaderVideoGallery" which loads an external .swf inside that .swf is an flv player "flvPlayer".
This also works fine except after that button is selected and that swf is on stage no matter what button you call next the video stream from the flv does not stop, it continues to play.
The UI loader removes itself as you can see the other loaders come up on button presses but the video's audio still plays.
the UI Loader instance is "loaderVideoGallery" and the .flv player inside the external .swf is flvPlayer
I was told to use
MovieClip(loaderVideoGallery.content).flvPlayer.st op()
I would think that the logical place to put this code would be inside the btns where the EventListeners are, is that correct?
I have been searching all over about removing embedded swf but couldn't find any solution.Here is my scenario
Code:
[Embed(source="hero.swf")]
var Hero:Class;
[code].....
URL...when you click on a picture on the home page, a bigger image shows on, when u scroll over it a black box slides out from the side. how do i prevent that from sliding when you scroll over the picture?I am using a pre-made template.
View 8 RepliesIm using the following code to create a mc from a template iv made stored in the library:
var galleryThumbs:MovieClip = new contentTemplate();
galleryThumbs.x = 710;
galleryThumbs.name = "galleryThumbs";[code].........
that all works fine but then im trying to remove it with this, with no success:
if (galleryBox){
removeChild(galleryThumbs);
}
I've loaded a swf into a MovieClip and I want it to be removed when I hit a button. My attempt to do so is like this:
swfContainer.removeChild(swfLoader);
At first it seem to work but since the loaded swf contains sounds and music the music continues to play.
Anyway heres the code for loading the swf:
Is there a way to remove a class linked to a movieclip? For instance, I've got a ball (e.g. ball0_mc) that's placed in a target. The way the ball is dragged and dropped into a target is by using a class called Ball. What I would like to do is remove the Ball class from ball0_mc once it's been placed in a target so that it can't be dragged or dropped anymore.
View 2 Replieshow do i go about removing a post?
View 1 RepliesIt's a simple self-checkout grocery thing and I want to list the items the user is "buying" after typing in the appropriate code, but I can't get it to stay at nine lines only in the dynamic text field. I was told to use array.shift() to get rid of the first value in the two arrays so that I have an easy way by keeping the arrays at nine values, but it doesn't seem to work right.. It'll get rid of the first value, but only once and it'll add a blank value and then continue happily adding to the length of the array. Google has failed me so far so I suspect it's something else in my code.[code]
View 1 RepliesI am having issues with trying to insert a "mailto" link in a flash file. I can create the text no issue, but as soon as I add a link to the text it removed the "dot" and the @ symbol from the url and scrunches all the letter of the email address together, sometimes to the point where some of the letters aremissing. The first image shows the url on the stage, the second image is a test of the scene. It is very frustrating and I don't know how to fix it. I have deleted the entire line and redone it, but still no joy.
View 1 RepliesHere it is:
var ZombieInstanceTimerL:Timer = new Timer(8000,60);
ZombieInstanceTimerL.addEventListener(TimerEvent.TIMER, ZombieTimerLfunction);
ZombieInstanceTimerL.start();
[Code]....
Basicly im first setting a timer of 8 seconds for a zombie to sprawn then it sets the properties and then using the addChild method it adds the zombie every 8 seconds. then i made the zombie move but as if it hits the character i make it stop and go to the attacking scene which is frame 4 and then when it isnt hitting it, it goes back to frame 2 which is walking,, then i made a Zombie death code which works by in the zombie attack class it has hittests for all the weapons and it reduces a varible in a GlobalVaribles class the varible is called ZombieHP and here it says if ZombieHP is below 1 it should go to 3 which is the death scene and add a point to the score but the hp and gotoAndStop affects all of the zombies so when it hits one they all die how can i make it so only the one its hitting can be affected..
I found some AS2 code for creating a XML dynamic photo gallery, with thumbnails and big selected image. I extended that for more than one gallery, and all worked well except one thing: when I load a gallery with, for example, 6 photos and return to one with 2, the difference of 4 thumbnails of the first gallery remains, so the problem is that I don't know how to remove the mc instances that I've created with createEmptyMovieClip function. The code of the function that creates every thumbnail is:
function thumbnails_fn(k) { thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); tlistener = new Object(); tlistener.onLoadInit = function(target_mc) { target_mc._x = hit_left._x+(target_mc._width+5)*k; target_mc.pictureValue = k; target_mc.onRelease = function() { p = this.pictureValue-1;
[code]....
k is the number of the image to create this thumbnail, and thumbnails[cat_actual][k] is the path that contains the thumbnail to show. I've tried to use the removeMovieClip(); function with thumbnail_mc but doesn't work.
i am loading a jsp file, which had some space at the beginning. i want remove the space,then i need ot parse the data, just like ignoreWhiteSpace in xml.
View 5 RepliesAt some point I will have created a MC on the stage. Later on, I want to put a different on in its place. The original MC may, or may not, be there.So I need to first check and see if it is there, whack it if it is, then add my new one.I know the name of the variable I used to create the MC, but I think the problem is I did this from INSIDE another clip. When I am trying to find it and remove it, I am outside that clip, so I don't think the main timeline knows of that variable. So when I try:if(ribbonEGM) removeChild(ribbonEGM);[code]How can I test and remove the ribbonEGM clip from the main timeline?
View 9 Repliesi have a main .fla file which i shall call projectthing.fla for example purposes, and on one of the frames in projectthing.fla i an nesting a movie clip called "childgalleryholder" which currently resides in my library. within this "mychildgalleryholder" i am... importing?... an external .swf which is located in the same folder as my main projectthing.fla . The .swf that i speak of is called stack_gallery.swf and essentially the same file that im using can be found here. Now then, to pull said .swf into the holder movieclip i mention above i am using this code:
ActionScript Code:
import flash.net.URLRequest;
import flash.display.Loader;[code]....
Now then, this all works fine (well good enough anyway), BUT when it comes to changing frames, no matter what frame i switch to, the holder mc DOES NOT go away, or at least i assume its the holder mc the point is that the imported .swf stays on the screen and renders my project unusable until i close it then reload it and avoid that frame.So i decided to set up a button which uses this code to remove the holder from the stage:
ActionScript Code:
removePhotoSlideShow.addEventListener(MouseEvent.MOUSE_DOWN, onClickremovePhotoSlideShow);
function onClickremovePhotoSlideShow(evt:MouseEvent):void{
removeChild(mychildgalleryholder);[code]....
It works fine and the thing goes away, BUT it leaves the photos in place for no apparent reason.
I have a extremely simple page that I am making... [URL] Upon going to the site you should get the same error that every one gets which is what is bugging me..
ActionScript Code:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at mainbodyflash_fla::MainTimeline/frame2()
Basically, the "Gallery" section has an external SWF being loaded into it. I call it in by putting the following code onto Frame 1 of my actions layer...
ActionScript Code:
var myrequest:URLRequest=new
URLRequest("viewer.swf");
var myloader:Loader=new Loader ();
myloader.load(myrequest);
And I display it in the actually "Galley" stage by using this code on the content layer in the "gallery" frame...
ActionScript Code:
stage.addChild(myloader);
If I just leave it like this it loads fine and I don't get any errors.....but if you click on any of the other tabs the external swf overlaps what is in those parts.... so I tried to just use this code in those frames....
ActionScript Code:
stage.removeChild(myloader);
And it does make it so that it doesn't overlap anymore...but thats when I get that error mentioned above.... so basically I want to know how to remove the external SWF when going to another frame without it overlapping or giving me this error....
I'm creating a flash quiz that has drag-and-drop functionality. As part of this, I have 2 classes, one called Dragger and the other Dropper.
When Dragger is dragged above a Dropper, when I release the Dragger, it locks in place with the Dropper, and I set the value of the Dragger to the Dropper, using a setter function in the Dropper to update a value called _dropped.
So it looks like this in the main document class:
ActionScript Code:
public function dragKiller(e:MouseEvent):void {
// e is the MouseEvent associated with the Dragger
e.target.parent.stopDrag();
[Code].....
Now this is all mostly working fine for me. But what I want to do is say if I've previously dragged a Dragger onto a Dropper, and I remove that Dragger from the Dropper, and it returns to its home position (this currently works too). I want to remove that _dropped number reference from the Dropper.
When I initiated the _dropped variable in Dropper, I did it so there's no inital value, private var _dropped:Number; How do I remove that number value?
Currently, I'm passing a null here. Which is working, but throws a warning when I publish, and I have a feeling this is causing some bugs.
I don't want to set the _dropped value to zero, because my Dragger values are zero indexed, so I do have a Dragger with a value of zero, so that won't work.
I've tried using a negative number, but negative numbers aren't "Numbers" in AS3, which I need these to be.
how to remove a specific number value from a Number variable
I'm trying to remove an instance by name, that was previously captured when it was created. (in a property)
ActionScript Code:
trace(this._blockInstance); //returns instance name, eg "instance203"
But when i try to combine that with the removeChild method, it don't work.
ActionScript Code:
this.removeChild(getChildByName(this._blockInstance));
error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Board/boardBlockClick()
Allright, this is what my code looks like:
ActionScript Code:
public function onRequestStart(navigationEvent:NavigationEvent):void
{
playScreen = new ZombieHorde();
[Code]....
When I do removeChild on playScreen, the movieclip just becomes invisible, it doesn't actually get REMOVED. Is it possible to delete a movieclip that you've created just like that?
Is it possible to say to convert a value, 0.16, to 0.1, instead of doing the proper thing of actually rounding it up to 0.2?? Basically i just want to remove the last digit from the number value?
View 4 RepliesI'm working on a game that lets objects of the same name spawn everytime the timer triggers (Which is every 5 seconds). The objects that spawn on the stage get pushed into an array, so I can let them each fall down by using the ENTER_FRAME function. Here's a piece of the code:
Code:
timer = new Timer(5000, 6);
timer.start();
timer.addEventListener(TimerEvent.TIMER, onTime);
[code]....
trying to make a Tower Defense Engine, but I'm running into a problem. When my tower kills an enemy I used
ActionScript Code:
if(stage.contains(Enemy1)){
this.removeChild(Enemy1);}
But it seems that it dose not remove my enemy because my tower will keep attacking it, it will just be invincible, how can I fully remove it without having to use:
ActionScript Code:
this.removeEventListener(Event.ENTER_FRAME, function)