Pause/Play for external SWF

Can someone help me witht this? I'm going crazy trying to understand because none does not work. I am trying to create a play/pause button that will make a break and play on the main timeline (easy), but also an external SWF that is loaded with the class Loader. Here is my code:

var myLoader:Loader = new Loader();Create a new instance of the Loader class

var url: URLRequest = new URLRequest ("MYCONTENT.swf");

myLoader.load (url);load the SWF file

myLoader.x = 134;

myLoader.y = 148;

addChild (myLoader);

In the main scenario, I have a MovieClip that is the Pause/Play button. He alternates between the two. How to control the external SWF as well?

Section 1:

Stop();

pauseBtn.addEventListener (MouseEvent.CLICK, pauseMovie);

function pauseMovie(e:Event): void {}

gotoAndStop (2);

MovieClip (root) .stop ();

MovieClip (root).myLoader.content.stop ();  ///??????????

}

Section 2:

playBtn.addEventListener (MouseEvent.CLICK, regarderMovie);

function playMovie(e:Event): void {}

gotoAndStop (1);

MovieClip (root) .play ();

MovieClip (root).myLoader.content.play ();  ///????????????

}

Try:

var myLoader:Loader = new Loader(); Create a new instance of the Loader class

var url: URLRequest = new URLRequest ("MYCONTENT.swf");

myLoader.load (url); load the SWF file

myLoader.x = 134;

myLoader.y = 148;

addChild (myLoader);

In the main scenario, I have a MovieClip that is the Pause/Play button. He alternates between the two. How to control the external SWF as well?

Section 1:

Stop();

pauseBtn.addEventListener (MouseEvent.CLICK, pauseMovie);

function pauseMovie(e:Event): void {}

gotoAndStop (2);

MovieClip (root) .stop ();

MovieClip (MovieClip (root).myLoader.content) .stop ();  ///??????????

}

Section 2:

playBtn.addEventListener (MouseEvent.CLICK, regarderMovie);

function playMovie(e:Event): void {}

gotoAndStop (1);

MovieClip (root) .play ();

MovieClip (MovieClip (root).myLoader.content) .play ();  ///????????????

}

Tags: Adobe Animate

