Remove or hide MC from stage

hey, im trying to remove these movie clips from the stage but its not  working. Im spawning the movie clip to the stage every time i slide the  timeline_slider, which is instance name for a slider component.
I manage to put the spawned movie clip in a array using push, but i don't know how to delete them.
Because what i want to happen is that every time i slide the slider i  only want a certain amount of movie clips on the stage, but what is  happening is they spawn on the stage and stay there.
for example. if i slide 1 across it spawns 5 mc if i slide again to the  second increment it spawn 4 so total number on movie clips on the stage  is 9.
i want to only spawn the number of movie clips that increment on the  slider is set to. i would also like it to work backwards as well, so if  im on the second increment it should have 4 movie clips on the stage,  and if i go back to the first increment i should only have 5 movie clips  on the stage.
hope that makes sense
Even just hiding the movie clips and unhiding the movie clips is fine as well.
this is my code for spawning with the slider
this is my arrays of the numbers are now many movie clips i want to spawn to the stage.
Code:
var rdCounts:Array = [5516 / 1000,5517 / 1000,5570 / 1000,5585 / 1000,5596 / 1000,5656 / 1000,5804 / 1000,5965 / 1000,8692 / 1000,15194 / 1000,16475 / 1000];
          var NewAuspop:Array= new Array();
Code:
timeline_slider.addEventListener(SliderEvent.CHANGE, dotspawn);
function dotspawn(e:SliderEvent)
               var theAmount:int = rdCounts[timeline_slider.value];
               for (var i:int = 0; i < theAmount; ++i)
                    var rd = new red_dot();
                    addChild( rd );
                    NewAuspop.push( rd );
                    trace(NewAuspop);
                    rd.x = square_mc.x + Math.random() * square_mc.width;
                    rd.y = square_mc.y + Math.random() * square_mc.height;
                    var myTween:Tween = new Tween(rd,"x",Elastic.easeOut,square_mc.x,square_mc.x + Math.random() * square_mc.width,3,true);

