Control mc with external SWF?

Hello everyone,
Ok, lets say I have two SWF files.
In “SWF 1,” I have a movie clip.
The movie clip in “SWF 1” loads in an external “SWF 2” file.
Is it possible for me to have something (like a button) inside the external “SWF 2” with the ability to control something (like a movie clip) in “SWF 1?”
If so what would the path to that mc look like?
Thanks

if both are as2 swfs, then you can reference the load-target movieclip in swf1 (the loading swf) from the main timeline of swf2 (the loaded swf) by using:
this.
so, if that load-target is on swf1's main timeline, you can reference swf1's main timeline by using:
this._parent.
and if there's a movieclip mc on swf1's main timeline, you can reference it by using:
this._parent.mc1.
etc.

Similar Messages

  • Fade in/out with external SWFs

    Hi All.. I"m very new to AS in general..
    I'm trying to have a simple slideshow with external SWFs that outomatic and onClick..I achieved it except the abrupt white space after the unloaded clip goes away... I have this code and I'm not getting any errors - but I mut not have it connected somehow because the fade out is still not there... Can someone please please help me with this... I really appreciate any help ahead of thime...
    //Import classes for easier use
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    //Timer
    var slideDuration:uint = 8000;  // or use whatever
    var slideTimer:Timer=new Timer(slideDuration,0);
    slideTimer.addEventListener(TimerEvent.TIMER,autoAdvanceF);
    slideTimer.start();
    var btnA:Array = [one_btn,two_btn,three_btn];
    var previousBtn:SimpleButton = one_btn // use class type of your buttons
    function autoAdvanceF(e:TimerEvent):void{
    nextButtonF(previousBtn).dispatchEvent(new MouseEvent(MouseEvent.CLICK));
    function nextButtonF(btn:SimpleButton):SimpleButton{ // use class type of your buttons
    for(var i:uint=0;i<btnA.length;i++){
    if(btnA[i]==btn){
    return btnA[(i+1)%btnA.length];
    return null;
    //Load external SWF into main
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");
    var target_mc:MovieClip = new MovieClip();
    addChild(target_mc);
    var target_mc2:MovieClip = new MovieClip();
    addChild(target_mc2);
    //load swf to movieClip
    target_mc.addChild(loader);
    //variables that store current content clip and current content indes
    var activeTarget:MovieClip = new MovieClip();
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChildAt(loader,0);
    //Btns universal function (whenver any button is clicked, the loader will be removed
    function btnClick(event:MouseEvent):void {
        if (target_mc.alpha > 0) {
            target_mc.alpha -=10;
        if(target_mc2.alpha < 100) {
            target_mc2.alpha +=10;
    slideTimer.reset();
    slideTimer.start();
        previousBtn = SimpleButton(event.currentTarget);
        removeChild(loader);
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
        var myTween:Tween = new Tween(loader, "alpha", None.easeIn, 0, 2, 1, true);
        loader.load(newSWFRequest);
        loader.x = Xpos;
        loader.y = Ypos;
        addChildAt(loader,0);
    loader.addEventListener(Event.ENTER_FRAME, onEnter);
    // Movie level enterFrame event handler that will fade down object 1 (if it's alpha ishigher than 0) and fade up object 2 (if its aslpha is less than 100)
    function onEnter(event:Event):void {
        if (target_mc.alpha > 0) {
            target_mc.alpha -= 10;
        if (target_mc2.alpha < 1 ) {
            target_mc2.alpha +=10;
        loader.removeEventListener(Event.ENTER_FRAME, onEnter);
        trace ("the movie clip is faded in");
    /// Button Listerners
    one_btn.addEventListener(MouseEvent.CLICK,btnClick);
    two_btn.addEventListener(MouseEvent.CLICK,btnClick);
    three_btn.addEventListener(MouseEvent.CLICK,btnClick);

    The Sound Factory Studio wrote:
    Can I Fade in/out several tracks with the crossfade tool? I mean without selecting them and then add value...? just like in ProTools just selecting the regions and apply the fade tool???? VIP question
    No.
    To add crossfades or fade in/outs to multiple audio regions, you must do it from the fade parameter box, either entering numerically, or by clicking and dragging on the numeric value.

  • Flex Component Kit : control import with external API?

    Hello,
    I want to import a swf/swc which plays flv movies controlled
    by an external API. When I compile the mxml file which contains my
    application will I still be able to control it with the external
    API?
    I hope someone can help me.
    cheers, Flo

    That's really weird!
    After digging around, reinstalling Flash CS3 again and doing
    multiple tests, I finally found the source of the problem:
    Two .swc files residing in the same folder where I was saving
    my tests files were avoiding the Flash compiler to successfully
    create new .swc files!? I cannot understand how this can be
    possible. As soon as I choosed a new folder for saving the test
    files, I could link to the .swc and access the component from Flex.
    Also as soon as I moved out the two culprid files I could again
    save in the previous folder...
    Does anyone has an idea how this can happen?
    For those interested in the case, you can download the 2
    culprid files
    here
    Best regards,

  • Problem with Error 5005 and with external SWF loading

    I am creating a relatively simple 10-12 minute animation. I've broken the animation into 34 different movie clips that I control on the timeline by using a timer delay.
    When I try to export them all together I get the error:
    ",Line 1: Error 5005: Unknown Error optimizing byte code."
    However, when I split the presentation into two halves with the same exact frames and code I don't have the problem.
    I thought loading an external SWF at the end of the first movie would be a good way to connect everything. However, the SWF continuously loads and won't play through the way it looks when you open the actual SWF file.
    This is my code for the external loading:
    var xpos:Number = 0;
    var ypos:Number = 0;
    var swf:MovieClip;
    var myLoader:Loader = new Loader();// create a new instance of the Loader class
    var url:URLRequest = new URLRequest("aamc-2e-slide1.swf");// in this case both SWFs are in the same folder
    myLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
    myLoader.load(url);
    function doneLoading(evt:Event):void
              trace("doneloading");
              swf = MovieClip(myLoader.content);
              stage.addChild(swf);
              swf.stop();

    I have the same/similar issue whether the stop is there or not.
    Yes, it is all on one frame.
    Without the stop, the SWF just continously loops on top of itself.

  • Control script for external swf

    I am loading an external swf to an empty container screen_mc
    with the following from the main timeline
    this.screen_mc.loadMovie("video.swf");
    It loads and runs fine but I want to be able to stop and
    start the swf with buttons but no matter how I target the clip I
    cannot get either button to work - can anyone help?
    Brian

    "bump"

  • Clickable slide show with external SWFs

    Hi... I would really apprecaite some help with the slide show please.
    I have a slide show that loads 3 external SWFs. (The External SWFs have buttons and action script of their own as well )
    I've gotten the SWFs to load and to switch automtically as well as on the button Click (going to next SWF in array). What  I would like to do is the following:
    - Have the buttons 1,2 and 3 go to respective SWFs (and not just a next button option)
    Also, as far as transitions (just basic fade in and out) is that something I should do within the external movie Clip?
    Thank you very much I appreciate all the help. Here's my code:
    // Array of external clips to use. Variable index refers to next clip to be displayed.
    var clips:Array = ["page1.swf", "page2.swf", "page3.swf"];
    var index:int = 0;
    // Stuff to load swf files
    var thisLoader:Loader = new Loader();
    thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
    var thisMC:MovieClip = new MovieClip();
    stage.addChild(thisMC);            // Add empty MC initially so the nextClip function can be generic
    // Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
    function nextClip():void {
        thisLoader.load(new URLRequest(clips[index]));
    // Tell AS that the loaded file is a movie clip and add it to the stage.
    function doneLoading(e:Event):void {
        stage.removeChild(thisMC);
        thisMC = MovieClip(thisLoader.content);
        thisLoader.unload();
        thisMC.addEventListener(Event.ENTER_FRAME, runOnce);
        stage.addChildAt(thisMC, 0);
        thisMC.gotoAndPlay(1);
    // When thisMC has finished - the next MC starts
    function runOnce(e:Event):void {
        if(thisMC.currentFrame == thisMC.totalFrames) {
            thisMC.removeEventListener(Event.EXIT_FRAME, runOnce);
            index = (index + 1)%(clips.length);
            nextClip()
    // "Next button" just calls a function that goes to the next file name (mod the number of files in the list)
    MovieClip(parent).bttn1_mc.addEventListener(MouseEvent.CLICK, playNext);
    function playNext(e:MouseEvent):void {
        nextClip();
        index = (index + 1)%(clips.length);
    Thank you!!!

    Have you ever successfully saved anything to that external drive? My first two thoughts are that the drive isn't formatted for the Mac or that you don't have rights to save to the drive.

  • Is Mission Control broken with external display?

    With mountain lion on macbook pro and an externel monitor attached to it, (and I close the macbook pro display to use only the external display), when I invoke the mission control, I dont see the preview of all the spaces (at the top) and I dont see the "add desktop" button at the top right corner as well.
    Once I open the macbook display (such that I am working with both external and laptop display), I see these (add desktop button as well as preview of spaces), on the macbook display where as the big window at the bottom of the screen which shows each application is in the external monitor.
    Because of this, I cant use multiple spaces with external monitor only.
    Am I missing something or this is a bug??

    Posted on the wrong thread.

  • Problem with external .swf, please help

    Hello.
    I'm new here so cheers to all. Sorry if I chose wrong forum for posting this question.
    I'm newbie in Flash and started building flash website with some tutorial. Now, I built navigation and content with this lines of code:
    var myMenyArray = [najave, onama, asesoar, kontakt, ponuda, klub, arhiva];
    for each (var btn in myMenyArray){
        btn.addEventListener(MouseEvent.CLICK, onBtnClick);
    function onBtnClick(event:MouseEvent):void{
        pages.gotoAndStop(event.target.name);
    and then added this one for loading .swf
    var Xpos:Number = 150;
    var Ypos:Number = 180;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    addChild(loader);
    function btnClick(event:MouseEvent):void {
    removeChild(loader);
    var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
    loader.load(newSWFRequest);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    galerija.addEventListener(MouseEvent.CLICK, btnClick);
    Now, my gallery loads when I press "Galerija" in navigation like I wanted, but when I want to show Home or some other content from the nav bar, gallery.swf still appears in front of content.
    Can anyone help me with this? It's probably eas, I don't know, but I spent a whole night trying to fix that and I'm here now like last chance.
    Hope that I've explained right my problem.
    Thanks anyone who can answer me.
    Cheers

    use:
            var myMenyArray = [najave, onama, asesoar, kontakt, ponuda, klub, arhiva];
            var loader:Loader;
            for each (var btn in myMenyArray){
                btn.addEventListener(MouseEvent.CLICK, onBtnClick);
            function onBtnClick(event:MouseEvent):void{
            if(loader){
            removeChild(loader);
            loader=null;
                pages.gotoAndStop(event.target.name);
            var Xpos:Number = 150;
            var Ypos:Number = 180;
            var swf:MovieClip;
            function btnClick(event:MouseEvent):void {
    if(loader){
            removeChild(loader);
            loader=null;
            loader = new Loader();
            addChild(loader);
            var newSWFRequest:URLRequest = new URLRequest(event.target.name + ".swf");
            loader.load(newSWFRequest);
            loader.x = Xpos;
            loader.y = Ypos;
            galerija.addEventListener(MouseEvent.CLICK, btnClick);
    And for every frame stop(); where content should load.
    My gallery .swf is in the same folder with this .swf.

  • Problem with external swf loading

    this is the code I'm using that works
    onClipEvent(load){
    this.loadMovie ("2.swf", "b");}
    Text
    and when I use another swf to load, it won't work anymore.
    Any help would be apreciated

    you can't decrease the total time it takes for you external swfs to load.  you can start those swfs loading in the background (while on frame 1, for example) but you need to be careful to preload only 1 swf at a time and not restart its download if it's already been started.

  • Previewing slides with external  SWF's

    Hello.
    I recently have been having problems with Captivate 4 and importing AS3 animations, in which once published the film will auto play and start all animations, regardless of where they are in my timeline. I did a bit of reading, and found out the way to get around this huge error is to use a custom flash loader.
    So I developed a custom widget that allows me to specify the URL/filename of the animation and the size of the animation. When that widget is reached in the timeline, it loads and plays the animation automatically.
    This works great, however since i'm referencing the URL locally (i.e. the url is simply 'animation.swf') this will only work when animation.swf is in the same directory as the Published Captivate file. I can't just preview the slide, I have to publish out the whole file.
    So! my question is, does anyone know where Captivate stores its previewed published files? I'm hoping I can just throw my SWF's in there to have them play when I hit preview. Otherwise, any thoughts on a better way?

    Hi Isometric,
    I stumbled on this solution while  searching. Read this post on my  blog. Since you have a widget, the key is to use a linked widget. FYI ... the publish folder changes from project to project so it's not a reliable way to do this.
    Whyves
    www.flash-factor.com

  • Communication with external swf?

    hi
    im loading in intro2swf with the following
    btn_cont2_mc.visible = false;
    addChildAt(intro_container_mc, 0);
    intro_container_mc.x=-400;
    intro_container_mc.y=-300;
    stop();
    introvisit();
    function introvisit ():void{
    if (introlevel == 2){
    lvlLoader2 = new Loader();                     // create a new instance of the Loader class
    url2 = new URLRequest("intro2.swf");
    lvlLoader2.load(url2); // load the SWF file
    intro_container_mc.addChild(lvlLoader2); 
    now the swf loads correctly and in the correct place however i have a btn on the stage that i wish to hide and at a certain point in my loaded swf i want to unhide the button using an enter frame event
    intro_container_mc.addEventListener(Event.ENTER_FRAME, added0);
    function added0(event:Event):void {
    if (intro_container_mc.currentFrame == 1){
    btn_cont2_mc.visible = true;
    MovieClip(this.parent).e_mc.cap_talk_txt.text="Stormy";
    I need to do it this way so that I can change the text at various points in the story of the swf i can change the text
    but whenever i try it, the button will not show or the text change, having problems communicating with swf, i have tried
    intro_container_mc.addEventListener(Event.ENTER_FRAME, added0);
    intro_container_mc.lvlLoader2.addEventListener(Event.ENTER_FRAME, added0);
    intro_container_mc.lvlLoader2.storm_mc.addEventListener(Event.ENTER_FRAME, added0);
    all of which have no effect, the animation inside the swf is kept in a movieclip called storm_mc
    hope you guys can help me fix this
    thanks
    fonzio

    hi kglad and thanks for putting my mind at rest as well as keeping me sane
    currently trying to remove the children added at this point (or the loaded swf)
    but im running into problems, its giving me a lot of displayobject errors when i try to remove child
    after the animation has finished and the user clicks the button this should happen
    function removelistd():void{
    removeChild(loader)
    btn_cont2_mc.buttonMode=false;
    btn_cont2_mc.removeEventListener(MouseEvent.CLICK, continuey);
    btn_cont2_mc.removeEventListener(MouseEvent.MOUSE_OUT, conty2Out);
    btn_cont2_mc.removeEventListener(MouseEvent.MOUSE_OVER, conty2Over);
    swf2Main_mc.storm_mc.removeEventListener(Event.ENTER_FRAME, added0);
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
    wondering if it is the loader that i should be putting above
    have tried swf2Main_mc and loader in all sorts of ways however keep getting this
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at MethodInfo-360()
    at MethodInfo-357()
    just need help cleaning up and then its done
    thanks in advance
    fonzio

  • How to control timeline sound of external SWF

    Hi All,
    Basic Intro:
    I am new in Action Script and trying to create a video tutorial framwork. In this I have lots of animated SWF files in all the files I have multiple scenes as those are 5min. to 10 min. each and all the files have the relevent background and nurration voice place directly on the TIMELINE frame by frame to match lip syncing animated chreactors.
    My file structure :
    Login.swf with login box is embedded into the Index.html
    After logged in it will load another SWF which is Control panel.swf
    3. Controlpanel.swf has the controls to control the loaded external swf files i.e.: Chapter menu, Play, pause, replay, volume-bar, next and previous buttons.
    By Default Controlpanel.swf will open chapter1.swf as soon as user logged in so no one need to open 1st file.
    Here user can navigate to other chapter swf file through Chapter menu or Next and Previous buttons.
    All files are loading and playing properly, here I am trying to control the animation and Sound both at a same time with Pause, Play and Replay through relevant buttons.
    Problem:
    By pressing “Pause button” animation stops but not the sound. Sound remains playing, and if I replay the swf by “Replay button” than animation restarts but sound also restarts that overlaps already playing audio.
    Question: So could anybody help me finding out how to:
    1. Pause the sound with animation by the same click of Pause button, and
    2. Stop the sound with animation by the same click of Stop button, and
    3. On replay it should stop playing the previously running audio and restart it with the animation like fresh loaded file, it should not sound overlapping.
    Constraints:
    Here I am using the sound file on the same time line of each individual swf file which I cannot add into any single movie clip because all the chapter swf file are having multiple scenes in it.
    For my problem I have already done a lot of browsing online in various forums and didn't find the solution. So here I am sharing the complete information regarding the project and wishing to get some good solution out here but if I missed any helpful information please ask me anytime and please help me to quickly find out the solution.
    Thanks a lot to all of you in advance to help me.

    create one global sound variable
    you can write when you are pressing pause button
    globalsoundvariable.setVolume(0)
    to play
    globalsoundvariable.setVolume(100)

  • Making link to external swf stop

    Using flash 8.  Inserted a link to a 2:15 second swf on the internet (get URL xxx.swf) at the beginning of my fla file, it plays fine but when the swf is over, how can I make it go away, in order to continue on with my presentation? 

    This is an onstage presentation so there are no buttons available, just
    letting it play through.  Doesn't sound favorable. Thanks very much for
    your help.
    From:
    Ned Murphy <[email protected]>
    To:
    rwcorgis <[email protected]>
    Date:
    07/16/2012 11:22 AM
    Subject:
    making link to external swf stop
    Re: making link to external swf stop
    created by Ned Murphy in ActionScript 1 and 2 - View the full discussion
    If you have no control over that external swf there probably is not much
    you can do outside of opening it in a separate browser window so that the
    window can be closed and your original page is still showing in its
    browser window..
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either
    reply to this email or visit the message page: [
    http://forums.adobe.com/message/4560470#4560470]
    To unsubscribe from this thread, please visit the message page at [
    http://forums.adobe.com/message/4560470#4560470]. In the Actions box on
    the right, click the Stop Email Notifications link.
    Start a new discussion in ActionScript 1 and 2 by email or at Adobe Forums
    For more information about maintaining your forum email notifications
    please go to http://forums.adobe.com/message/2936746#2936746.
    STATEMENT OF CONFIDENTIALITY
    The information contained in this email message and any attachments may be confidential and legally privileged and is intended for the use of the addressee(s) only.  If you are not an intended recipient, please: (1) notify me immediately by replying to this message; (2) do not use, disseminate, distribute or reproduce any part of the message or any attachment; and (3) destroy all copies of this message and any attachments.

  • Target paths in external SWF's?

    Hi, Im having problems with a flash based website that I am
    creating. It is essentially a gallery, using a shell file for all
    the navigation with external .swf's being loaded in for each image
    set to keep the overall file size low. I have it all working fine
    except for one weird problem, within the external .swf's there is
    another layer of navigation to move forwards and backwards through
    the main timeline.. it works fine as an individual .swf but when
    loaded inside the shell interface none of the buttons work.
    The only thing I can think of is that the paths are wrong
    when it is loaded into another file, for example: does "on
    (release) { _root.play();" on a button inside the external swf
    refer to the root of the external file or the root of the shell swf
    itself? What path am i suposed ot use to refer to items on the main
    timeline of an external .swf file?
    I may not have explained this very clearly, but I would be
    extremely greatful for any insights, thanks for your time

    yes scott, the _root in this case refers to the main movie..
    try using the "on(release) {this.play()}" or
    on(release){_root._LEVEL##.play()}
    where ## is the level Number that the external swf is loaded
    into..

  • Drag & Drop Functionality Doesn't Work in External SWF?

    Hi all,
    I'm currently a TA for a Flash course at my school.  We're using AS 2.0 and working with external SWFs.
    I think this might be pretty simple to remedy.  Well, at least I'm hoping!
    A student is having trouble with drag & drop functionality when it  is used in an external SWF.  Basically, in our drag & drop section,  we have a sheet of paper ("paper" MC) and an object we drag into it  ("object" MC).  When the object is released in the paper area, we go to  frame 2 of "paper" MC, which consequently has an animation.
    This works fine and dandy in said drag & drop section, but once the  drag & drop section is loaded into our main SWF via a MC  placeholder, the drag & drop functionality stops working.
    Here is the URL to the drag & drop section by itself:
    http://www.phayzed.com/flashkit/drag_for_animation.swf
    and here is the URL to the main swf, which loads the drag & drop SWF into a movieclip and causes it to work incorrectly:
    http://www.phayzed.com/flashkit/main.swf
    Now here is the code on the draggable object ("object" MC):
    on (press) {
            startDrag (this, true);
    on (release) {
            stopDrag ();
            if (this._droptarget == "/paper") {
                    _parent.paper.gotoAndStop(2);
                    _parent.object._visible=false;
    If any more info is needed, I'm willing to upload both FLA files.   Although, something tells me that this is a simple issue to resolve.
    Thanks a lot for any help!!!
    Cheers
    T

    with as2 you must convert that antiquated as1 code:
    on (press) {
            startDrag (this, true);
    on (release) {
            stopDrag ();
            if (eval(this._droptarget) == _parent.paper) {
                    _parent.paper.gotoAndStop(2);
                    _parent.object._visible=false;

Maybe you are looking for

  • JDeveloper 11g - exception when trying to set Code Style in Preferences

    Hi forum I have just installed the new JDeveloper 11g and have upgraded my projects, and would now like to define my code style. But when I open Preferences -> Code Editor -> Code Style, I get the following error. Is this a known issue? Not being abl

  • Caption Options in Slide Show

    Is there anyway to have the caption come in separately from the photo or to add some kind of animation to it?  Thank you in advance.

  • Trouble when upgrading from android 4.2.1 to android 4.4.2 on Lenovo S920 series

    Dear Lenovo, I was using Lenovo smartphone S920 series since January,2014 until now. When November 2014, I Got notification from Lenovo trough OTA system update for upgrade my Lenovo android from 4.2.1 version to 4.4.2 version. In my first 3 month us

  • Hey, when I shut down the computer and close it before it does so, the...

    light on the button for opening the screen (middle front of closed laptop) stays on. However if I shut down and wait for the screen to go black before closing it the light does not come on. Needless to say I do not want that light there as if I shut

  • Flagged photo question

    Hi Where is the information on flagged photos stored? Is this in a plist file anywhere? I copied my photo library to my new Mac and lost all my flagged photos. Fortunately I still have them flagged on my old Mac. How can I get this flagged photo info