control the loaded swf file

Hi all

I am loading a swf into another SWF, I want to controll loaded swf such as play and pause the swf. The loaded swf file is an animation file, all animations are kept in a movieclip, then please tell me how I can control the animation.

In your first assignment, you tell the animation is present in a movieclip.  If this movieclip is in the loaded swf file you will probably need to target this movieclip to tell him to play rather than the SWF itself, as in...

currentSWF.movieclipName.play ();

where movieclipName is replaced with the name of the instance of movieclip in the loaded swf file.

Tags: Adobe Animate

Similar Questions

  • How the get function is available or not on the loaded swf file

    I have 100 swf file in one of my projects. And there is a common feature in some of the SWFs. All these files are loadded in the file main.swf. Here's my Question, "If have the common function is the swf file that is loaded, int how to trigger this funciton of the main.swf.

    Quite simply,.

                if(movieclip.test){
                    movieclip.test();
                }
    

    ('movieclip' is the loaded SWF file and "test()" is the function)

  • Child of the loaded SWF file

    I read through many of the forum discussions and articles, but I still can not quite understand it. Here's my basic configuration: container > LoadedSWF file > MovieClip. I want to access this clip that is in the swf file loaded into the container.

    Loading code is inside a class that is directly associated with an empty MovieClip on the stage. Here are the relevant parts of the code:

    public var loadDrawing:Loader = new Loader;

    drawLoad = "E002.swf";

    loadDrawing.load (new URLRequest (drawLoad)); I loaded the drawing in loadDrawing

    That's essentially what I want, but it doesn't exactly work like this:

    jumpNumber = "j1". This is the name of the instance of the clip I want control

    loadDrawing.drawLoad.jumpNumber.x = 100;


    That way I can control this MovieClip which is in the swf file, which the magazine is. Also, I have to wait for the video to load completely before I try to access the elements contained in it, right?

    >>

    jumpNumber = "j1". This is the name of the instance of the clip I want control

    loadDrawing.drawLoad.jumpNumber.x = 100;

    If you want to use a string as you show here so you need to use the media access as follows:

    loadDrawing.drawLoad [jumpNumber] .x = 100;

    or else just like:

    loadDrawing.drawLoad.j1.x = 100;

    However, you also need to cast loadDrawing.content to a MovieClip to be able to do... If actual code would be like:

    MovieClip (loadDrawing.content) .drawLoad [jumpNumber] .x = 100;

    or else just like:

    MovieClip (loadDrawing.content).drawLoad.j1.x = 100;

  • How to get the size of the loaded swf file?

    final/public class main extends Sprite
    {

    public void main()
    {
    loaderInfo.addEventListener (Event.COMPLETE, _onLoadCompleted);
    }

    private void _onLoadCompleted(event: Event): void
    {
    var tw: int = stage.width;
    var e: int = stage.height;
    TSW var: int = stage.stageWidth;
    tsh var: int = stage.stageHeight;

    }

    }

    Above is my project simple as3 in flex builder 3.

    My screen resolution is 1920 * 1080, when debugging, the SWF is stretched to the full EI client area, but the stage.stageWidth is 500 and the stage.stageHeight is 375, stage.widht and stage.height are 0, who can tell me why and how to get the right size of the SWF, named the area size customer of EI in this situation?

    Thank you very much!

    The HTML wrapper can resize the SWF later, so wait a frame and recheck stageWidth/stageHeight.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • How to call the function lavel root & variable external loaded swf file

    I have little problem in as3.  I load 'mainmenu.swf' file "main.swf". through class loader. so now "main.swf" is children of parents 'mainmenu.swf' file how can call "main.swf" variable and function of "mainmenu.swf".

    The parent of the loaded swf file is the charger.  The main SWF is the parent of the charger.  Then to communicate with the main storyline of the loaded file can use:

    MovieClip (parent.parent) .someFunction ();

  • call the parent of a loaded swf file functions?

    Hi all

    I have a main Flash file that load other SWF files using loader objects.  I want to be able to call the methods of this main purpose since then in the loaded SWF files.  For example, I want the file loaded in order to add an event listener on the stage of the main file.  I found this example:

    http://flexcomps.WordPress.com/2008/09/01/AS3-calling-MyFunction-on-main-timeline-from-Loa ded - swf.

    That seems to do what I want, but I can't understand how to implement it in my setup.

    My "main" file that loads other sovereign funds is called "main.swf" and has a main document class.

    My loaded file is called start.swf and has a class of documents 'Start '.

    in my main constructor:

    var ethics_content:Loader = new Loader();

    ethics_content. Load (new URLRequest ('start.swf'));

    in the constructor of my departure:


    If (this.parent.parent! = null) {/ / IF the STATEMENT FAILS}
    var parentObj:Object = this.parent.parent as an object;
    trace ("parentObj has been found.'");
    } else {}
    trace ("this .parent .parent is null.");
    }

    stage.addEventListener (MouseEvent.CLICK, handle_click); GENERATES AN ERROR WHEN IT IS LOADED TO THE HAND. SWF

    trace ("step: ' + Stadium");  RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NULL WHEN IT IS EXECUTED IN THE HAND. SWF
    trace ("root:" + root); RETURNS AN OBJECT [START] WHEN RUN BY ITSELF OR WITHIN THE HAND. SWF
    trace ("parent: ' + parent"); RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NOTHING OF IN THE HAND. SWF
    trace ("this .parent:" + this.parent); RETURNS OBJECT STAGE ITSELF, NOTHING OF IN THE HAND. SWF
    trace ("root.parent:" + root.parent); RETURNS THE SCENE OBJECT BY ITSELF

    How to get to the scene of a loaded SWF file?  Or at least, how can I call a function in my main class from the loaded file start.swf so I can move the functionality I need the main.swf file?

    Any help is greatly appreciated.

    If your main swf loader is not added to the display list when it try {branch} is running, the charger will not have a parent.

  • To access the MovieClip instances in a loaded SWF file

    The situation as follows:

    loadedSWF.swf (published with Flash Player 8 AS2 or AS3 of Alpha Flash Player 9), contains on the symbols of the stage with the instance names: clipA, clipB, clipC, etc... No ActionScript is included in the file.

    In a Flex Builder 2.0 project, a component that extends mx.core.UIComponent load loadedSWF.swf:

    script
    var request: URLRequest = new URLRequest ("loadedSWF.swf");
    loaded var: Loader = new Loader();
    Loaded.Load (request);
    addChildAt(loaded,0);


    loadedSWF.swf successfully is displayed in the component's display list, but MovieClip instances that it contains are inaccessible.

    Its existence is verified:

    script
    trace (getChildAt (0)) / / result: [object Loader]
    trace (getChildAt (0) .root) / / result: [object _system_mx_managers_SystemManager]

    However, even if .root getChildAt (0) returns a mx.managers.SystemManager and mx.managers.SystemManager supports the numChildren property, trace (getChildAt (0).root.numChildren) survey error: 1119: access of the numChildren property possibly not defined through a reference with static type flash.display:DisplayObject.. Other methods like getChildAt(), etc. are also impossible to call. Direct access with getChildAt (0).root.clipA also throws an error, etc...

    Is it possible to access instances of the MovieClip on the stage of the loaded SWF file of a component that loads? I would appreciate any advice on this issue.

    a.Neko


    Note:
    The goal is to be able to load multiple clips into a component in a single loading of SWF file, then to instantiate the separately if necessary with addChild() and addChildAt() methods.

    Solution found:

    (Checked for loadedSWF.swf published with Adobe Flash Professional 9 Alpha Public)

    script (excerpt from Flex 2.0 AS3 component class)

    protected var clip: MovieClip = new MovieClip();

    protected final void requestSWF(value:String):void {}
    var request: URLRequest = new URLRequest (value);
    var asked: Loader = new Loader();
    requested.contentLoaderInfo.addEventListener (Event.COMPLETE, this.onRequestSWFComplete);
    requested. Load (request);
    return;
    };

    protected final void onRequestSWFComplete(event:Event):void {}
    event.stopPropagation ();
    This.clip = event.target.content.clipA; conversion of a local variable.
    this.addChild (this.clip);
    return;
    };

    this.requestSWF ("loadedSWF.swf");

    Result: clipA is added separately to the display of the component list.

    a.Neko

  • prevent the loaded swf to loopback

    Hello world

    I am loading a swf file into a swf of controller, and thanks to the help I received on this forum, I am able to control the swf loaded with play and pause buttons.  I have another question, and this is how to prevent the loaded swf file looping.  I wish that the swf loaded to play its last picture and stop.  I have the following code and it works with an error.  I'm assuming that the error is coming because the service runs before the swf file is loaded.

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

    pause_btn.addEventListener (MouseEvent.MOUSE_UP, onClickPause);
    play_btn.addEventListener (MouseEvent.MOUSE_UP, onClickPlay);

    function onClickPause(evt:MouseEvent):void {}
    MovieClip (myLoader.content) .stop ();
    }
    function onClickPlay(evt:MouseEvent):void {}
    MovieClip (myLoader.content) .play ();
    }

    the following works with a guy

    stage.addEventListener (Event.ENTER_FRAME, stopPlay);

    function stopPlay(e:Event):void {}
    If (MovieClip (myLoader.content) .currentFrame is {MovieClip (myLoader.content) .totalFrames)}
    MovieClip (myLoader.content) .stop ();
    trace ("End");
    }
    }

    The error reads as follows:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at controller_fla::MainTimeline/stopPlay()
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at controller_fla::MainTimeline/stopPlay()

    Once again, any help would be greatly appreciated.

    Thank you!

    -Dave

    Use COMPLETE earphone that kGlad offered to wait to assign the ENTER_FRAME listener.

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

    myLoader.contentLoadInfo (Event.COMPLETE, loadCompleteF);

    function loadCompleteF(e:Event) {}

    stage.addEventListener (Event.ENTER_FRAME, stopPlay);

    }

    addChild (myLoader);

    pause_btn.addEventListener (MouseEvent.MOUSE_UP, onClickPause);
    play_btn.addEventListener (MouseEvent.MOUSE_UP, onClickPlay);

    function onClickPause(evt:MouseEvent):void {}
    MovieClip (myLoader.content) .stop ();
    }

    function onClickPlay(evt:MouseEvent):void {}
    MovieClip (myLoader.content) .play ();
    }

    function stopPlay(e:Event):void {}
    If (MovieClip (myLoader.content) .currentFrame is {MovieClip (myLoader.content) .totalFrames)}
    MovieClip (myLoader.content) .stop ();
    trace ("End");
    }
    }

    You can also use a stop(); command at the end of the timeline of the swf file that is loaded instead.

  • How can I remove eventListener on the main time line off the loaded SWF?

    I have a Workbench where my main timeline is retouching of the marked sections. In one of the marked sections I have load and SWF file using greensock SWF Loader. In the loaded SWF file, there is a command where I need to remove/addEventListeners on the main timeline of the flash file in the loaded SWF file.

    The establishment with "MovieClip (parent.parent.parent.parent)." works for the navigation and loading and other functions. However, I get the error "1120: access of property unidetified" if I want to use a line of code like this:

    MovieClip (parent.parent.parent.parent) .mainNav_buttonsGroup_mc. Applications_b tn_mc.removeEventListener (MouseEvent.ROLL_OVER, overHandler_Applications_btn);

    I'm just writing this EventListeners again in the SWF file loading (thus repeating once again that they are specified on the main time line already) or there is a better method for her?

    appImgBtns_mc.testBtns2_mc.addEventListener(MouseEvent.CLICK, onClick_testBtns2);
    
    
    function onClick_testBtns2(event:MouseEvent) :void {
              /////////
                        ////disabling the button onClick by removeEventListener
                        //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Applications_btn_mc.removeEventListener(MouseEvent.ROLL_OVER, overHandler_Applications_btn);
                        //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Applications_btn_mc.removeEventListener(MouseEvent.ROLL_OUT, outHandler_Applications_btn);
                            //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Applications_btn_mc.removeEventListener(MouseEvent.CLICK, onClick_Applications_btn);
                        ////coloring the button
            MovieClip(parent.parent.parent.parent).Applications_btn_timeLine.play();
      
                        //Products_btn_mc
                        //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Products_btn_mc.addEventListener(MouseEvent.ROLL_OVER, overHandler_Products_btn);
                        //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Products_btn_mc.addEventListener(MouseEvent.ROLL_OUT, outHandler_Products_btn);
                        //MovieClip(parent.parent.parent.parent).mainNav_buttonsGroup_mc.Products_btn_mc.addEventListener(MouseEvent.CLICK, onClick_Products_btn);
                        //discoloring the button
            MovieClip(parent.parent.parent.parent).Products_btn_timeLine.reverse();
      
      
              MovieClip(parent.parent.parent.parent).sourceVar_AppPopUpsLoader_fromPrdcts="images/app_images/original/icysophistication_new_tl.swf";
              MovieClip(parent.parent.parent.parent).gotoAndPlay("appPopUps_fromPrdcts");
    }
    
    

    You can communicate with the main timeline by dispatching events from the child swf file.

    When the child Swf is loaded, dispatches an event, i.e. - dispatchEvent (new Event ("DoTimeLineCode"));

    Then on your main timeline, listen for the event and perform the desired functions:

    MovieClip (root) .addEventListener ("DoTimeLineCode", mainTimeLineFunctions);

    function mainTimeLineFunctions(e:Event):void

    {

         MovieClip(root).Applications_btn_timeLine.play();

    etc...

    }

    ChasingMovieClip(parent.parent.parent.parent) has always been a losing battle for me. It's best practice to use event dispatchers and listeners to instantiate "things" from the parent child paradigm.

    ~ Chipleh

  • Communicate with the embedded SWF files

    So if I have several external swf into one big, how can I communicate with each other?

    More specifically,.

    -the swf principal needs to know when the keys were pressed in a shipped, and he needs to tell you all the other included those on this subject.

    -embedded SWFs must intelligently resize and shuffle around each other, while keeping their origins coordinated in the upper corner.

    How can I go about it?

    As long as you mean by "shipped" you load swf files in you main file dynamically, then there is hope for all that you have planned.  If you mean that import you into the library by embedded and plant them in the chronology of the main file, that does not work.

    The other event and the event or Manager is coded in the main SWF.  Are the code loaded SWF to displatch events than the main file of the headphones for.  If simply scream of the loaded swf when they will, not for mutual assistance who hears him... allowing them to compile without dependence on the master file.

    If in the film loaded, which triggers the need to rehabilitate the main file in action would send an event as follows...

    dispatchEvent (new Event ("eventName")); name of the event you want to

    To add the listener in your main swf file, listen for the complete event of load on the Loader.contentLoaderInfo which is used to load the file.  In the complete event handler, add the listener for the event on the loaded swf file.

    function loaderCompleteHandler(e:Event) {}
    MovieClip (e.currentTarget.content) .addEventListener ("eventName", eventHandler);
    }

    function eventHandler(event:Event):void {}
    trace ("load swf triggered event");
    }

  • Calls to functions from loaded SWF files

    I have a Flex application that uses the SWFLoader object to load an external SWF file (which has also been developed in Flex) in a section of the page. The parent SWF file defines several variables and global functions in ActionScript I would use from all SWF files loaded in the SWFLoader. Is it possible in ActionScript to access the functions and variables that are defined in the SWF file the SWF load/child parent? The two SWF files are on the same domain, so there should not be problems of security.

    Peter thank you very much for your answer. I have tried loading in the same ApplicationDomain, but he did not what I expected from him. I, however, found the solution to my problem. I needed to understand how cross-script from a SWF file loaded the loaded SWF file. I discovered how and published a description of my conclusions on another thread that was no longer relevant to my question. The described solution has allowed me to do what I needed without touching the ApplicationDomain.

  • How to control the video swf loaded in the loading component?

    I have an external swf file loaded into the loading component. The external swf loaded into the component loading stops at departure. I want to play by a button outside the loading component that is located in the main swf movie. CAN SOMEONE HELP ME CONTROL THE VIDEO SWF LOADED INTO THE COMPONENT OF LOADING EXTERNAL?

    You can target the SWF via the content property of the UILoader.  If the name of the instance the UILoader is ldr...

    MovieClip (ldr.content) .play ();

  • How do I know if a loaded SWF file have the source code?

    Hi!, I need to know if a loaded SWF file have the source code. I develop an application running on iOS and admin can upload SWF files that show in the APP, but I must know before show (mobile Adobe AIR APP) or activate (PHP script server), if this SWF file have the source code for no show or enable him not it.,.

    Thank you!

    I have it!

    Only that we need to do is:

    1. If the first tank is:

    F-the swf is uncompressed

    C - compressed with Deflate

    Z - compressed with LZMA

    2. If it is compressed, uncompress it with the right method

    3. search MainTimeline string, if concluded the SWF actionscript so it is not found, the code is not actionscript.

  • Too late to load the new SWF after unloading the current SWF file

    Hello

    In our application, we use more than 10 sovereign wealth funds. When you cross one SWF to others try to unload currently load SWF and load a new. We were successful to unload the existing SWF, but the problem, takes too long to load SWF again (more than 5 seconds). Please suggest a useful method to overcome this time for best performance.

    get an idea of the following code snippet.

    Thank you


    public void SwitchSWFs (): void

    {

    If (null! = SystemAgent.getInstance () .currentSWFLoader)

    {
    SystemAgent.getInstance ().currentSWFLoader.unload ();
    SystemAgent.getInstance () .currentSWFLoader = null;
    trace ("HomeUI: previous swf unloaded!");
    }
    on the other
    {

    }
    addChild (SystemAgent.getInstance (.swfLoaderSecondSWF));
    SystemAgent.getInstance () .currentSWFLoader = SystemAgent.getInstance () .swfLoaderSecondSWF;

    }


    will call by clicking a button
    public void LoadSecondSWF (): void

    {
    SystemAgent.getInstance (). swfLoaderSecondSWF.load (new URLRequest ("Second.SWF"));
    SwitchSWFs();

    }

    The delay is when you test locally?

    One thing you might try is to load all Chargers present you at the front they are needed so that there is more likely that they are ready to be added to the display list when it is called for.  So instead of having the button trigger loading the SWF, just it call the switchSWFs function.

    Another thing, you could try if you keep it where the Triggers button load the corresponding file to assign an event listener for the charger to detect when it has finished loading and then have this listener event handler function calls the switchSWFs function.  At least this way, the current swf file is not unloaded until a replacement is ready and waiting.

  • How to determine the total number of images in the external .swf file loaded

    I have to be able to load both external .swf files and make them play in order. To do this, I need to know the number of images in the first .swf file so I can check _currentframe against _totalframes to determine when he is finished playing so that I can load another.

    Most of the stuff I see indicate that _totalframes on an external .swf can be determined by loading the .swf in a container clip and then check using a listener in the .onLoadInit. Like this:

    ------------------------------------------------------------------------------------------ ----------------------------

    this.createEmptyMovieClip ("tester_mc", 1);
    var mcListener:Object = new Object();

    mcListener.onLoadInit = {function (target_mc:MovieClip)}
    target_mc.onEnterFrame = function() {}
    If (this ._currentframe > = this ._totalframes) {}
    trace ("total frames =" + this ._totalframes);
    delete this.onEnterFrame;
    } else {}
    trace (target_mc._currentframe + "OF" + target_mc._totalframes);
    }
    }
    }

    var test_mc:MovieClipLoader = new MovieClipLoader();
    test_mc. AddListener (mcListener);
    test_mc.loadClip ("Ad_Group.swf", tester_mc);

    ------------------------------------------------------------------------------------------ -------------------------------------

    Unfortunately, this doesn't seem to work. The trace will always return a total number of frames of 1.

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I would appreciate any ideas on how to raise the total number of frames of an external .swf file or, Alternatively, put it another way when it's done playing. (Not only the loading, but play until the end.)

    TIA,

    C

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I wouldn't imagine. My guess is that the main scenario for the external swf file has only 1 frame and the rest of the animation is inside a movieclip in this timeline. You publish this swf? Can you open the FLA and check how many images is open on the main timeline?

    The approach that you have mentioned is about what there is. But he knows check a chronology. If there are many nested movieclips, it may be impossible to understand what timeline you really want to be 'THE' full chronology.

    If you have the FLA, you can have the video call function on the _root timeline which tells the main swf that has completed a movieclip or something like that.

    Also, I have in my head somewhere that I recently saw something that someone made similar to this one, but do not remember... If it appears in my head that I will post.

Maybe you are looking for