Try this for re-tweening (I don't try this code - so I don't have visual reference and you need to fine-tune it yourself):
function dotspawn(e:SliderEvent)
     var theAmount:int = 0;
     for (var i:int = 0; i < timeline_slider.value; i++ ) {
          theAmount += rdCounts[timeline_slider.value];
     // remove unneeded objects
     while (NewAuspop.length >= theAmount) {
          // remove first element from display list
          removeChild(NewAuspop[0]);
          // remove first element from array
          NewAuspop.shift();
     var rd:red_dot;
     // add objects if array is short of the Amount
     while (NewAuspop.length < theAmount) {
          rd = new red_dot();
          addChild( rd );
          NewAuspop.push( rd );
          trace(NewAuspop);
     for each(rd in NewAuspop) {
          rd.x = square_mc.x + Math.random() * square_mc.width;
          rd.y = square_mc.y + Math.random() * square_mc.height;
          var myTween:Tween = new Tween(rd,"x",Elastic.easeOut,square_mc.x,square_mc.x + Math.random() * square_mc.width,3,true);
Message was edited by: Andrei1

Similar Messages

  • How to effectively remove a loaded SWF from the stage?

    I can not figure out a proper coding to remove a loded SWF from the stage.
    Here is my set up.
    I have a layout segmented into labeled section. In the section labeled "products" I have a layout consisting of product images acting as buttons which bring a user to another labeled section "prdctsPopUps"
    In the "prdctsPopUps" section I have placed an instance of LoaderMax placed into an mc container. Placing LoaderMax into an mc container automatically resolved an issue of clearing loaded SWFs from stage when I come back to "products" section.
    I specified the variable in the "products" section with the following set up:
    var sourceVar_ProductsPopUps:String;
    function onClickSumix1PopUp(event:MouseEvent):void {
                        sourceVar_ProductsPopUps="prdcts_popups/sumix1-popup_tl.swf";
                        gotoAndPlay("prdctsPopUps");
    So each button has its own "....swf" URL and they all open fine and I can come back to "products" section without any issues.
    However inside the swf (which loads through LoaderMax which is placed into an mc) there are other buttons which bring a user to labeled section "xyz". Which also functions properly. It opens as it is supposed to be and without any previously loaded "...swf" on the stage.
    At the labeled section "xyz" there is a limited set of buttons repeating from section "products" which has to bring a user back to the same set up in the "prdctsPopUps" labeled section and open a corresponding "...swf" .
    However only the last opened "...swf" will appear in that section. Effectively the one which was originally opened from the "prdctsPopUps" section and not the one which was supposed to be opened from the "xyz" section.
    I can not understand why it would work from one labeled section and not from another. I can not figure out on which section which code/function needed to be placed.
    Here is the set up from a button from the "xyz" section whcih supposed to bring a user to the same "prdctsPopUps" section but to load a different "...swf"
    var sourceVar_ProductsPopUps_fromXYZ:String;
    function onClick_floralytePopUp_fromXYZ(event:MouseEvent) :void {
                        sourceVar_ProductsPopUps_fromXYZ="prdcts_popups/floralyte-popup_tl.swf";
                        gotoAndPlay("prdctsPopUps");
    Here is the code set up for the LoaderMax from the "prdctsPopUps" section:
    var loaderProductPopUps:SWFLoader = new SWFLoader(sourceVar_ProductsPopUps,
                                                                                                        estimatedBytes:5000,
                                                                                                        container:holderMovieClip,
                                                                                                        onProgress:progressHandler,
                                                                                                        onComplete:completeHandler,
                                                                                                        centerRegistration:true,
                                                                                                        alpha:1,
                                                                                                        scaleMode:"none",
                                                                                                        width:540,
                                                                                                        height:730,
                                                                                                        crop:true,
                                                                                                        autoPlay:false
    function progressHandler(event:LoaderEvent):void{
              progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
    function completeHandler(event:LoaderEvent):void{
              var loadedImage:ContentDisplay = event.target.content;
              TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
    loaderProductPopUps.load();
    Is there something which needs to be imported, or specific function needs to be specified in a specific labeled section?

    actually, i think you'll need to use something like:
    var loaderProductPopUps:SWFLoader;
    if ((loaderProductPopUps){
    if(loaderProductPopUps.content)){
       loaderProductPopUps.unload();
    loaderProductPopUps= new SWFLoader(sourceVar_ProductsPopUps, //the value of sourceVar_ProductsPopUps allows to load mulitple SWFs from the products page.
                                                                                                         estimatedBytes:5000 ,
                                                                                                         container:holderMov ieClip,// more convinient and easier to manage if to place the LoaderMax into an empty mc (holderMovieClip)
                                                                                                                                                                         // if not will work as well. Then the line container:holderMovieClip, has to be replaced with container:this,
                                                                                                                                                                         // can be any size, can not be scaled as it distorts the content
                                                                                                         onProgress:progress Handler,
                                                                                                         onComplete:complete Handler,
                                                                                                         centerRegistration: true,
                                                                                                         //x:-260, y:-320, //no need for this is if used: centerRegistration:true,
                                                                                                         alpha:1,
                                                                                                         scaleMode:"none",
                                                                                                         //scaleX:0, scaleY:0,
                                                                                                         //vAlign:"top",
                                                                                                         width:540,
                                                                                                         height:730,//scales proportionally but I need to cut off the edges
                                                                                                         crop:true,
                                                                                                         autoPlay:false
    function progressHandler(event:LoaderEvent):void{
              progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
    function completeHandler(event:LoaderEvent):void{
              var loadedImage:ContentDisplay = event.target.content;
              //TweenMax.to(loadedImage, 1.5, {alpha:1, scaleX:1, scaleY:1});//only need this line if corresponding values are changed in SWF loader constructor
              TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
    loaderProductPopUps.load();

  • FlipTransition raises "Removed from Stage Event" on new view

    hello,
    I Have a problem with a fliptransistion. If I use this transition in my main view to go to a "settings" view. The "removed from stage" event is raised for the settings view (yes the settings view).
    So first the "initialize" of the settings view is executed. In this initialize I hook up some event listeners.
    Than the "removed from stage" of the settings view is executed. In this function I remove the event listeners (I think this is a good thing to do).
    Than the "removed from stage" of the settings view is executed again
    So the event listeners never work.
    The code for the transition is nothing special I think
    var ftrans:FlipViewTransition = new FlipViewTransition();
    ftrans.duration =1000;
    navigator.pushView(SettingsView, data, null, ftrans);
    When I use the default transition "navigator.pushView(SettingsView, data)" the problem does not occur.
    Anybody an idea as to how to solve this (I'd prefer to keep the fliptransition, as the default slide transition is used in another part the application, and the flip indicates to the user that he is doing something different).
    Update: I've tried to move the event listeners to the "added-to-stage" phase but this doesn't quite solve the problem the events that occur on the SettingsView are: (in that order!)
    - Added To Stage
    - Initialize (this is bizar the view is added to stage even before it is initialized).
    - Removed From Stage
    - Added To Stage
    - Removed From Stage
    - Added To Stage
    Message was edited by: NilsTT

    The FlipViewTransition effect does some reparenting internally to accomplish the 3D effect.  As a result you receive multiple add and remove events.  To work around this, I would recommend using FlexEvent.ADD and FlexEvent.REMOVE instead of addedToStage.  You can also try using ViewNavigatorEvent.REMOVING.
    Chiedo

  • How do I delete/hide songs from iTunes Match? (More info inside)

    How do I delete/hide songs from iTunes Match? When I mark them, and delete them (and yes, I mark the box where it says delete from the cloud as well), they just reappear once I sync with itunes match again. (the symbol available for download appears). Is there a way to completely remove the tracks?
    (And no, I don't just want to hide them (in the menu), since the tracks will appear in my iPhone anyways).

    Hey imol92,
    You may have already looked at this; http://support.apple.com/kb/ht4915
    It is all the public information on removing songs that you have uploaded to the iTunes Cloud.

  • TS1702 I need to remove one unwanted application from my account totally ( iCloud & Ipad). As my ipad will be handled by my kids Ido not want them to see. Please help me to remove my purchase. thanks.

    I need to remove one purchased app from my iCloud and ipad. Needs  solution
    immediately.

    You cannot delete past purchases from your iTunes account. You should delete it from your iPad and then use Restrictions to stop kids from downloading without the pass code. See http://support.apple.com/kb/ht4213
    You can also hide things from your iTunes account by following these steps http://support.apple.com/kb/HT4919

  • Is it possible to remove the 'soap12' namespace from the WSDL for basicHttpBinding endpoints (i.e soap 1.1 clients)?

    Hello,
    We want to import the WSDL from a running WCF service endpoint (which is using basic HTTP binding) in order to implement the same web service interface in a Lotus Notes application. Unfortunately the proxy generator for Lotus Notes doesn't like the particular dialect of WSDL that our WCF service is exposing, in particular it throws a wobbly when it sees
    xmlns:soap12=http://schemas.xmlsoap.org/wsdl/soap12/.
    Even though soap1.2 isn't being used, the basic http binding is leaving this reference in the wsdl and Lotus Notes seems to think this is a SOAP 1.2 WSDL file even though I know it's a SOAP 1.1 compatible file.
    In order to get around this I'm using disco.exe to pull the wsdl files down locally, manually edit the files to remove this unused name space and then edit all the schema import locations to convert lines such as http://localhost:7780/MEX?xsd=xsd0 to lines such as file://\wsdl\MEX.xsd etc...
    Is there a simple setting somewhere that will remove that 'soap12' fragment from the wsdl? It's a bit of a pain because we are in a development phase and so the WSDL isn't completely stable at the moment and is changing frequently which requires this manual editing stage.
    Thanks
    Paul.

    The following method works correctly for me:
    public class Soap11WsdlExporter : WsdlExporter
        public override MetadataSet GetGeneratedMetadata()
            var metadataSet = base.GetGeneratedMetadata();
            foreach (var metadataSection in metadataSet.MetadataSections)
                var description = metadataSection.Metadata as System.Web.Services.Description.ServiceDescription;
                if (description != null)
                    var namespaces = description.Namespaces.ToArray();
                    var newNamespaces = new XmlSerializerNamespaces();
                    foreach (var ns in namespaces)
                        if (ns.Name.ToLower() != "soap12")
                            newNamespaces.Add(ns.Name, ns.Namespace);
                    description.Namespaces = newNamespaces;
            return metadataSet;
    public class MyServiceHostFactory : ServiceHostFactory
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            ServiceHost serviceHost = new ServiceHost(serviceType, baseAddresses);
            var useSoap11 = true;
            //We only removing SOAP12 namespace only if all the bindings use SOAP11.
            foreach(var endPoint in serviceHost.Description.Endpoints)
                useSoap11 &= endPoint.Binding.MessageVersion.Envelope == EnvelopeVersion.Soap11;
            if (useSoap11)
                var behavior = serviceHost.Description.Behaviors.Find<ServiceMetadataBehavior>();
                if (behavior != null)
                    behavior.MetadataExporter = new Soap11WsdlExporter();
            return serviceHost;
    Hope this helps
    Another Paradigm Shift
    http://shevaspace.blogspot.com

  • How can I remove my email address from the lock screen?

    How do I remove my email address from the lock screen? My dad bought me a new laptop after mine was stolen from my house on New Year's Eve. I'm a little tighter on my security now and when I turn on my laptop the lock screen shows me my name and my email
    address. If my laptop gets stolen again, I don't want my email address to be displayed for someone to use or sell as I'm extremely picky about what I'm giving out my email for. If there isn't a way to hide my email address, I'm going to demand a "downgrade"
    from this Windows 8 s**t and back to the more user-friendly and less confusing Windows 7. (And for the record, I hate Windows 8. With a passion.)

    Hello,
    The TechNet Wiki Forum is a place for the TechNet Wiki Community to engage, question, organize, debate, help, influence and foster the TechNet Wiki content, platform and Community.
    Please note that this forum exists to discuss TechNet Wiki as a technology/application.
    As it's off-topic here, I am moving the question to the
    Where is the forum for... forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?&lt;=\G.{2})'|%{if($_){[char][int]&quot;0x$_&quot;}})

  • How do I do to add and remove Shape3D objects dynamically from TransfGroup?

    Hi, everyone,
    How do I do to add and remove Shape3D objects dynamically from TransformGroup?
    I have added two Shape3D objects in the TransformGroup and I wanted to remove one of it to add another. But, the following exception occurs when I try to use �removeChild� :
    �Exception in thread "AWT-EventQueue-0" javax.media.j3d.RestrictedAccessException: Group: only a BranchGroup node may be removed at javax.media.j3d.Group.removeChild(Group.java:345)�.
    Why can I add Shape3D objects and I can�t remove them? Do I need to add Shape3D object in the BranchGroup and work only with the BranchGroup? If I do, I think this isn�t a good solution for the scene graph, because for each Shape3D object I will always have to use an associated BranchGroup.
    Below, following the code:
    // The constructor �
    Shape3D shapeA = new Shape3D(geometry, appearance);
    shapeA.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
    shapeA.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
    shapeA.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    shapeA.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
    Shape3D shapeB = new Shape3D(geometry, appearance);
    shapeB.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
    shapeB.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
    shapeB.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    shapeB.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
    BranchGroup bg = new BranchGroup();
    bg.setCapability(ALLOW_CHILDREN_READ);
    bg.setCapability(ALLOW_CHILDREN_WRITE);
    bg.setCapability(ALLOW_CHILDREN_EXTEND);
    TransformGroup tg = new TransformGroup();
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    tg.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
    tg.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
    bg.addChild(tg);
    tg.addChild(shapeA);
    tg.addChild(shapeB);
    // The method that removes the shapeB and adds a new shapeC �
    Shape3D shapeC = new Shape3D(geometry, appearance);
    shapeC.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
    shapeC.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
    shapeC.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    shapeC.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
    tg.removeChild(shapeB);
    tg.addChild(shapeC);Thanks a lot.
    aads

    �Exception in thread "AWT-EventQueue-0"
    javax.media.j3d.RestrictedAccessException: Group:
    only a BranchGroup node may be removed I would think that this would give you your answer -
    Put a branch group between the transform and the shape. Then it can be removed.
    Another thing you could try: This doesn't actually remove the shape, but at least causes it to hide. If you set the capabilities, I think you can write the appearance of the shapes. So, when you want to remove one of them, write an invisible appearance to it.

  • How do I remove iCloud music function from iPhone?

    How do I remove iCloud music function from iPhone?

    Thanks, operative word here is hide.
    iTunes wants to keep music on the iPhone even after you want to clear it out and start over. I wish they had a "flush" function. At present after wiping it basically clean, down to one album, then checking the fill option, iTunes fills up the iphone with the same albums I just got rid of... I have a huge selection in my library to choose from. But it keeps returning to the same albums even though I have not checked them or artist. Frustrating.

  • MovieClip disappears from stage when printing

    Hi,
    I am printing a parent moviclip which is on stage and has many child movieClips with linked classes having all single frames.When I try to print by passing it to printObject which is in external class few things happend as:
    1. the object is printed but moviclip is removed from stage
    2. also the dynamic text labels are not printed
    3.the size is smaller than the original.
    how to get to resovle these issues to obtain good print out from flash cs5 using AS
    Any help is appreciated
    srini

    the only way i know to obtain pixel-perfect printing is to instantiate your printjob and using its pageWidth and pageHeight properties, (re)construct the pages you want printed, print and finally ready the no-longer-needed newly constructed pages for gc.

  • Is there a way to remove the command R from opening my media browser?

    I use command + t quite often when I am adjusting a track to sync with my drums, and once in a while I will accidentally click the command + R, which opens up my media browser.  This little accident ALWAYS takes about 20 - 30 seconds to open, which would be fine once in a while, but once this happens the first time Garageband always takes a lot longer to respond to my editing until I restart the program, which is a huge hassle when I am on a roll.  I would just like to remove the key command from allowing this to happen, if there is some way to do this I would be very happy to know how to get this taken care of.
    Thanks!
    Erik

    Brilliant, HangTime! I missed that menu - I was looking in the "Windows" menu.
    This works:
    I added "GarageBand.app" to the "Application Shortcut" section (press "+") and added new shortcuts ⇧⌘R to Show Media Browser and Hide Media Browser.
    Now the ⌘R  does not do anything any longer
    (You have to log off and on, or to force quit the Finder and restart GarageBand for the changes to take effect! )
    Now it is "⇧⌘R"  - you can use any key combination you like instead.

  • How to remove the open applications from right side of the dock?

    How do I remove the open apps from the right of the line on the dock? They are by the Trash. I will attach an image. I don't want them to show up over there when I have an app open.

    In previous versions of Mac OS X, any window containing an open application that was reduced in size was put in the Dock and looked like those in the image. So if you reduced any open page while in an application, that would be as you see, there. Or if you chose to 'hide' an open application it'd go there.
    You should be able to click once on each of those and have the full page restored in the screen. If there is anything on those pages you want to save, do so and the file would be saved in your Documents or other folder of your choosing.
    Good luck & happy computing!

  • How to Remove the Captivate Runtime from bottom of TOC?

    Hello,
    Is there a way to remove or hide the default total running time that appear at the bottom of the TOC in Captivate 5?
    Thank You

    Hello
    Download Hide TOC TotalDuration Widget from the link mentioned below
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=2258529
    Hope it helps
    thanks
    VJ

  • Want to remove unwanted free apps from app store forever

    want to remove unwanted free apps from app store forever how can I do this please

    15d wrote:
    want to remove unwanted free apps from app store forever how can I do this please
    Well, it should be obvious that you cannot remove apps from the App Store, so I'll assume that not what you actually mean. In addition you cannot remove apps or any iTunes purchased content from your AppleID. You can hide purchases, but that can only be done from iTunes on a computer.

  • HT201322 Will hiding songs hide them from all computers? Is there a way to delete a song off one computer but not the other?

    My mom & I share the same iTunes account and we finally have seperate computers. If i hide songs from iCloud on my computer will it also hide them on her's? If it does, is there anyway i can hide/delete some songs off my computer but keep them on her computer because I don't want her music on my compute but i don't want to repurchase everything i have....

    Try restoring your iPod. Restoring will erase the iPod's hard drive, reload the software and put it back to default settings. it won't remove anything from your iTunes library. Once the restore is complete follow the on screen instructions to name the iPod and automatically sync your songs and videos onto the fresh installation. Press Done and the iPod will appear in iTunes and start to sync. If you want to update manually or using selected playlists uncheck the box beside the sync automatically instruction and press Done, it will default to manual mode and you can choose whatever setting you like: Restoring iPod to factory settings with iTunes 7

Maybe you are looking for

  • SAP BW 3.5 - Upgrade support package from 18 to 21

    Hi All, We are planning to apply the SP 21 for SAP BW 3.5 system. Currently we are on SP 18. We had created a Customer message to SAP regarding the Pre-Preparatory Steps before applying  and Post upgrade steps . But the reply we got is  quite confusi

  • Call failed constantly after upgrade to OS 4.2

    Has anyone else suffering the same problem? My iPhone 4 just keeps failing to make a call after upgrading to OS 4.2. The strange thing is that it seems this just happens within vodafone's 2G network. If I turn 3G on, there is no problem with call fai

  • Audio Components Mix disappear after update to 10.1 – rescue my work?

    Dear community, after updating on 10.1 we are missing an essential feature. Hundreds of episodes have an audiomix within the three stereo audio components (expand audio components) audio1 = main voice, commentary (stereo) audio2 = foley / SFX / etc.

  • How to display webdynpro view data in PDF format.

    Dear All, Greetings!!! scenario : i am having five tabstrips  in a table , first four for the different kinds of data and fifth one is for to display all tabstrips data in a PDF format. Kindly let me know how to acheive this . is it possible with out

  • How to make excel export in jsp

    Hi All, I have a jsp page to display a table. I want to add a "excel download" button in this page, once user click this button, it will invoke the microsoft excel and all table content will appear in the excel spreadsheet. I tried to set the content