REMOVED_FROM_STAGE

Does the Spark Resize effect cause the object to be resized being removed from Stage?
Thanks

No reason in particular, when I created the class, FlashBuilder put it in there (I'm using Flash Pro CS5 + Flash Builder 4). I read that it calls it by default when the class is constructed, so having it in or out didn't really matter. I did comment it out with no luck, but I ended up shifting around the timeline quite a bit today and the problem has gone away. It seemed to only do it when it was in the first frame.
Thanks for your help, I'm going to investigate it further when I have time just for reference, I'll post anything I find here.
-Nick

Similar Messages

  • REMOVED_FROM_STAGE Being Called on Instantiation

    Hello,
    I've got an interesting predicament here.  I've got a MovieClip called GameOptions, and within that MovieClip, there's is another MovieClip called DifficultyButtons which subclasses RadioGroup.  DifficultyButtons contains a few MovieClips called Easy Medium and Hard which are all subclassing RadioButton.  While GameOptions is being added through addChild(), the child clips are all part of GameOptions built in Flash. So this is my structure:
    GameOptions
    -- DifficultyButtons
    -- -- Easy
    -- -- Medium
    -- -- Hard
    Now I have an event listener listening for REMOVED_FROM_STAGE in the RadioGroup and RadioButton classes.  For some reason, REMOVED_FROM_STAGE is being called immediately on instantiation. Here's a (stripped down for readability's sake) version of RadioGroup:
    package radiobuttons
         import flash.display.MovieClip;
         import flash.events.Event;
         import flash.events.MouseEvent;
         public class RadioGroup extends MovieClip
              public function RadioGroup()
                   addEventListener(Event.ADDED_TO_STAGE, addedToStage);
              protected function addedToStage(e:Event):void
                   removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
                   addEventListener(Event.REMOVED_FROM_STAGE, removedFromStage, false, 0, true);
                   addEventListener(MouseEvent.MOUSE_UP, processClick);
              protected function processClick(e:MouseEvent):void
                   trace("Click: " + e.target);
              protected function removedFromStage(e:Event):void
                   trace("Removed: " + e.target);
                   removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStage);
                   removeEventListener(MouseEvent.MOUSE_UP, processClick);
    So why is it that removedFromStage is being called instantly?  The clip is still there on the stage, and if I remove the event listener for REMOVED_FROM_STAGE, everything functions fine.
    Also, when removedFromStage is called, it traces "Removed: [object DifficultyButtons]".
    Is this because I'm not adding these clips through code, as opposed to how its done now where it's prebuilt in flash?  Or is this some weirdness with me sublcassing something directly in the flash library's Export for ActionScript panel?
    ps; this has nothing to do with useCapture as I've tried both.
    pps; this is happening on both the DifficultyButtons and Easy/Medium/Hard.
    Thanks!

    So doing some more debugging, DifficultyButtons is the target and currentTarget of the REMOVED_FROM_STAGE event, and the EventPhase for this event is AT_TARGET.  So it's definitely this class doing this.
    Also, I tried removing the DifficultyButtons from its parent movie clip and adding it through addchild in the parent clip and still am receiving the same problem!\
    edit: More trying to figure this out.  I removed all references to any additional objects from GameOptions.  So now my document class is doing one thing and one thing only: addChild(new GameOptions());
    My GameOptions has only this code:
    package hud
         import flash.display.MovieClip;
         import flash.events.Event;
         public class GameOptions extends MovieClip
              public function GameOptions()
                   addEventListener(Event.ADDED_TO_STAGE, addedToStage);
              protected function addedToStage(e:Event):void
                   addEventListener(Event.REMOVED_FROM_STAGE, removedFromStage);
              protected function removedFromStage(e:Event):void
                   trace("I'm a game options" + this);
    And, as expected, it IS tracing the trace in removedFromStage.
    So... am I completely confused by the point of REMOVED_FROM_STAGE??

  • REMOVED_FROM_STAGE event firing when it shouldn't...

    Hello everyone,
    Wondering if someone has seen this before. I have an application that has a few navigation points on the main timeline. The document class stops the movie at the first frame, and the "home" movieclip's class has Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE listeners on it. Funny thing is, it is calling the ADDED function as normal, then firing the REMOVED function immediately after. However, when I run it, it doesn't actually remove the movieclip from the stage. It is still there. When I navigate to a different section ("remote" or "assist") and navigate back to "home", it doesn't fire a second time, everything works properly after the first time.
    So I guess my question is, what would fire the REMOVED_FROM_STAGE event without actually removing the object from the stage? And why would it only happen once?
    Thanks for looking!
    -Nick
    Here is some code as well as a screen shot of my main timeline:
    package src.modules {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import src.utils.greensock.TweenLite;
        import src.utils.greensock.easing.*;
        public class ModHome extends MovieClip {
            private static const DISTANCE:int = 700;
            private static const TWEEN_DURATION:Number = 1.0;
            private var _currentPage:int = 1;
            private var _isDone:Boolean = true;
            public function ModHome() {
                super();
    //            trace("home initialized");
                addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
            private function onAddedToStage(evt:Event):void {
                trace("home added to stage");
                removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
                addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage, false, 0, true);
                // BUTTONS
                pageLeft_btn.addEventListener(MouseEvent.CLICK, onMouseClick, false, 0, true);
                pageRight_btn.addEventListener(MouseEvent.CLICK, onMouseClick, false, 0, true);
            private function onRemovedFromStage(evt:Event):void {
                removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
                // BUTTONS
                pageLeft_btn.removeEventListener(MouseEvent.CLICK, onMouseClick);
                pageRight_btn.removeEventListener(MouseEvent.CLICK, onMouseClick);
    //            trace("home removed from stage");
            private function onMouseClick(evt:MouseEvent):void {
                if(_isDone) {
                    switch (evt.target.name) {
                        case "pageLeft_btn" :
                            movePages("left");
                            break;
                        case "pageRight_btn" :
                            movePages("right");
                            break;
                        default :
    //                        trace("home -- nothing");
                            break;
            // SCROLLING WINDOW
            private function movePages(thedirection:String):void {
                _isDone = false;
                var x1:int;
                switch (thedirection) {
                    case "right" :
                        if (_currentPage > 1) {
                            _currentPage = _currentPage - 1;
                            x1 = pages_mc.x + DISTANCE;
                            TweenLite.to(pages_mc, TWEEN_DURATION, {x:x1, ease:Quint.easeInOut, onComplete:onTweenComplete});
                        } else {
                            _isDone = true;
                        break;
                    case "left" :
                        if (_currentPage < 3) {
                            _currentPage = _currentPage + 1;
                            x1 = pages_mc.x - DISTANCE;
                            TweenLite.to(pages_mc, TWEEN_DURATION, {x:x1, ease:Quint.easeInOut, onComplete:onTweenComplete});
                        } else {
                            _isDone = true;
                        break;                   
            private function onTweenComplete():void {
                _isDone = true;
                pageMarker_mc.gotoAndStop(_currentPage);
    //            trace("complete");

    No reason in particular, when I created the class, FlashBuilder put it in there (I'm using Flash Pro CS5 + Flash Builder 4). I read that it calls it by default when the class is constructed, so having it in or out didn't really matter. I did comment it out with no luck, but I ended up shifting around the timeline quite a bit today and the problem has gone away. It seemed to only do it when it was in the first frame.
    Thanks for your help, I'm going to investigate it further when I have time just for reference, I'll post anything I find here.
    -Nick

  • REMOVED_FROM_STAGE called on creation

    I have a class called MyClass which needs to detect when it is ADDED and REMOVED from stage so i can remove event listeners and set variables to null when MC is removed for GC optimizations.
    My working document is: as3, fp 10 and have tried it with and without strictmode
    This is my class:
    public class MyClass extends MovieClip {
            public function MyClass() {
                addEventListener(Event.ADDED_TO_STAGE, onAdded, false,0,true);
            private function onAdded(event:Event):void {
                event.target.removeEventListener(event.type, onAdded);
                trace("added " + this.name);
                addEventListener(Event.REMOVED_FROM_STAGE, onRemoved, false,0,true);
                //add listeners here
            private function onRemoved(event:Event):void {
                event.target.removeEventListener(event.type, onRemoved);
                trace("removed " + this.name);
                //remove listeners here for GC
    I linked a MovieClip from my library to this class and put it on the stage manually in the IDE. When i run it i get these traces: "added", "removed"
    So just after adding it to the stage it dispatches removed_from_stage event while it actually doesn't remove the object.
    A workaround for this would be replacing Event.ADDED_TO_STAGE with Event.RENDER, because RENDER get's fired After ADDED, but i'm working on a public API and i don't think that's best practice
    Note: if i create a new document and just copy and paste the MC from my working document to the new document, it works as expected. But as i said, this is a public API, so i can't tell people to create new documents when it fails...
    So my questions are:
    why is this happening? is it a bug?
    how can we solve this?
    is replacing ADDED_TO_STAGE with RENDER bad practice?

    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

  • What is AS2 for Event.REMOVED_FROM_STAGE (AS3)?

    Hi,
    I am used to AS3 and am translating back to AS2.  I want to check if something has been removed from the stage.  In AS3, I used this:
    obj.addEventListener(Event.REMOVED_FROM_STAGE, objRemovedFromStageHandler);
    How can I do this in AS2?
    I have been trying to use the delegate class to set up an onEnterFrame event that I can then remove.  I have this working with events for button clicks etc but not onEnterFrame.  Well, i can get it working, but how do I set it up so I can remove a specific onEnterFrame, as I need to use multiple onEnterFrame throughout the script?
    Any suggestions very welcome.
    Many thanks,
    Mike

    in as2 you can just check if the object exists:
    if(obj)
    but no event is dispatched.
    if it does it's either on-stage or on the back-stage which you can check if needed.

  • IGE.graphic dispatches Event.REMOVED_FROM_STAGE events after each updatecomplete event

    When I type in TLFtextField dispatches RemovedFromStage events after each word! Why?
    var em:EditManager= new EditManager()
    em=txt.textFlow.interactionManager as EditManager
    var MC:mc=new mc()
    MC.addEventListener(Event.REMOVED_FROM_STAGE,rs)
    txt.textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,u)
    em.insertInlineGraphic(MC,"auto","auto")
    function u(e:StatusChangeEvent):void{
          if(e.status==InlineGraphicElementStatus.READY ||e.status==InlineGraphicElementStatus.SIZE_PENDING){
               txt.textFlow.flowComposer.updateAllControllers()
               if(e.status=="ready")txt.textFlow.removeEventListener(StatusChangeEvent.INLINE_GRAPHIC_ST ATUS_CHANGE,u)
    function rs(e:Event):void{
    trace(e.type)

    Thank you Richard
    This happens only if I set the IGE.float to none. Is there any other way
    to know if an IGE is removed from stage(user deletes it for e.g.)?
    Now my code is something like this:
    var em:EditManager= new EditManager()
    txt.textFlow.interactionManager=em
    em.textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,statusChanged)
    file.addEventListener(Event.SELECT,graphicSelected)
    function graphicSelected(e:Event){
      var flv:FLVPlayback= new FLVPlayback();
      flv.skin = "/SkinOverAllNoCaption.swf";
      flv.autoPlay = false;
      flv.source = new URLRequest(file.nativePath).url;//"C:/Users/Dell/Desktop/flv.f4v" for example
      flv.addEventListener(Event.REMOVED_FROM_STAGE,removeHandler);
      em.insertInlineGraphic(flv,"auto","auto""none", new SelectionState(txt.textFlow,0,0))     
      em.textFlow.flowComposer.updateAllControllers()
    function statusChanged(e:StatusChangeEvent):void
    trace(e.status)
    if(e.status==InlineGraphicElementStatus.READY ||e.status==InlineGraphicElementStatus.SIZE_PENDING){
      em.textFlow.flowComposer.updateAllControllers()
      if(e.status==InlineGraphicElementStatus.READY){
          txt.textFlow.removeEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,statusCha nged)
      gr.id=file.name//"flv.f4v" for example
    function removeHandler(e:Event):void
    if (e.currentTarget as FLVPlayback)
      var flv:FLVPlayback = e.currentTarget as FLVPlayback;
      ID=flv.source.substr(flv.source.lastIndexOf("/")+1)
      if (! em.textFlow.getElementByID(ID))
      var vp:VideoPlayer = flv.getVideoPlayer(0);
      vp.close();
      trace("REMOVED : "+ID); 
      currentGraphic=null
    else if(e.currentTarget as Loader){
      currentGraphic=null
    But the problem is the removeHandler function will check for existance of ALL IGEs with float set to
    none after typing each word, right?
    BTW Sorry for my bad English!

  • Resizing application causes createContentPane to dispatch second Event.REMOVED_FROM_STAGE

    My application relies heavily on the addedToStage and removedFromStage events. Yesterday, I hit a rather obscure edge case with these events, described here by an Adobe engineer:
    http://blogs.adobe.com/pmartin/2010/03/use_of_stage_ev.html
    I used the workaround described in the article where I create a contentPane in createChildren(). However, I find that despite this, when I resize my application window, the same Container throws a removedFromStage event from Container::createContentPane(). The code for that method checks for the existence of a contentPane, so I'm not sure why this is happening. I know that my contentPane is being created because I see the contentPane property change after the createContentPane() call.I'm attaching the code for that call below.
         *  @private
        mx_internal function createContentPane():void
            if (contentPane)
                return;
            creatingContentPane = true;
            // Reparent the children.  Get the number before we create contentPane
            // because that changes logic of how many children we have
            var n:int = numChildren;
            var newPane:Sprite = new FlexSprite();
            newPane.name = "contentPane";
            // Place content pane above border and background image but below
            // all other chrome.
            var childIndex:int;
            if (border)
                childIndex = rawChildren.getChildIndex(DisplayObject(border)) + 1;
                if (border is IRectangularBorder && IRectangularBorder(border).hasBackgroundImage)
                    childIndex++;
            else
                childIndex = 0;
            rawChildren.addChildAt(newPane, childIndex);
            for (var i:int = 0; i < n; i++)
                // use super because contentPane now exists and messes up getChildAt();
                var child:IUIComponent =
                    IUIComponent(super.getChildAt(_firstChildIndex));
                newPane.addChild(DisplayObject(child));
                child.parentChanged(newPane);
                _numChildren--; // required
            contentPane = newPane;
            creatingContentPane = false
            // UIComponent sets $visible to false. If we don't make it true here,
            // nothing shows up. Making this true should be harmless, as the
            // container itself should be false, and so should all its children.
            contentPane.visible = true;

    Nevermind. I was adding the contentPane to the child that was being removed -- it needed to be added to its parent.

  • How do I add multiple items to a hitTestObject?

    I have a horizontally scrolling flying game involving a character and diferent types of food moving across the screen from right to left which the character has to collect ("hit"). I have the hitTestObject working for 2 different food movieclips with one item belonging to a healthyList, and the other to a junkList.
    The problem is I don't know how to add more items (movieclips) to each of the lists, so that I have for example 6 items in the healthyList and 4 items in the junkList.
    Below is the code in my Engine.as file. The red highlighted text is the code that creates the problem. I thought that I just needed to add this line in order to add another item to the "healthyList" of food types, but I obviously have it in the wrong place or have the wrong code completely.
    package
        import flash.display.MovieClip;
        import flash.display.Stage;
        import flash.events.Event;
        public class Engine extends MovieClip
            private var numClouds:int = 5;
            private var healthyList:Array = new Array();
            private var junkList:Array = new Array();
            private var myFlying:Flying;
            public function Engine()
                myFlying = new Flying(stage);
                stage.addChild(myFlying);
                myFlying.x = stage.stageWidth / 8;
                myFlying.y = stage.stageHeight / 2;
                for (var i:int = 0; i < numClouds; i++)
                    stage.addChildAt(new Cloud(stage), stage.getChildIndex(myFlying));
                addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
            private function loop(e:Event) : void
                if (Math.floor(Math.random() * 90) == 5)
                    var healthy:Carrot = new Carrot(stage, myFlying);
                    var healthy:Broccoli = new Broccoli(stage, myFlying);
                    healthy.addEventListener(Event.REMOVED_FROM_STAGE, removeHealthy, false, 0, true);
                    healthyList.push(healthy);
                    stage.addChild(healthy);
                    var junk:Hotdog = new Hotdog(stage, myFlying);
                    junk.addEventListener(Event.REMOVED_FROM_STAGE, removeJunk, false, 0, true);
                    junkList.push(junk);
                    stage.addChild(junk);
            private function removeHealthy(e:Event)
                healthyList.splice(healthyList.indexOf(e.currentTarget), 1);
            private function removeJunk(e:Event)
                junkList.splice(junkList.indexOf(e.currentTarget), 1);
    All help and advice very much appreciated.
    Thank you!

    It's good that you don't expect me to do the work for you - saves me from letting you know that.  Doing the work is how you learn.  I am also not here to teach you, and it looks like you might need to get some basics under your belt before you can pursue something like what you are doing now.
    As I already said, the Math.random() method will be one of the key techniques you will need to use for anything you want to have happen randomly.
    Usually it comes in handy with randomly choosing an array's index, where the array stores the different items you want to randomly choose.  In your case, the array could store the names of the different functions you could call for each food item you want to add. Or you could have the classes of the objects in the array and randomly choose which one to load in...
       var foodClasses:Array = new Array("Carrots", "Broccoli", "Hotdog", etc...);
    this approach requires knowing how to dynamically create a new class instance using only a String value.... for example:
        var ClassRef:Class = Class(getDefinitionByName("className"));
        var classInstance:* = new ClassRef();
        addChild(classInstance);
    In that bit of code, the className would be whatever class name you randomly pulled from the array of the class names...
    I didn't say it isn't effective, though it can easily fail being effective as well when your file starts getting bogged down with everything else that is going on.  I said it isn't efficient.  It is constantly fliipping a 120-sided coin, as fast as the file's frame rate to see if it comes up 50 or not.  You could use a setTimeout function or a Timer and get much more efficent performance instead... only processing the code when the time passes. 
    If you cannot understand how that one line of code works, you are probably in over your head and you need to back up to more basic learning before you can tackle something like what you seem to want to create here. 

  • How can I get an flv video to stop playing when I exit the page it's on?

    The audio continues to play no matter where I navigate on the site.
    Thanks

    You want to stop the audio from playing and also downloading more video/audio if it is still downloading when you go to a new keyframe where the video display/component or mp3 player is removed from the stage because it's keyframe ended or do not exist anymore but you still hear the audio.
    Add an event listener to your video playback component that calls a function when the flash player tries to remove the video plaer from the stage that stops the netstream or at least stops/pauses the video playback.
    [link removed]
    //sample NetConnection and NetStream classes when the video player is removed from the stage tell the NetStream to stop playing or downloading the content with .close();
    var connection:NetConnection = new NetConnection();
    connection.connect(null);
    var stream:NetStream = new NetStream(connection);
    addEventListener(Event.REMOVED_FROM_STAGE, videoRemovedFromStage);
    function videoRemovedFromStage(e:Event){
       stream.close();

  • Stop videoplayback in flash on frame exit?

    Is there a way to stop video playback from a video when I leave the frame?
    On the first frame a video plays, but I when click the button to goto the second frame, it stills plays sound. I can't add a stop action like flv_mc.stop because on the next frame there is no video so the flv_mc does not exist. I tried putting it on the frame but outside the stage but it disrupts the tweens I have on the stage. I even tried putting the video player inside a movie clip with two frame, one with the vido player and a blank one, to see if I could rig it to exist on both main frames but on the one it would be stopped and set to a blank frame but the video player doenst work when nested 2 movieclips deep. The video player is not on the main timeline but inside of a content_mc and it works put putting it inside of its own movieclip broke it.
    I have also tried REMOVED_FROM_STAGE and that works but give me output errors. I have buttons (with gotoandStop actions) and only two of them have videos. At first I used removed from stage and copy and pasted on the frames the buttons navigate two, but it gave me and error of duplicate function, so I have three functions for REMOVED_FROM_STAGE. And they seemingly work and then I get output errors saying:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at Woomer_DisneyCruiseUPDATE_fla::content_mc_12/frame2()
              at flash.display::MovieClip/gotoAndStop()
              at Woomer_DisneyCruiseUPDATE_fla::MainTimeline/goOne()
    The file name is Woomer_DisneyCruiseUPDATE_fla.
    BTW the buttons are on the main timeline and they control navigation on the inside of a movieclip called content_mc

    That gave me errors because is said it was duplicate function even though it was on different frames, and also o nthe frame without the video it didn't know what to stop.
    I found away around it though. I set variables for each button command and then on added and extra frame inside the content that function as a navigation. On this frame it stops the video and the checks boolean variables on the main timeline set by the buttons. It basically checks to see which button was pushed and then finishes the button command by going to that frame. Basically it takes a detour rather than going directly to the disired frame, on that detour frame it stops and videos that are playing and uses if/then statments to check for boolean that alternate based on the button that was pressed in the main timeline.
    this is an example:
    Main time line-->
    var my_btnOne:boolean=true;
    var my_btnTwo:boolean=false;
    my_btn.addEventListener(MouseEvent.CLICK, buttonGo);
    function buttonGo(e:MouseEvent):void{
         my_btnOne=true;
         my_btnTwo=false;
         content_mc.gotoAndStop(nav);
    my_btnTwo.addEventListener(MouseEvent.CLICK, buttonGoTwo);
    function buttonGoTwo(e:MouseEvent):void{
         my_btnOne=true;
         my_btnTwo=false;
         content_mc.gotoAndStop(nav);
    inside content_mc:-->
    if(my_btnOne){
    gotoAndPlay("two");

  • How can I remove a child swf and stop all sounds when parent closes?

    Hi All,
    I am new to actionscript 3 and trying to learn as I go. The problem I am having is the following:
    I have a carousel of images that load an external swf movie with a FLVPlayback component on it. The problem is that when the external swf unloads the sound of the FLVPlayback component continues to play. I am using a carousel component I found online to load the images and each image loads an external swf file. here is the code for it.
    import com.carousel.DegreeCarousel;
    import com.carousel.data.CarouselDO;
    import com.carousel.data.AngleDO;
    import com.carousel.data.ItemDO;
    // DEFINING THE CAROUSEL OBJECT
    var carouselSettings:CarouselDO = new CarouselDO();
    carouselSettings.radiusX = 300;
    carouselSettings.radiusY = 0;
    carouselSettings.fov = 50;
    carouselSettings.transitionTime = 1;
    carouselSettings.ease = "easeInOutQuint";
    carouselSettings.useToolTip = 0;
    carouselSettings.useBlur = 1;
    carouselSettings.maxBlur = 8;
    carouselSettings.reflectionAlpha = 0.2;
    // DEFINING ANGLES SETTINGS
    var angleSettings_arr:Array = new Array();
    angleSettings_arr[0] = new AngleDO({angle:0,alpha:1,scale:0.5});
    angleSettings_arr[1] = new AngleDO({angle:90,alpha:1,scale:1});
    angleSettings_arr[2] = new AngleDO({angle:180,alpha:1,scale:0.5});
    // DEFINING THE ITEMS
    var prefix = "content/thumbs/"
    var galleryItems:Array = new Array();
    galleryItems[0] = new ItemDO({thumb:prefix + "image_1.jpg", content:prefix + "swf1.swf", contentType: "flash"});
    galleryItems[1] = new ItemDO({thumb:prefix + "image_2.jpg", content:prefix + "swf1.swf", contentType: "flash"});
    galleryItems[2] = new ItemDO({thumb:prefix + "image_3.jpg", content:prefix + "swf1.swf", contentType: "flash"});
    // PLACING THE CAROUSEL TO STAGE
    var carousel:DegreeCarousel = new DegreeCarousel(carouselSettings,angleSettings_arr,galleryItems);
    carousel.x = stage.stageWidth * .5;
    carousel.y = stage.stageHeight * .5;
    this.addChild(carousel);   
    // KEYBOARD NAVIGATION
    // KEYBOARD EVENTS
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);   
    function keyDownHandler(e:KeyboardEvent):void
        // left
        if(e.keyCode == 37)
            carousel.left(1);
        // right
        if(e.keyCode == 39)
            carousel.right(1);
        // top
        if(e.keyCode == 38)
            carousel.prevCycle();
        // Down
        if(e.keyCode == 40)
            carousel.nextCycle();
        // Space
        if(e.keyCode == 32)
    The external movie loads fine. Then the external swf calls for a second swf containing a video. This is the code that is used to load the swf:
    import flash.net.URLRequest;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    var myVideo:URLRequest = new URLRequest("myvideo.swf");
    var video:Loader = new Loader();
    video.load(myVideo);
    this.addChild(video);
    When the carousel unloads, it unloads both movies but the sound keeps on playing.
    Is there any way to stop the sound from keep playing?
    Thank you very much!!
    -M

    You want to stop the audio from playing and also downloading more video/audio if it is still downloading when you go to a new keyframe where the video display/component or mp3 player is removed from the stage because it's keyframe ended or do not exist anymore but you still hear the audio.
    Add an event listener to your video playback component that calls a function when the flash player tries to remove the video plaer from the stage that stops the netstream or at least stops/pauses the video playback.
    [link removed]
    //sample NetConnection and NetStream classes when the video player is removed from the stage tell the NetStream to stop playing or downloading the content with .close();
    var connection:NetConnection = new NetConnection();
    connection.connect(null);
    var stream:NetStream = new NetStream(connection);
    addEventListener(Event.REMOVED_FROM_STAGE, videoRemovedFromStage);
    function videoRemovedFromStage(e:Event){
       stream.close();

  • How do I get the Play, Stop, Volume controls to appear in my embedded Flash object?

    Hello,
    I want to show .swf or .flv videos on my website--like
    youtube.com. I want to use the standard Flash Player object
    embedded in a web page, however, I cannot seem to find the exact
    params that make the standard controls appear (ie, Play, Stop,
    Pause, Volume, etc). I just want to show a video and have the Play,
    Stop, Pause, Volume controls visible at the bottom. What do I need
    to do to get these controls to appear?
    Here's my current code:
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
    width="800" height="600">
    <param name="movie" value="
    http://www.sitename.com/flash/dt_flash.swf">
    <param name="quality" value="high">
    <embed src="
    http://www.sitename.com/flash/dt_flash.swf"
    quality="high" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash" width="800"
    height="600"></embed>
    </object>
    Any help would be greatly appreciated! :)
    Jason

    Sorry!  It's AS3. A typo on my part but, thanks for answering the post.   This is the correct answer that worked for me. Also,  the answer came from Kglad in the AS3 forum
    Assign your component an instance name (if it doesn't already have one), eg flv and in the frame that contains that component add:
    flv.addEventListener(Event.REMOVED_FROM_STAGE,removedF);
    function removedF(e:Event):void{
    flv.stop();

  • Disappearing MC from timeline

    Hi,
    I have created two layers: mask layer and masked layer. Mask
    layer consist
    of couple of keyframes with shape tweenning activated. Masked
    layer contains
    only one MC. I noticed that when frame containing any
    keyframe in the mask
    is played, MC stopped be accessible and
    Event.REMOVED_FROM_STAGE is
    triggered. If e.g. mentioned MC contains added picture, this
    picture
    disappears in this moment. Does anybody knows what is wrong
    and how to work
    around this issue? Is it possiible to use shape tweenning in
    masks?
    Regards,
    Marek

    The answer to this is simple,
    wrap your timeline with another clip, and apply the colorTransform to that clip.

  • ADDED event in document class after removed from Stage

    Hi All,
    I am currently play with the document class (the class acts as main) constructor for a SWF file.
    package {
      import flash.display.*;
      import flash.events.*;
      public class TestSymbol extends MovieClip
        public function TestSymbol()
          this.addEventListener(Event.ADDED, function(event:Event) { trace(event.eventPhase, event.target, event.currentTarget, "added triggered"); });
          trace("parent", this.parent);
          this.stage.removeChild(this);
          trace("stage", this.stage);
    In frame script 1, i put
    trace("1");
    trace("parent", this.parent);
    After i run TestSymbol.swf and  i got
    parent [object Stage]
    stage null
    2 [object TestSymbol] [object TestSymbol] added triggered
    1
    parent null
    I wonder where is this ADDED event coming from? If the document class is added to some other objects, why its parent is null after the event?
    Thanks in advance
    Sam

    By wrapper do you mean they are the same object or the MainTimeLine is a separate object being added to DocumentClass, as it triggers the ADDED event? I know that framescript can be accessed as documentClass functions, so I thought they are the same object, maybe i was wrong.
    I did a new test within some more listeners
    package {
      import flash.display.*;
      import flash.events.*;
      public class TestSymbol extends MovieClip
        public function TestSymbol()
          this.addEventListener(Event.ADDED_TO_STAGE, addedToStageListener);
          this.addEventListener(Event.ADDED, addedListener)
          this.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageListener);
          this.addEventListener(Event.REMOVED, removedListener);
          trace("parent", this.parent);
          this.stage.removeChild(this);
          trace("stage", this.stage);
         private function addedListener(event:Event):void {
           trace(event.eventPhase, event.target, event.currentTarget, "added triggered");
         private function addedToStageListener(event:Event):void {
           trace(event.eventPhase, event.target, event.currentTarget, "addedToStage triggered");
         private function removedListener(event:Event):void {
           trace(event.eventPhase, event.target, event.currentTarget, "removed triggered");
         private function removedFromStageListener(event:Event):void {
           trace(event.eventPhase, event.target, event.currentTarget, "removedFromStage triggered");
    and this is the output
    parent [object Stage]
    2 [object TestSymbol] [object TestSymbol] removed triggered
    2 [object TestSymbol] [object TestSymbol] removedFromStage triggered
    stage null
    2 [object TestSymbol] [object TestSymbol] added triggered
    As the remove listeners are fired immediately, i don't think the queue is waiting until the end of the constructor.

  • Error   1009 and I don't know what to do exactly, plz help me

    hi
    I wish that you could help me
    I am a beginner in actionscript 3.0, and I have a main swf file, with a menu and several buttons, when I click on each button, a new swf should be loaded, and the menu is resized and goes to the top left of the page, and if I click on the menu, it should come back..
    the problem is that when I click on the first button, everything works well, but when I click on another button, I get this error:
    TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
        at s_fla::MainTimeline/s_fla::__setProp___id0__Scene1_texte_2()
        at s_fla::MainTimeline/s_fla::frame2()
    I understood that the problem is due to the file which is displayed before it has been loaded.
    I also found that I have to use the function Event.ADDED_TO_STAGE, but I don't know where to put it??
    could you help me please?
    here is my code:
    function size(e:MouseEvent):void{
        menu_mc.gotoAndPlay(2);
        menu_mc.buttonMode = true;
        menui_mc.addEventListener(MouseEvent.CLICK, showmenu);
        menu_mc.button01_btn.removeEventListener(MouseEvent.CLICK, size);
        menu_mc.button02_btn.removeEventListener(MouseEvent.CLICK, size);
       menu_mc.button03_btn.removeEventListener(MouseEvent.CLICK, size);
    addChild (cliploader);
    function size(e:MouseEvent):void{
        menu_anatomie_mc.gotoAndPlay(13);
        menu_mc.removeEventListener(MouseEvent.CLICK, showmenu);
        menu_mc.button01_btn.addEventListener(MouseEvent.CLICK, size);
        menu_mc.button02_btn.addEventListener(MouseEvent.CLICK, size);
        menu_mc.button03_btn.addEventListener(MouseEvent.CLICK, size);
        removeChild (cliploader);
    menu_mc.button01_btn.addEventListener(MouseEvent.CLICK, loadpage);
    menu_mc.button02_btn.addEventListener(MouseEvent.CLICK, loadpage);
    menu_mc.button03_btn.addEventListener(MouseEvent.CLICK, loadpage);
    menu_mc.button01_btn.page = "file01.swf";
    menu_mc.button02_btn.page = "file02.swf";
    menu_mc.button03_btn.page = "file03.swf";
    function loadpage(e:MouseEvent):void{
        cliploader.myldr.source = e.currentTarget.page;
    please tell me what to do exactly
    P.S: cliploader is a UI loader which is present on the scene
    in my swf files, I have flvplayback which loads a flv files, and I think this is the source of the problem, because I have tried the same thing with a simple swf file which maybe loads quickly, and I didn't get this error
    thank you in advance

    thanks
    I think that the error is in the file that I want to load, in this file I have a flvplayback that I named myplayer, which is in the third frame, and because the video doesn't stop even if I move to another frame, I had to add this code in the third frame
    next_btn.visible = true;
    prev_btn.visible = true;
    myplayer.addEventListener(Event.REMOVED_FROM_STAGE, stopPlay);
    function stopPlay(e:Event)
    myplayer.stop();
    myplayer.stop(); this is line 7 on frame 3
    when I publish this file, it works
    but when I try to play it from the menu in the main swf file I get the error, how can I fix it please?
    can I make this manually, or I'll have the same problem?
    as I said, I tried to load different swf files from the main menu and I didn't have this problem (because there were no video players), so I think the problem is caused by the video player?
    thank you

Maybe you are looking for

  • How can i use RTFEditorKit for JTextField.

    hi all, how can i use RTFEditorKit for JTextField. thanks in advance daya

  • Why dont nokia help more with language settings? (...

    this is for all nokia phones but the one i have is the n97 and depending on where you buy the phone it has different languages in the settings. and for a lot of people who decide to buy theirs from ebay or from another country and have to suffer with

  • EOIO for IDOCs to XI

    Hi, My scenario is IDOC ---> xi ---> File. Need to implement EOIO(serialization) for IDOCs coming from ECC. Checked "Queue Processing" and assigned rule "FIRST_16_OF_MESTYP". When I send the IDOC using WE19, I get message "IDocs are stored in the que

  • Cash desk

    please list the Cash Desk Tables. what are the important tables. from Rajesh

  • Unable to update iPhone software - no error messages

    I recently purchased an iPhone a week ago and have just tried to update the software (to 1.1.2). I get as far as "restoring iPhone software..." and that's it. The updating status bar will get to a point, and just stay there. No matter how long the iP