Flash :: Can't Remove All Loaded Children In A Gallery Because Can't Close() A Loader?
Jun 15, 2011
My problems comes in when you have to open a different image album and have to eliminate all the previously loaded children in the movieclip. When i load a new album i used a code you posted here: AS3 How to remove previous loadersbut the problem is that sometimes the user leaves the album page before ALL the pics laod so when they click on a new album to open it a new image is placed somewhere else cause the loader has already been launched. I've tryd to close() the loader but it doesn't seem to work.Here you can see the working site to see what im talking abouy you have to click on an album, leave before all the pictures load and open up another one.
getImage(dataList[0].file)
function getImage(href:String):void {
var loader:Loader = new Loader();
This is the code i used in a gallery that loads images sequentally. My problems comes in when you have to open a different image album and have to eliminate all the previously loaded children in the movieclip. The problem is that sometimes the user leaves the album page before ALL the pics laod so when they click on a new album to open it a new image is placed somewhere else cause the loader has already been launched. I've tryd to close() the loader but it doesn't seem to work. Here you can see the working site www.barbarabritvin.com (to see what im talking about you have to click on an album, leave before all the pictures load and open up another one.
getImage(dataList[0].file) function getImage(href:String):void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, imageReady);
i successfully managed to work out the loader script, and load a external swf file into my current project. Now that its working and all is well, i realised that only way to get back to 'main menu' was to close the whole thing. I tried to sort it out with a simple 'back' button but no success there. As mentioned in the title thats the options i found so far but cant seem to quite understand them tbh. I just want it to work so that I easily can manouvre back to 'main menu'.
Using ActionScript can I do with my game, which is running in a browser, verify that the user already has the files needed to run the game installed on your computer? If he had these files do not need anything else that was born and can play the game immediately. If he did not have the files, they would be loaded so that the browser does not erase these files. So when he returned to play the same game day after,as the files already on your computer, nothing need be loaded.How do I remove one of the main memory image that was loaded using the Loader class? I tried using the unload () method but nothing happened.
How to remove a loader and its content using removeChild or any other way, I had removed the loader but its content still playing in the background i know that from the sound of the content.this is the my code for removing:
Isn't there a simple "remove all children" function in flash? I don't understand why this code isn't working. I add children via: for (var i in project_array[cp].project_type_clips){ container.header.type_loader.addChildAt(project_array[cp].project_type_clips[i],i); loadCount++ }
And then remove them via: for (var i in project_array[cp].project_type_clips){ container.header.type_loader.removeChildAt(i); }
But I get an error that the supplied index is out of bounds, and yet one clip is still left on stage. Likewise, if I try to add them without levels, like this: for (var i in project_array[cp].project_type_clips){ container.header.type_loader.addChild(project_array[cp].project_type_clips[i]); loadCount++ }
And remove: for (var i in project_array[cp].project_type_clips){ container.header.type_loader.removeChild(project_array[cp].project_type_clips[i]); } I get the same error.
Just wondered if I remove a parent movieclip and then set it to null, will it remove all the child movieclips within it from the Display list and also from memory, or do I need to iterate through the parent movieclip removing all its children before removing the parent?
I've got a little problem: I made a preloader class that features a stopLoadProcess() method that simply calls Loader.close(). Well, it does work, but in Safari, after calling it, I have an error: Safari complains that 'there was an error loading 'that asset''' (something similar). In other words, Loader.close() in fact works in all browsers, in Safari too, but Safari also throws that error when calling the method.
Does Loader.close() stops loading at once, or it continues loading certain number of chunks before stopping? Is it viable to run concurrent loading process in the background and then stop it abruptly (or even pause if possible) if user needs something else loaded immediately? And what about loading of other types of external content?
I'm working on my portfolio, and I'm having a bit of trouble. I'm loading a custom made video player SWF into my main SWF, and it works well so far, but the NETSTREAM doesn't close when I remove the child after I return to the main menu, and the audio keeps going.
I'm running into some problems using the close() method.I'm trying to build a class that checks a resource size before loading it.it's very simple: I use the Loader class to load the resource, listens to the first progress event and immediately closes the connection with the Loader.close() method.However, the close() doesn't seem to stop the Loader after the first progress event dispatched.here is a quick copy & paste frame code just to demonstrate my point:
I want to end any previous data loading progresses.. But I can't manage to do this. I tried lots of things (as you can see couple of them below), but it just can't stop downloading of images. I click to first gallery button, it starts to download thumbs and the first picture. Then I click to second gallery button and it adds more download progress to the previous ones.. (Every gallery has 4 thumb, this way every click adds 4 thumb and 1 picture. It's download count grows 5+5+5 to infinite) This code is from my thumb class.. Every thumb downloads it's own little image..
I'm trying to figure out how to remove the 'next_bttn_mc" in the kirupa flash / xml gallery if it there is no photo left to load into the movie (it reaches the end of the images..no more to load)Also, would like the previous_bttn_mc to be invisible on the first photo.Thought about trying to do this as an additional node, with one variable = next_bttn_mc _alpha="0" and another where it equals 100.[code]
I'm loading an image into a container. The container is simply a loader object with a progress event listener and a complete event listener. It is loaded when a thumb is clicked in the gallery and it displays the image larger.Basically it is possible to interrupt the loading process of the current load stream and load something else by clicking another thumb in the gallery before it's complete.
If you call loader.close() when nothing is loading, Flash will call back an error saying that there is no stream attached to the loader object.Is there a way to test if the loader object is presently loading, and if so to close it?
adding all the bricks of another movie clip into an array in my controlling mc (GameScreen). Except, when I try to remove them from the display list by accessing them from their array, I get
Quote:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller at flash.display:isplayObjectContainer/removeChild()...and so on
I'm guessing it's something to do with adding another movie clip's children into an array in a movieclip that isn't the stored clips' direct parent, but it's parent's parent.
Code: private function checkBrickHit():void{ for(var i:int=0;i<brickArray.length;i++){
Well I'm starting to really enjoy AS3, my next question then is this: In AS2 I'd often remove all movieclips with something like this: PHP Code: for(var i: String in container) { container[i].removeMovieClip(); } Is there something similar in AS3 that I can do without resorting to maintaining an array of references to each child of my container?
I have a menu that is a type of wave, thus I'm using Flash, not HTML. My issue is that I have a bevel on that wave, but that bevel extends onto the text that is a child of the MC that has the bevel. Is there any way that I can remove the bevel from the text (Or technically shapes since they were imported from IL) without removing it from the entire element?
And yes, I've tried this.filters=[];
Also, I can't keep everything one shape in the MC, because I have hover attributes.
I have a dragable gallery of images separated with "contentSpacer". I'm trying to make each image "snap" when it is close to the centre. I've modified this [URL] and got it working, to a point. My problem is the x value that the gallery being snapped to needs to have "contentSpacer" subtracted from it: if its the third image in the sequence then it need to have ("contentSpacer" * 3) subtracted from it (as there is three gaps between the start of the gallery andthe end of the third image, get it?). In the code below I've put (proximity - (contentSpacer * j)) but "j" does not exist right now, you see what I'm getting at? The code doesn't seem to be aware what image it is snapping.
trying to remove instances of child/children. I have a function (btFnc) that creates a child (bT) and then the function is called several times to add instances to the stage - btFnc(264,3.6); btFnc(304,4.6); btFnc(344,5.6); btFnc(384,6.6); btFnc(424,7.6);Yet i cannot for the life of me remove all of the children, only 1.
Code: public class screen18 extends MovieClip { private var scrnXMLLoader:XMLLoader;//XML Loading class private var screenTxt:Array;
i have an ary contain a numbers of information as below
var ary:Array = new Array();var temp:Array;
var box_mc:Box; // this is a movieclip which contain dynamic text box inside.
// assume inside the array have 9 itemName
on the stage i got an empty empty movieclip and i add child from the array on it..
[Code]...
Problem:I could delete the item everytime i clicked on the remove button but it appears a gap/space between it. I want to push all remaining box_mc at the bottom up after i remove 1. It only push up when i come back to this page after i navigate to some other page. Does anyone know how to implement this ? P.S. i tried using enterframe and i failed, probally the way i did was wrong or watever.
I want to destroy/remove all the children of an object including grandchildren of those children and so on.
I was thinking of using a recursive loop along the lines "if you have children, check if they have children, if they do, check if THEY have children and so on until they have no children and if so removeChildAt(0) of the parent you last checked.
ActionScript Code: obj0 |-obj1 |-obj2
[Code]......
A quick second question, we all know that event listeners should be removed when no longer needed but I was wondering about the event.COMPLETE listener for loading say XML or a video file or any loader object. Is there any point removing that listener of is it in effect dead anyway because it has triggered when "COMPLETE" and won't ever trigger again? Isn't it still "listening"?
I have a set of swfs that open one on top of the previous as buttons are pressed. Thing is, once you've pressed buttons so many times that there are a ton of swfs on top of one another, the browser begins to run slower.
Is there anyway to remove all the swfs under the current swf in the code without disrupting the running of the current swf?
i want to do is to remove all the children (ninge) added with Timer when the user rolls out the mouse. The ideea is when the user moves his mouse over the movieclip it begins to snow and when it moves away i want all the snow to disappear.
ActionScript Code: rama2_mc.addEventListener(MouseEvent.MOUSE_OVER, rama2); function rama2(event:MouseEvent):void {