Similar Questions

  • Play an external .swf sound loaded

    I have a small .swf file containing any of the characters in my game. In my project main actionscript 3, I load the .swf from an external source and display it in my game. It works very well, however, I join the swf file contains a short sound clip that should be played whenever the user clicks on the character.

    I know that I could add an onClick listener to the small .swf itself and write code in Flash Professional to play the sound. The problem is that I have an options menu in my game that allows the user to specify the volume of these sounds, and I think that this information would be unavailable for the loaded external .swf

    The audio file must therefore somehow be packed inside the .swf of character, but I also need to be able to play through my custom "SoundPlayer" class that I have in my actionscript project. Any ideas how I could do this?

    create a public method in your external swf file that controls the volume of the sounds.

  • ActionScript 2 Array for external SWF

    Hey everybody.  I have a file menu that takes care of all the clips in swf I in another folder.  I did it in a table so that it calls for the clip, and then it plays in the movieclip I have in the file menu flash.  And Yes, I use Actionscript 2.0.

    My question is, how do I make a player control that will jump to the previous swf that was played.  I already have a rewind button, but it is not going backwards through the FSV played.  I'm thinking about a code that load the previous SWF played in the table when a button is clicked.  Similarly, I would do it with a next button and just move to the next swf in the row of the table to the top.  I'll just bend a bit of code that I would have for the previous swf button.  Not much there.  I don't know where to start.  It seems that I found it almost, but miss me just one key element.

    Any help would be GREATLY appreciated.  And I'll give you the person responding correctly to a brand of "right answer".  I make sure to come back and do it.  Thanks to you all!

    This isn't the code I proposed:

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    Function to load the film "next".  It uses the current value of currentSwf
    to access the table of sovereign wealth funds, then increments this value.  This version loops
    around at the beginning after the last of them.

    function loadNext (): Void {}
    mcl.loadClip (SWF [currentSwf], theTargetClip_mc);
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    }

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;
    }
    }
    }

    loadNext();
    function loadNext (): Void {}
    If (currentSwf > = swfs.length) return;
    mcl.loadClip (sovereign wealth funds [currentSwf], theTargetClip_mc);
    currentSwf ++;
     
    }

    function loadPrevious (): Void {}

    {if(currentSwf>1)}

    currentSwf-= 2;

    loadNext();

    }

    }
    rewind_btn.onRelease = loadPrevious;

  • Music added to the slideshow in Lightroom 6 will not play for external speaker.

    Hi all

    Hope someone can help me with this annoying problem.  The music I add to a slideshow LR6 won't play through speaker external (it will play only speaker macbook air)

    I use macbook air on 10.9.5.

    The speaker is EU Boom - bluetooth.

    He doesn't have a problem with the connection that I can play music from iTune, all just not via lightroom.

    I have the same problem. Lightroom 6, Mac OS10.10, Sony Bluetooth speakers. Have you found a solution?

  • put in pause/play dynamically loaded swf

    Hello world

    I have a movie called box.swf that I load into controller.swf.  I have two buttons on the scene called pause_btn and play_btn I want to use to control the timeline of box.swf.  I am at a loss on how to do it, but I don't know that it's simple.  Here is the code I have so far:

    var myLoader = new Loader();
    var myURL:URLRequest = new URLRequest ("box.swf");
    myLoader.load (myURL);
    addChild (myLoader);

    pause_btn.addEventListener (MouseEvent.CLICK, pauseMe);
    play_btn.addEventListener (MouseEvent.CLICK, regarderME);

    function pauseMe(evt:MouseEvent):void {}

    }
    function playMe(evt:MouseEvent):void {}

    }

    Any help would be appreciated!

    Thank you

    -Dave

    var mc:MovieClip;

    var myLoader = new Loader();
    var myURL:URLRequest = new URLRequest ("box.swf");

    myLoader.contentLoadInfo (Event.COMPLETE, loadCompleteF);
    myLoader.load (myURL);
    addChild (myLoader);

    function loadCompleteF(e:Event) {}

    MC = MovieClip (myLoader.Content);

    }

    pause_btn.addEventListener (MouseEvent.CLICK, pauseMe);
    play_btn.addEventListener (MouseEvent.CLICK, regarderME);

    function pauseMe(evt:MouseEvent):void {}
      MC. Stop();
    }
    function playMe(evt:MouseEvent):void {}

    MC. Play();

    }

    -Dave

  • Unload event for external swf [urgent need help]

    Hi master everything,.

    iI have mp3, eksternally loaded and checked main time...
    the bugs are
    1. If I want to go to another .swf file, I can still hear the noise...
    2. If I click on the button that linked to mp3.swf, the sound / song are duplicated by2 and then if I click again the sound are duplicated by3...
    How can I solve this problem? OIA, the buttons to call another swf are only in the main swf,foradobe.jpg
    and here is the code:

    You can use:

    zhe button

    var Xpos:Number = 140;

    var Ypos:Number = 100;

    var swf:MovieClip;

    var loader: Loader;

    addChild (loader);

    Function of BTN

    function btnClick(event:MouseEvent):void {if(loader!=null)

    {

    loader.unloadAndStop ();

    removeChild (loader);

    Charger = null;

    }

    loader = new Loader();

    var newSWFRequest:URLRequest = new URLRequest ("SWFs /" + event.target.name + ".swf");

    Loader.Load (newSWFRequest);

    Loader.x = Xpos;

    Loader.y = Ypos;

    addChild (loader);

    }

    Listeners of BTN

    shout.addEventListener (MouseEvent.CLICK, btnClick);

    song.addEventListener (MouseEvent.CLICK, btnClick);

    gallery.addEventListener (MouseEvent.CLICK, btnClick);

    about.addEventListener (MouseEvent.CLICK, btnClick);

  • External swf on Air Android and IOS

    Hello

    Can AIR and IOS android application download and play an external SWF with code inside?

    I created android app AIR (SDK version 4.0) that load an external swf with simple clip on the stage.

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onLoaded);

    Loader.Load (new URLRequest ("2.swf"));

    function onLoaded(e:Event):void

    {

    addChild (loader);

    }

    I installed this on device android AIR app but I see no external swf on the stage.

    Thanks in advance

    You must add the external swf file for included files.  and for ios, you must assign the loadercontext property.

  • Currentframe external SWF: problem

    I have a movieclip that loads and plays an external SWF into it.

    Y at - it anyway to know the number of the current framework of the external swf file so that I can use it to drag the progress bar from the film.

    Note: I can not change the external swf. They are just simple and static films.

    It is urgent, please help.

    Thank you

    You can determine the current image of any chronology in the external swf.  for example, if you want to know the current image of the main timeline and you are using as2, use:

    targetMC._currentframe;  where targetMC is the movieclip in which your external swf has been loaded.

    in as3:

    MovieClip (ldr.content) .currrentFrame;  where the ldr is the loader that loaded your external swf.

  • Problems with external swf preloading

    Hello

    I have to do a Web site using Flash CS3 and ActionScript 3. I decided to implement a main.swf with a menu that loads all other pages (external SWF) into a movieclip. During the loading process is illustrated a preloader. It works fine until you click on a button to one page in another we're always loading. Although the percentage of meter refreshs swf you asked last gets charge and the dsiplayed, the preloader doesn´t turn invisible and stops above 100%.
    Please can someone help me? What I chose a completely different approach?

    The code on frame 1:

    var swfLoader:Loader = new Loader();
    sets the conbox movieclip as a place for external SWF files
    conbox.addChild (swfLoader);

    all external SWF
    var homeURL:URLRequest = new URLRequest("Unterseiten/home.swf");
    var home2URL:URLRequest = new URLRequest("Unterseiten/home2.swf");

    the EventListener
    swfLoader.contentLoaderInfo.addEventListener (Event.OPEN, loadStart);
    swfLoader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, loadProgress);
    swfLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, loadProdComplete);
    load the first external swf at startup
    swfLoader.load (homeURL);

    the functions
    function loadStart(e:Event):void {}
    var percentLoaded = 0;
    }

    function loadProgress(event:ProgressEvent):void
    {
    var percentLoaded:Number = event.bytesLoaded / event.bytesTotal;
    percentLoaded = Math.round(percentLoaded * 100);
    this.percentLoaded.text = String (uint (percentLoaded)) + '% ';
    This. USLadetext.visible = true;
    this.percentLoaded.visible = true;
    }
    function loadProdComplete(e:Event):void {}
    trace ("file loaded");
    This. USLadetext.visible = false;
    this.percentLoaded.visible = false;
    }

    The code for a button:

    [button1.addEventListener (MouseEvent.MOUSE_UP, onBtn1Release);
    function onBtn1Release(e:MouseEvent):void {}
    swfLoader.load (home2URL);
    }

    Ah now I see you add loader to display the list.  I made an example of loading of 2 swf files, here is the source code of the files are attached, let me know if you don't understand something.

    stop();
    //pages to load
    var swf_ar:Array =["content1.swf","content2.swf"]
    //holder sprite
    var holder:Sprite = new Sprite();
    this.addChildAt(holder,0);
    //loader
    var loader:Loader;
    //controls
    btn1.addEventListener(MouseEvent.CLICK,onControlClick,false,0,true);
    btn2.addEventListener(MouseEvent.CLICK,onControlClick,false,0,true);
    
    function onControlClick(e:MouseEvent):void
    {
         loadSection(Number(e.target.name.charAt(3)));
    }
    function loadSection(pSectionNum:uint):void
    {
         //check of loader exist-> remove listeners ,close the loader,set to null
         if(loader)
         {
              loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onSectionLoadComplete);
              loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,onSectionLoadProgress);
              loader.close();
              loader=null;
         }
    
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onSectionLoadComplete,false,0,true);
         loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onSectionLoadProgress,false,0,true);
         loader.load(new URLRequest(swf_ar[pSectionNum-1]));
    }
    function onSectionLoadComplete(e:Event):void
    {
         if(holder.numChildren > 0)
         {
              holder.removeChildAt(0);
         }
    
         holder.addChild(MovieClip(e.target.content));
    
         //when load finished remove losteners and set the loader to null
         loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onSectionLoadComplete);
         loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,onSectionLoadProgress);
         loader=null;
    }
    
    function onSectionLoadProgress(e:ProgressEvent):void
    {
         trace(e.bytesLoaded/e.bytesTotal);
    }
    
  • How to prevent the sounds of the timeline in external swf files to play during the loading?

    I'm having a problem with the sounds of the external timeline in the swf files play while charging in a main swf file. Can someone help me?

    Here is a part of the main code of the swf. I hope I got enough.

    Thank you.

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    import flash.display.Loader;

    to import flash.events.ProgressEvent;

    import flash.events.Event;

    import flash.net.URLRequest;

    Import fl.events.SliderEvent;

    import flash.media.SoundTransform;

    preloader_mc.fill_mc. ScaleX = 0;

    var swfA:Array = ["part1.swf", "part2.swf"];

    var frameA:Array = [];

    var currentLoader:Loader;

    var swfTotalFrames:int;

    var tl:MovieClip =;

    var st:SoundTransform = new SoundTransform()

    var int index = 0;

    loadNextF();

    play_slider. Enabled = false;

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    TL ["loader_" + index].contentLoaderInfo.addEventListener (ProgressEvent.Progress, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.Complete, completeF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function progressF(e:ProgressEvent):void {}

    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);

    preloader_mc.fill_mc. ScaleX = fractionLoaded;

    preloader_mc. TF. Text = (100 * fractionLoaded) + "% Loaded";

    }

    function completeF(e:Event):void {}

    TL ["loader_" + index].contentLoaderInfo.removeEventListener (ProgressEvent.PROGRESS, progress F);

    TL ["loader_" + index].contentLoaderInfo.RemoveEventListener (Event.Complete, completeF);

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    frameA.push (mc.totalFrames);

    index ++;

    if(index<swfA.Length) {}

    loadNextF();

    } else {}

    / / full of all charges.  start playing.

    restart_mc.buttonMode = true;

    restart_mc.Alpha = 1;

    tl.addEventListener (Event.ENTER_FRAME, playUpdateF);

    tl.removeChild (preloader_mc);

    preloader_mc = null;

    play_slider.enabled = true;

    playpause_mc.Alpha = 1;

    currentLoader = tl ["loader_0"];

    tl.addChild (currentLoader);

    MovieClip (currentLoader.content) .play ();

    sliderParamsF();

    }

    }

    I have about 70 sounds in my two external SWF. What I need to stop all of them?

    //---

    more than likely, Yes. I guess it depends on how you have 70 put sounds up in your external swf file... I mean:

    you have 70 movieclips appointed on the external swf stage with a distinct sound in each of them? and each have a stop() action in the first picture?

    or

    you say your external swf to go to a certain image tag that plays a sound on the timeline to this label?

    or

    are your 70 sounds created dynamically with code and told. start()?

    //---

    Keep in mind, a swf loading will start to play even before it is fully charged. So instead of when it is fully charged, try stop the loaded swf with a listener for 'init', i.e. when the swf file loaded passes its first image:

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    . contentLoaderInfo.addEventListener TL ["loader_" + index] (ProgressEvent. COURSES, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.COMPLETE, completeF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.INIT, initF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function initF(e:Event):void {}

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    }

  • Action Script 3 Code to play and stop a file Fla or external Swf using game, stop button, in, the FLA file

    Thank you for all the answers before.

    I need a code Action Script 3 humbly for playing and stopping at a file Fla or Swf external button Play or Stop in Parent Fla or Swf file.

    I should have the opportunity to revisit the Fla of Parent file of the external file using the key.

    For example: I 'Introduction' Fla that has a button to play an external Fla called "set up."

    And in the 'set up' ALF, there is a button to play 'Introduction' in Florida.

    Kind regards

    God bless you

    the eaiest way is to use the content property of your charger (cast as sprite or movieclip) to reference the main storyline in the loaded swf file, and to use parent.parent to the timeliine of reference containing your charger (assuming that it has been added) go up again as the appropriate object.

  • Prevents an external SWF to play?

    Okay, I know this is a noob question, but I have a project with a deal relatively complex menus and a tutorial with comments of all kinds which is great (in terms of MB) compared to the menus themselves. The tutorial is likely to be played that once, or not at all, I don't want load the element unless necessary. To do this, I use the following code to load an external swf (this tutorial) and attach it to a container of mc (mc_launch). Charger bar will be added later, but for now this works, except: If the user leaves the tutorial (jumps to another image of the menu script) the child attached to the mc_launch audio continues to play even if the instance of the mc_launch is no more on stage. Should not all child objects of the container away once the container instance is gone? If this is not the case, what I specifically need to run a mc_launch.removeChild (loader) before you navigate away from the mc_launch instance?


    var request: URLRequest = new URLRequest("launchPresentation/BAS_Launch_Presentation.swf");
    var loader: Loader = new Loader();
    Loader.Load (request);
    mc_launch. AddChild (Loader);

    to kill your rational use:

    MovieClip (loader.content) .killSound ();

  • Stop an external SWF to play

    OK I'm pretty new to this AS 3.0.

    I'm going to make my portfolio site.

    I'm loading external swf in my my navigation page that contains most of my pieces of content for the home page.
    I loaded in my head and it has some animation on it since the time line.
    So it loads fine and plays through animation, but then it loops again and I want to just play once and stop.

    Is there a code I can write to him to play once?
    It is not a clip in the SWF file, it's just a text I have moving across the screen in a simple motion tween.
    I was looking through my bible AS3.0 and he mentions being able to stop a clip by means another call onEnterFrame combined with goToAndPlay() and stop() even.

    But they do not explain it and I'm lost; They show any example of code.
    I would like to convert it to a clip, or is there a way to stop it the way I have it.
    Please be detailed in any explanation provide you and use simple terms, I'm still learning this AS code.

    Thanks in advance!

    Are these Flash animations that you have created? If you have access to your external SWFs FLA files, you must still add a stop(); command at the end of the animation to prevent exactly this problem (which is a problem for all versions of Flash, not AS3). Without a stop(); command, the Flash file will make a loop when it reaches the last frame of the timeline.

    But perhaps you have a different problem than that...

  • I need to add tasks Pause-and - Play for Windows Media Player on Task Scheduler

    We have Windows Media Player music running in the background in our office and need to schedule a time for the music to pause automatically for five minutes for prayer time.

    So what I need is the program / Script for windows media player to pause and play.
    Thanks in advance.

    We have Windows Media Player music running in the background in our office and need to schedule a time for the music to pause automatically for five minutes for prayer time.

    So what I need is the program / Script for windows media player to pause and play.
    Thanks in advance.

    How to configure Windows Media Player to start playing music automatically at a Certain time?

  • How do external swf garbage collector in the Air for iOS?

    My app uses a lot of external SWF (although they are actually included in the application with a file, but they are not shipped) and does not contain any bitmapdata, only of vector graphics. The problem I have is that they seem to never be garbage collected and System. privateMemory continues to increase while the application loads more SWFs.

    As sovereign wealth funds contain vector graphics, I cancel all just all the variables that are now the reference to the SWF file and call it system.GC()... But it doesn't seem to work. What should I do for the garbage collector to clean sovereign wealth funds?

    I use Air for iOS 3.5.0.1060 and ActionScript3.0.


    Ago - I found that they are not always collected garbage when you expect to be. It is not that they are "missed" just AIR decides to wait before waste collection. I found that continuous application to run they will eventually be garbage collected at the same time very unpredictable, as long as you don't have really any remaining reference for them.

Maybe you are looking for