How to remove event listener when all the MoviClip are off the stage

Hi i am newbie to as3,
    I am creating animation using as3 in which i duplicate the circle ten time,then pushing into an array and giving random motion. When all the duplicate object goes outside the stage then i should remove the event listener. But right now when one duplicate object goes off the stage the event listener is removed. Thanks in advance

//---------code for creating random bubble movement------//
var bubbleNo:Number = 10;
var vx:Number = .3;
var vy:Number = .5;
var bubbles:Array = new Array();
var bubbleRadius:Number = 9;
var myColor:ColorTransform = this.transform.colorTransform;
init();
function init():void {
for(var i:Number = 0; i<bubbleNo; i++){
          var bubble = new newBall();
bubble.x = Math.random() * stage.stageWidth;
bubble.y = Math.random() * stage.stageHeight;
//bubble.color = Math.random
//trace("bubble.x=="+bubble.x+"bubble.y=="+bubble.y);
bubbles.push(bubble);
myColor.color = Math.random() * 0xFFFFFF
bubble.transform.colorTransform = myColor;
addChild(bubble);
          addEventListener(Event.ENTER_FRAME,createBubble);
//addEventListener(Event.ENTER_FRAME,createBubble);
function createBubble(event:Event):void{
for(var k:Number = bubbles.length-1; k>0; k--){
          var bubble = (newBall)(bubbles[k]);
          bubble.x += vx;
          bubble.y += vy;
          if(bubble.x - 18 > stage.stageWidth || bubble.x + 18 < 0  || bubble.y - 18 > stage.stageHeight || bubble.y + 18 < 0){
                    removeChild(bubble);
                    bubbles.splice(k, 1);
                    //trace("out"+bubbles.length);
                    if(bubbles.length <= 0 );
                              removeBubble();
                              trace(bubbles.length);
                              //removeEventListener(Event.ENTER_FRAME,createBubble)
                    trace("all Bubbles cleared");
                    function removeBubble():void{
                              removeEventListener(Event.ENTER_FRAME,createBubble)

Similar Messages

  • How to remove a dynamic symbol from the stage?

    I'm loading dynamically copies of a Library symbol with a button click. Question is, when I move around in the timeline, I don't want to see the symbols at certain points. Can I loop through the json file and remove each symbol from the stage? Or is there a better way of accomplishing this?
    Being new to Edge Animate, I'm also unsure as to the names of the symbols as they are placed on the stage. If I use the browser's developer tools, I can see that the divs are named Stage_90, Stage_91, Stage_92 etc. However doing something like the following does not seem to work:
    sym.$("Stage_90").hide();
    I appreciate the help. Thanks again.

    I got it. It should be:
    $("#region1").remove();  
    // # was missing.
    I actually added that to time 0 on the main timeline so when I got back there it removes the image.
    It's not working from the symbol yet but I guess I should eventually get it working from there instead.
    Thanks for your time.

  • HT201210 How to remove passcode lock when forgotten the passcode?

    I have just bought the new ipods for my children they have put passcode locks on them and two can't remember their passcodes. I have tried holding the power and home button together to reset the ipod but it doesnt change the ipods state. and i have also tried restoring the ios but that's not woeking either because it keeps coming up with a messsage saying it cant go any further because the ipod is locked and i need to unlock it to continue? Any Suggestions???

    Forgotten Screen-Lock Passcode
    Connect the iOS device to your computer and try to make a backup
    iOS: How to back up
    Then restore via iTunes. The iOS device will be erased. Place the iOS device in Recovery Mode if necessary to allow the restore.
    If recovery mode does not work try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up    
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store    

  • How to remove a loaded image on the stage from a symbol containing a button?

    1st the setup:
    General map is loaded
    2. On a click event, an larger image of the region is loaded with the following code (thanks to Joel's demo). On mouseover the name of the county appears and on click a popup (symbol) shows some info.
    $('<img id="region1" width="310" height="475" src="images/region1.png" usemap="#region1">'+'<map name="region1">'+...
    '<area id="Dallam" shape="rect" title="Dallam" coords="29,17,97,58"/>'+.....
    3. In the popup symbol, I want the large image map to be remove on the click event of the button: "View another region" . I have the following code which does not work (the image is not removed) resulting in what you see below:
    sym.playReverse();
    sym.getComposition().getStage().stop(0);
    sym.getComposition().getStage().getElementById("region1").remove();
    So my question is how do I remove the image (large image of the region in purple here loaded as described on 2.)?

    I got it. It should be:
    $("#region1").remove();  
    // # was missing.
    I actually added that to time 0 on the main timeline so when I got back there it removes the image.
    It's not working from the symbol yet but I guess I should eventually get it working from there instead.
    Thanks for your time.

  • Macbookpro How to remove Cookies? When go to help and clk on how to remove cookies the page is blank?

    Juno Email will not download the inbox, Juno Tech says 1st remove cookies. Mac Help has "how to remove cookies" but when clk the page is blank?

    What application are you taking about?
    Safari has the option to remove them in the privacy or security tab of the preferences. Also try 'Safari > Reset Safari' it may allow you to select an option to delete the cookies.
    I don't know what 'Juno email' is. If it is failing in a Safari you may want to try another web browser, like Google Chrome or Mozilla Firefox?

  • How can you reinstall SL on a older mini, I just upgraded to Lion .Since I downloaded it, I made a disk copy for the future  when all the kinks are work out. But would really like to go back to SL for now. I tried my reinstall disk, which didn't work.

    I have an older Mac mini  using SL as my last upgrade and really like it.. Just last week I upgraded to Lion, and do not like it,,,I would like to reinstall SL but do not know how to go about it,,,I did burn a copy of Lion and will reinstall it when all the kinks are worked out..Can someone tell me how uninstall Lion and reinstall SL.....Thx

    Downgrade Lion to Snow Leopard
    1.  Boot from your Snow Leopard Installer Disc. After the installer loads select your language and click on the Continue button.  When the menu bar appears select Disk Utility from the Utilities menu.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  SMART info will not be reported  on external drives. Otherwise, click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID then click on the OK button. Click on the Partition button and wait until the process has completed.
    4. Quit DU and return to the installer. Install Snow Leopard.
    This will erase the whole drive so be sure to backup your files if you don't have a backup already. If you have performed a TM backup using Lion be aware that you cannot restore from that backup in Snow Leopard (see below.) I suggest you make a separate backup using Carbon Copy Cloner 3.4.1.
    If you have Snow Leopard Time Machine backups, do a full system restore per #14 in Time Machine - Frequently Asked Questions.  If you have subsequent backups from Lion, you can restore newer items selectively, via the "Star Wars" display, per #15 there, but be careful; some Snow Leopard apps may not work with the Lion files.

  • Re: how can I ger rid of all the photo folders that appear when downloading photos?

    How can I get rid of all the blank, greyed out photo folder names (History???) that appear when I download photos?
    iBook, Mac OS X (10.5.8)

    Help us to help you: There are 9 different versions of iPhoto and they run on seven different versions of the Operating System. The tricks and tips for dealing with issues vary from version to version and OS to OS. So before anyone can help, they need information to work with. Basic stuff:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. What were you doing when the problem arose?
    - Did it ever work properly?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    Anything else you can think of that might allow someone else to understand your issue.
    With this kind of information somebody can develop a starting point for troubleshooting the issue.

  • How to raise mail notification when ever the new event is added to calendar list in sharepoint 2010?

    Hi experts, I need guidance or the way how we can raise mail,
    When ever the new item is added / updated / deleted / cancelled to a calendar list in SharePoint 2010.
    Shall we achieve it through using SharePoint designer 2010.
    If its help to fix the requirement.
    Thanks and Regards,
    Dhayanand Kalimidi

    >I need to send the mail before 1 week from the date
    This is different requirement. Initially you said you want send email when item is added / updated / deleted in list. For this you can use default alert to send instant email as  suggested before. 
    Now if you want to send reminder email then you can use designer WF and calculate the due date by using variable. Refer this link for your ref:
    http://mysharepointchronicles.wordpress.com/2012/11/05/sharepoint-list-with-workflow-email-reminder-set-to-send-30-days-from-created-date/
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3211ee00-92de-47f1-b611-4c9609f92ab7/how-do-i-set-sharepoint-2010-to-send-a-reminder-email-a-month-after-a-date-already-listed?forum=sharepointdevelopmentlegacy
    Remember event receiver can not send reminder email or scheduled email so for this either use designer WF or create timer job.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Hello - I am trying to sync my ipod touch with itunes and I have done many times and now today I am getting error message 13019. I have listened to all the suggestions of how to fix it from apple and now I lost all my music off my ipod. HELP?

    Hello - I have been getting error message 13019 all afternoon and I have never had that before. I have listened to all the suggestions on this site and nothing has helped. And know I have lost all the music off my ipod (luckily it is still on itunes) I really need this figured out asap since I leave on vacation in 4 days! Please somebody help. I have never had so many issues

    When you open iTunes and plug in iPhone (iPod) to computer, it appear in the left bar. Then just simply right click on you iPhone (iPod) and choose Transfer Purchases, this should copy your purchased items to your computer.
    Hope this help

  • How to add event listener?

    i want to add event listener when i click on a button in mxml, the event listener should be added in the action script file, how to do this?
    can anyone help? urgent!!!

    Hi Lakshmi,
    You can do this just put all the script in the mxml block in seperate AS file as shown below... Observe that I have included an AS file named Script.as and removed the script block form mxml and moved to this Script.as file. Place the Script.as file in your src folder ....
    // Main mxml file....
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
        <mx:Script source="Script.as"/>
    <mx:TextArea id="textArea" width="300" height="100" />
    <mx:Button id="myButton" label="Click ME"/>
    </mx:Application>
    //Script.as file
    import mx.controls.Alert;
                private function onCreationComplete():void
                 myButton.addEventListener(MouseEvent.CLICK, onButtonClick);
                private function onButtonClick(event:MouseEvent):void
                 Alert.show("Button is Clicked");
    Thanks,
    Bhasker

  • 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();

  • After an erroneous contacts delete on the mac, they've been removed from icloud and all the synced devices. I was able to restore the contacts from a backup, but since the iCloud version is newer than the backuped one, they are deleted every iCloud sync

    After an erroneous contacts delete on the mac, they've been removed from iCloud and all the synced devices.
    I was able to restore the contacts from a backup, but since the iCloud version is newer than the backuped one, they are deleted every iCloud sync.
    Now I have an iPhone with the contacts and iCloud deactivated, but I lost all the contacts on the Mac and the iPad.
    There is a way to tell iCloud "restart using the contacts I have on this device"?

    An iCloud backup will save the state of your Camera Roll at the time of the backup but, if you delete photos from the Camera Roll, they will not be in the next backup taken.
    If you are using the iCloud Photo Library (beta) read this FAQ which will tell you what happens when you delete photos from one of the devices sharing the Photo Library.
    iCloud Photo Library beta FAQ - Apple Support
    The relevant section is:
    How does iCloud delete photos and videos from iCloud Photo Library?
    Deleting a photo or video from your Photos app will also remove the item from iCloud Photo Library and from your iCloud storage allocation. Photos and videos you remove can be recovered from the Recently Deleted album for 30 days. After 30 days, your content will be removed from the Recently Deleted album. Photos are backed up on our servers for up to 30 days after they're deleted from the Photos app. If you need to recover these photos during that time, contact Apple Support.

  • How to remove my credit card from the App Store

    How to remove my credit card from the App Store

    I used a pre-loaded credit card so when it ran out i had problems, primarily because it wont let me download or update anything until the "billing problem with the last transaction" was resolved. I dont really care if the purchase goes through but i want to be able to update stuff again and it wont give me the option to select 'none' under payment type. do i have to put another card on there just so i can "resolve the billing problem" and then i have  to take it off again or is there a way around this or is it a never ending cycle?

  • How to hide system tables when using the Oracle SQL Developer?

    Hi,
    I would like to know how can I show only the tables that I created under the Tables tree? I didnt find a way to create a separate database using the Oracle Sql Developer. I see all the tables together, and would like to differentiate between different databases.
    Can anyone explain to me how to do these things?
    Thanks,

    Hi,
    I would like to know how can I show only the tables that I created under the Tables tree? Your posting is not clear,again tell something more on tables tree,what u want to achieve with it.
    How to hide system tables when using the Oracle SQL Developer? if u connected with sys, system or user with dba role then u have a privilege to see these tables,so revoke the privilege/role from ur user to view this tables if ur connected other then sys,system,
    I didnt find a way to create a separate database using the Oracle Sql Developer. DBCA is a tool for creating the new database.
    Kuljeet

  • HT201359 how can i find out what all the charges on my checking account are for?

    how can i find out what all the charges on my checking account are for?

    If you log into your account on your computer's iTunes via the Store > View Account menu option, you should then see a Purchase History section with a 'see all' link to the right of it. Click on that and you should then see a list of your purchases - the most recent purchase is above the list. I'm not sure if that shows auto-renewing subscriptions (I don't have any so I can't check).
    If you can't find the charges and you haven't added or changed your card details on your account (when you do then a small temporary store holding charge may be applied to check that the details are correct and valid, which should disappear within a few days) then you can contact iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • Place Image Error

    I've created a script that grabs a JPG, places it so I can get the dimensions, then creates a batch file for some other software to make it into a TIF packshot. I then place the TIF in place of the JPG (I know that this could be more streamlined). It

  • Help with sharing files

    I have a iMac (very recently) and just got a macbook. I am writing. I want to be able to work on the same thing from either computer. I clicked on sharing in system preferences and clicked file sharing and printer sharing. I read instructions but I m

  • Picture upside down

    No serious problems with installation of Windows 7 or Video display setting. The only frustrating issue is the upside down with Skype and EasyCapture. I have not been able to locate drivers for camera or i am i missing something Any help.

  • How to pass values from single Databank file across different scripts?

    Hi Guys, I have a question regarding using single databank file across different scripts. Lets say there 5 web service scripts and these are very generic scripts where the input/request xml schema of each script is parameterized without having any da

  • Event viewer

    When I first install windows 8.1 I was able to type "event viewer" in the metro search and start it there.  Now when I do it it just gives link to descriptions of what it is. Did MS take that out now. The only way I can get to it now is a search from