Go to specific frame of an external swf?

How can I load a specific frame/label of an external swf
file?
anyone?

me,
> How can I load a specific frame/label of an external
> swf file?
First, you load the external SWF file. There are a number of
ways to do
this. I recommend either the MovieClip.loadMovie() method or
the
MovieClipLoader class. This causes the external SWF to be
loaded into a
movie clip container. Once the external SWF has fully loaded,
invoke
MovieClip.gotoAndPlay() on the container clip and specify the
desired frame.
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design."

Similar Messages

  • Loading a specific Label in an external SWF

    I know if there is an answer to this one of you guys will
    have it so thanks in advance!
    Is it possible to goto a specific frame label in an external
    swf? I have my "main.swf" and I want to goto the frame label
    "images" in the "about.swf". Is this possible? If so, do you know
    how I can do this?
    Thanks again.
    Mike.

    Mike
    This sounds very similar to the problem I just posted which
    is just below yours.
    Might be worth us both keeping an eye on each others posts.
    Cheers,
    Mark

  • GotoAndPlay specific frame in external swf from main swf

    I have a main swf that loads 2 external swfs.
    I click on button to see content of external swf #1 and see stuff. I do something that causes external swf to show other stuff (i.e. not at beginning state)
    In the main swf I click on button to see content of external swf #2. External swf #1 content is made invisible and I see content of external swf stuff.
    NOW, if I click on button to take me back to see external swf #1, I see it's content in current state. I want to force it to start over again at frame #1 which will reset content.
    However, no matter what I try, I can't seem to control which frame to go to in external swf using gotoAndplay.
    Here is code in frame #1 of main swf to load external swfs:
    //load academic movie
    var swfLoader1:Loader = new Loader();
    container1.addChild(swfLoader1);
    var url1:URLRequest = new URLRequest("academic.swf");
    swfLoader1.load(url1);
    //load wisdom movie
    var swfLoader3:Loader = new Loader();
    container3.addChild(swfLoader3);
    var url3:URLRequest = new URLRequest("wisdom.swf");
    swfLoader3.load(url3);
    Here is code in frame 2 of main swf that checks button to see where to go in external swf:
    //academic button clicked
    function academicClick(event:MouseEvent){
       container3.alpha = 0;
       container3.visible = false;
       container1.visible = true;
       container1.gotoAndPlay(1); //this is where I am trying to force it to start at frame 1
       container1.alpha = 1;
    I don't want to reload the external movie to force it to start over.
    Any help would be much appreciated.

    You can easily control this by making the external swf to load with your movieclip, The below is the code snippet that clear on accessing the specific frame on external swf.
    //Loading clips content
    var ldr:Loader;
    var mcExt:MovieClip;
    //Loading
    loadswf("external.swf");
    function loadswf(tmp:String):void{
        unloadSwf();
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    //UnLoading
    function unloadSwf():void{
        if (ldr!=null){
            ldr.unloadAndStop();
            removeChild(mcExt);
            mcExt=null;
    //Intervals (The part you work on the specific frame within the external swf
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        if (num==1) mcExt.play();
        if (num==9) {
                mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                function skipfn(e:MouseEvent):void{
                    mcExt.stop();
                    mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
        if (num==mcExt.totalFrames){
            mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
            gotoAndStop("help");
    hope it solve

  • Is it possible to load an external swf at a specific frame?

    Hey! I've got a flash file which acts as the main menu for a
    program I'm developing. Everything works fine from the main menu
    however when you click to return to the main menu the whole main
    menu file reloads. Is it possible to use loadMovieNum( ) to go to a
    specific frame within the main swf file? If not, is there a way to
    do this?
    Here's the button code I'm using now:
    on (release) {
    unloadMovieNum(0); //unloads the current movie so we can
    reload the main menu
    loadMovieNum("DemoMainMenu.swf", 0); //reloads the main menu
    Thank you for whatever help you can provide! :)

    mcommini wrote:
    > Hey! I've got a flash file which acts as the main menu
    for a program I'm
    > developing. Everything works fine from the main menu
    however when you click to
    > return to the main menu the whole main menu file
    reloads. Is it possible to
    > use loadMovieNum( ) to go to a specific frame within the
    main swf file? If
    > not, is there a way to do this?
    First let me clarify one thing with you. Level zero is the
    main level on the flash
    player. By loading things in level zero you will remove
    current content and replace
    it with the new one. This is not a good idea because it works
    like purge, clears the
    player and from there on you can't maintain any functionality
    unless you reload the
    whole html document over again. Also, do not unload and load
    in the same time in the
    same level. Flash can hold single SWF per level, once you
    load content, whatever previously
    loaded will be automatically replaced, so just the loadMovie
    action and you all set.
    Good practice is to have the main level (zero) an empty base
    and than load and unload
    things in above levels, 1 and so on...
    > Here's the button code I'm using now:
    > on (release) {
    > unloadMovieNum(0); //unloads the current movie so we can
    reload the main menu
    > loadMovieNum("DemoMainMenu.swf", 0); //reloads the main
    menu
    > }
    >
    In regard to the load and go to. Yes it is possible but no
    matter what frame you want to
    go to,you need to load the whole movie first. I will come
    back to that in a second.
    While you execute the loadMovie action, you can set up a
    variable, for example:
    loadMovieNum("file.swf", 1);
    Variable="mcommini_01";
    Than in the loaded movie you have preloader which makes sure
    that the movie is loaded before
    playing and once done loading, make it jump to frame which
    has IF ELSE condition in some kind
    of loop, using setInterval or Enterframe. That condition
    checks for the variable value and based
    on it proceed to particular frame.
    That's why I told you not to clear level zero, if you set
    variable and load movie in that level
    in the same time, all the information will be gone and you
    have totally no reference point to
    get the variable from.
    You could as well use shared object which is native form of
    Flash's cookies. Write SOL file into
    user drive temp folder, than read it from the other file and
    go to frame based on the given value.
    Best Regards
    Urami
    Beauty is in the eye of the beer holder...
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Jumping to a specific frame in another movie

    I'm wondering how to jump to a specific frame in an external
    movie. I'm not using the loadmovie command so I don't think the
    _level command will work. I just have two swf movies playing on the
    same page. I need to have a button in Movie A when released will go
    to a certain frame in Movie B. Thanks!

    well this certainly should work if the code is on the main
    timeline, and there is nothing else. However when you say
    'scrubber' do you mean that your 'testing' the movie by pressing
    'enter' while in the IDE, so that you're actually 'seeing' the
    playhead move? If this is the case, yes, no actions will execute.
    To test the swf file, use Ctrl+Enter (or Command+Enter on Mac) to
    run an actual 'test'

  • External swf path problem

    Hi there,
    I've just added some external swf.'s to my site which contain
    various slideshows and galleries which now don't work at all. I
    understand that all the paths in my external swf.'s containing
    _root will assume that the main timeline is now the _root movie, so
    I wondered if there might be a quicker way of correcting all the
    paths without having to go through each one individually as there
    are literally hundreds!
    Any help would be greatly appreciated. Many thanks.

    Hey batchas07,
    Thanks for getting back to me. Erm, I'm pretty new to flash,
    (the actionscript side of it anyway), so I didn't really follow
    your first solution. I'm currently using Flash MX so would that
    still work?
    I read somewhere else to try the 'this._lockroot = true;'
    script in the first frame of my external swfs. but this doesn't
    seem to have done the trick either?
    To give you a bit more of an idea, I'm building a site which
    has five links at the bottom of the stage which each take you to a
    different container movie clip, (each with an instance name of
    'holder'), which each of the external swfs load in to. I'm using
    the (loadMovie("external.swf", "holder") ) method of getting the
    movies. All the movies load in fine, but as some of them are
    slideshows with movie clips inside them I'm guessing their paths
    will all be wrong which is why they don't work. The only way I have
    managed to make the main movie recognize the external swfs is to
    add 'holder.' after '_root.' to all the paths to buttons and movie
    clips in these external swfs, but doing this to all of them will
    take a long time.
    Really not sure why the 'this._lockroot = true' method isn't
    working out for me???
    Thanks again for the help.

  • Component Loader resizing external swfs

    Hi. Fairly new to Flash. I'm putting together my first full
    Flash site. The tutorial I'm following along with for some
    assistance is written for Flash8, but I'm using CS3. To try to
    minimize differences, I'm doing my files in Actionscript 2.
    I've used an instance of the component Loader to load
    external swfs (my pages) into the content portion of my main swf.
    The problem I've run into is the loaded swfs are showing up at
    different sizes. For ease of layout, the document sizes of the
    external swfs are exactly the same as the mx.controls.Loader
    instance on my main swf. But when they load, one is coming in
    slightly larger than the original size, one nearly a quarter of the
    size it should be. Everything else works.
    In playing around to try to troubleshoot, I made one change
    to my home swf (the external that loads immediately with a
    Loader.contentPath command. This one had been loading slightly
    enlarged), I changed a guide layer so it was a regular layer, no
    longer a guide, then it loaded at the right size. When I changed
    the layer back to a guide, it loaded somewhat enlarged again. I
    tried turning off the guide layer on the other swf that was loading
    small, it didn't help. I'm going nuts trying to figure it out.
    I thought maybe it might have to do with the fact that some
    elements start outside the document frame of the external swfs and
    slide in, so I masked all layers to the size of the document. That
    didn't help. Is there some scale setting for the Loader component
    that I'm not aware of? That would cause the external swf to scale
    up or down to fit the size of the Loader instance?
    Any help would be appreciated. Thanks

    Thanks. I tried a few more searches in Flash's Help for
    Loader scaling and resize and found the scaleContent property, was
    just coming back here to say nevermind and saw your response.
    Sometimes it takes writing out the problem to spark more
    troubleshooting inspiration.
    BTW, changing Loader.scaleContent to false did solve my
    problem. :)

  • Preloader ignores external swf's actionscript

    Hey guys
    I have an External.swf file that is a video. The swf is 1135 frames long and running just fine by itself, stopping as I want when the actionscript says stop(); on the first frame and looping the end of the clip with gotoAndPlay(837).
    The preloader SwfLoader.swf linked to the External.swf shows the percentage of bytes loaded as it should. However, it runs the video (sound playing in the background) while the preloader shows the loading progress I think it's because it doesn't load the first frame first.
    Once the external swf is loaded, it plays the video again, still ignoring the first actionscript frame that says stop(); and the last frame gotoAndPlay(837).
    Thank you.
    Here is the preloader's actionscript on the first and only frame:
    import flash.geom.*
    import flash.display.*
    var loadurl:String = "External.swf";
    var nDepth:Number = 0;
    var nWidth:Number = 200;
    var nHeight:Number = 20;
    var nPadding:Number = 3;
    var cLoader:MovieClipLoader = new MovieClipLoader();
    var oListener:Object = {onLoadInit:onContentLoaded};
    var mcLoader:MovieClip = this.createEmptyMovieClip("Loader_MC", 0);
    var mcContent:MovieClip = this.createEmptyMovieClip("Content_MC", 1);
    var mcLoadBarBg:MovieClip = mcLoader.createEmptyMovieClip("LoadBarBg_MC", nDepth++);
    var mcLoadBar:MovieClip = null; //Duplicated later with mcLoadBarBg
    var txtPercLoad:TextField = null; //Create after duplication
    var cMatrix:Matrix = new Matrix();
    mcLoader._alpha = 0;
    cMatrix.createGradientBox(nWidth, nHeight, 0, nPadding, nPadding);
    cLoader.addListener(oListener);
    mcLoader.lineStyle(1, 0x000066, 100);
    DrawRect(mcLoader, 0, 0, nWidth, nHeight);
    mcLoadBarBg.lineStyle(1, 0x0000FF, 0);
    mcLoadBarBg.beginGradientFill("linear", [0x006699, 0x0066FF], [100,100], [0, 255], cMatrix, SpreadMethod.PAD);
    DrawRect(mcLoadBarBg, 0, 0, nWidth - nPadding*2, nHeight - nPadding*2);
    mcLoadBarBg.endFill();
    mcLoadBar = mcLoadBarBg.duplicateMovieClip("LoadBar_MC", nDepth++);
    txtPercLoad = mcLoader.createTextField("PercLoad_TXT", nDepth++, 0, 0, nWidth, nHeight);
    mcLoadBar._alpha = 80;
    mcLoadBarBg._alpha = 30;
    Translate(mcTextMask, nPadding, nPadding);
    Translate(mcLoadBarBg, nPadding, nPadding);
    Translate(mcLoadBar, nPadding, nPadding);
    mcLoadBar._xscale = 0;
    mcContent._alpha = 0;
    mcContent._lockroot = true;
    mcLoader._x = Stage.width/2 - mcLoader._width/2;
    mcLoader._y = Stage.height/2 - mcLoader._height/2;
    txtPercLoad._x = mcLoader._width/2 - txtPercLoad._width/2;
    txtPercLoad._y = mcLoader._height/2 - txtPercLoad._height/2;
    SetTextFormat(txtPercLoad, "0%");
    mcLoader._alpha = 100;
    cLoader.loadClip(loadurl, mcContent);
    _root.onEnterFrame = function()
       var nBytesLoaded:Number = mcContent.getBytesLoaded();
       var nBytesTotal:Number = mcContent.getBytesTotal();
       var nPercLoaded:Number = Math.round(nBytesLoaded / nBytesTotal * 100);
       if(nPercLoaded > 0)
          SetTextFormat(txtPercLoad, nPercLoaded.toString() + "%");
                mcLoadBar._xscale = nPercLoaded;
    function onContentLoaded(Void):Void
       //trace(_root + "::onContentLoaded");
       SetTextFormat(txtPercLoad, "100%");
       cLoader.removeListener(oListener);
       delete _root.onEnterFrame;
       delete oListener;
       delete cLoader;
       _root.onEnterFrame = function()
          //trace(_root + "::onContentLoaded::_root.onEnterFrame");
                var nInc:Number = 5;
                mcLoader._alpha -= nInc;
                mcContent._alpha += nInc;
                if(mcLoader._alpha <= 0) startLoadedContent();
    function startLoadedContent(Void):Void
       delete _root.onEnterFrame;
       mcLoader.removeMovieClip();
       mcContent._alpha = 100;
       mcContent.play();
    function DrawRect(mc:MovieClip, nX:Number, nY:Number, nW:Number, nH:Number, nR:Number)
       trace("DrawRect in: " + mc);
       if(nR == undefined) nR = 6;
       mc.moveTo(nX+nR,nY);
       mc.lineTo(nX+nW-nR,nY);
       mc.curveTo(nX+nW,nY,nX+nW,nY+nR);
       mc.lineTo(nX+nW,nY+nH-nR);
       mc.curveTo(nX+nW,nY+nH,nX+nW-nR,nY+nH);
       mc.lineTo(nX+nR,nY+nH);
       mc.curveTo(nX,nY+nH,nX,nY+nH-nR);
       mc.lineTo(nX,nY+nR);
       mc.curveTo(nX,nY,nX+nR,nY);
    function SetTextFormat(txtField:TextField, sText:String)
       var txtFmt:TextFormat = new TextFormat();
       sText = "Loading... " + sText;
       txtFmt.font = "Verdana";
       txtFmt.align = "center";
       txtFmt.size = 11;
       txtFmt.color = 0x000066;
       txtFmt.bold = true;
       txtField.selectable = false;
       txtField.text = sText;
       txtField.setTextFormat(txtFmt);
       txtFmt = null;
    function Translate(mc:MovieClip, nX:Number, nY:Number):Void
       mc._x = nX;
       mc._y = nY;

    Hi kglad,
    The external swf is a movieclip (flv embedded with an AS3 layer to control the timeline) exported as an swf file .
    The first frame of the external swf is just stop();
    I didn't know the proloader code was AS2 though
    The preloader works fine with the external swf locally, but the problem happens when I run them from my server.
    The external swf itself and its code works fine from the server, both combined don't, so I guess the problem comes from the preloader. Probably because of the AS being 2 insted of 3.

  • Unload external swf

    I loaded an external SWF file, now I need to understand how to unload the external SWF file. Is it possible to add the code to the last frame of the external SWFs internal timeline, so when it exits the last frame, it unloads itself.
    The script to load the SWF is below. Can I add the unload code to the last frame of timeline of the SWF?
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader=new Loader();
    var defaultSWF:URLRequest = new URLRequest("c1room.swf");
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);

    in the last frame of your loaded swf:
    if (this.parent is Loader) {
        this.parent.parent.dispatchEvent(new Event("playCompleted"));
    and on the timeline that contains yoru loader in your main loading swf:
    this.addEventListener("playCompleted",f)
    function f(e:Event){
        removeChild(ldr);  // where ldr is your loader that loads your external swf
        ldr.unload();
        ldr=null

  • How to load and unload more than one external swf files in different frames?

    I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
    I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
    Thanks

    Look into using the Loader class to load the swf files.  If you want to have it happen in different frames then you can put the code into the different frames.

  • How do I load an external swf at a frame after ClickToGoToAndStopAtFrame?

    Hi, I'm quite new in working with AS3.
    I am designing a site with a menupage with buttons.
    Some of these buttons are linked to a frame that contains an external swf, which is a portfolio.
    By pressing the buttons 'AQUAREL" and "OLIEVERF" you will go to another frame and the swf-portfolio shows up.
    Now the problem is: sometimes it seems to work, sometimes it doesn't.
    You can check out yourself at www.erwinvanzijl.nl
    Is there a better whay of programming these functions?
    Am I doing something wrong or is there a better way to do it?
    This is the actionscript that I put on the second frame where the swf is to show up:
    stop();
    var Xpos_2:Number = 52;
    var Ypos_2:Number = 59;
    var swf_2:MovieClip;
    var loader_2:Loader = new Loader();
    var SWF_2:URLRequest = new URLRequest("aquaportfolio.swf");
    loader.load(SWF_2);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    btn_menu.addEventListener(MouseEvent.CLICK, unloadcontent_2);
    function unloadcontent_2(event:MouseEvent):void {
    removeChild(loader);
    gotoAndStop("menu");

    For the unloading it is a simple matter of...
    function unloadcontent_2(event:MouseEvent):void {
       loader.unload();
       removeChild(loader);
       gotoAndStop("menu");
    Follow what Dave has to say... he's far more experienced than I.  I was too hung up wondering what swf2 was all about to ntoice there were two loaders involved in the code.

  • How search text in current frame of external swf?

    Hello Everyone
    I am loading an external swf using loader.
    How do search and highlight the text in the current frame only?
    Is there a frame class which I could use?
    Thanks

    This is not likely to be possible in the general case, depending on what you mean by "searching text"
    For instance, a Word doc might have the text "Hello, world!" when viewed in Word, but that doesn't mean that the sequence of characters 'H', 'e', 'l', 'l', 'o', etc., exists in the file. There might be one letter, then some binary data indicating that the next letter is some other font or color, then one more letter, then more binary data, etc.
    Conversely, there could be textual metadata in a "binary" file that a person reading the file in the appropriate viewer would never see. Unless you know the details of the format you're reading, you won't be able to distinguish that from "real text".
    And what do you mean "strings" is not efficient? Have you tried it? Does it do what you want? Did you measure and determine that it does not meet your well-defined performance requirements? It's unlikely you'll be able to write code that does the same thing as "strings" but more "efficiently."
    The first step is to put more realistic boundaries on your requirements and define them more precisely. "Extract text from any binary file," is not a valid, meaningful, or reasonable requirement.
    EDIT: I may have misunderstood your requirements. I thought you wanted to "extract all text" from binary files. If that's not what you meant, and you're looking more to replicate grep, then follow Joachim's advice.
    Edited by: jverd on Mar 29, 2010 1:33 PM

  • Can an swf movie be opened on a specific frame?

    When I call up an Flash-generated swf movie in its own
    browser window via a navigation bar button, it always open on its
    first frame. Is there a way to tell the browser in conjunction with
    the getURL command to open at a specific frame other than frame 1?
    I can't find an Actionscript code sample that allows this while
    using getURL. Or is there some other way -- e.g. appending the swf
    file with frame number in its HTML page in some way, using
    Javascript, FSCommand, etc?
    Jody

    Maybe this will help
    http://www.adobe.com/devnet/flash/articles/deep_linking.html

  • Load external swf into a specific _level

    Hi there,
    I am loading an external swf into the mc 'image' using:
    image.loadMovieNum("portfolio/100_design/1.swf", 1);
    Every time a new image loads, I want it to load the level above, ie:
    image.loadMovieNum("portfolio/100_design/1.swf", 2);
    Is there a way this can be done dynamically. For example, "current level + 1"
    Many thanks

    is the first frame of your loaded swf's empty?  if yes, then no problem using _levels.
    if not, do you mind a momentary flash when your next swf loads and before its _alpha is assigned 0 and then faded-in?  if you don't mind, then no problem using _levels.
    if you do mind that momentary flash, then using _levels will be more complex than using empty target movieclips.  is there some good reason to use _levels instead of target movieclips?

  • Using Actionscript 3, how do I code a button in a parent file to load at a specific frame in another swf file?

    Using Actionscript 3, how do I code a button in a parent file to load another swf file at a specific frame?

    You can either place the loading code in the desired frame of the parent file, or continuously monitor the currentFrame proiperty of the parent file and do the loading when the value matches the desired frame number.

Maybe you are looking for