[HELP] External SWF with Movieclip Preloader included

Hello world

I have a problem headaching me throughout the afternoon:

Inside of a SWF I want to load an external SWF inside an empty movieclip. On this image, I have:


emptymovieclip.loadMovie ("external.swf");

Inside the external SWF, I have a Preloader in the first image, consisting of a movieclip to 128frames. I want to appear from the first image to the 128th associated percentage of loading. When loaded, go to fram 2 and this is the script on the movieclip:

onClipEvent (load)
{
   
total = this.getBytesTotal();
}
onClipEvent (enterFrame)
{
   
loaded = this.getBytesLoaded();
   
percent = int(loaded / total * 128);
   
text = "Loaded " + percent + "%";
   
gotoAndStop(percent);
    if (
loaded == total)
    {
       
this.gotoAndStop(2);
    }

}

Needless to say that it does not and that is why I am asking your help.

All stops on the first frame of the Preloader.

I'm a noob to bit for script-stuff that I'm not a programmer, I'm sorry...

HEEEEEELP!

If you put

_lockroot = true;

in the main timeline of the external swf file, it refers to its own _root whenever you use a reference to _root in its code.  Otherwise, it refers to the _root of the main file that loads the swf file.  If it works with _root when you perform the external file separately, and so it should wotk if you add this line.

Tags: Adobe Animate

Similar Questions

  • Loading and unloading of the external swf with buttons

    Alright. Here's the deal. I have 7 buttons on my main page, on the left side of the screen. I want the buttons to the external swf on the right to load and unload then when you push a different button. Should I make a table? Do I need a clip vacuum film to load each swf in?

    ///////////////Buttons/////////////////////

    graphics - load the thumbnail scroll bar

    mixed technique - load the thumbnail scroll bar

    photography - load the thumbnail scroll bar

    illustration - charge the miniature scroll bar

    Words - list history of charges

    Contact - contact information of charges

    charges about - bio

    ////////////////////////////////////////////

    Thanks for any help.

    If you are unable to publish for flash player 10, you will need to use the instead of unloadAndStop() unload() method.

  • How to pass parameters to external swf with the loader?

    Hello everyone

    I am loading an external swf file using the charger. It's a pdf file converted to swf format.

    How do I pass parameters to the file so that I can highlight certain words in the file?

    Thank you

    Hello everyone

    I solved this problem.

    Thank you

  • With the help of external swf twice

    Hello..

    How to use the same external swf with its vars in two clips?

    var icon1_mc:MovieClip = new MovieClip();

    var icon2_mc:MovieClip = new MovieClip();

    var iconsLoader:Loader = new Loader();

    iconsLoader.load (new URLRequest("data/icons.swf"));

    iconsLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, iconsLoaded);

    function iconsLoaded(event:Event):void

    {

    Here, I want to add (iconsLoader.contentLoaderInfo.content) for icon1_mc & icon2_mc

    }

    Thank you

    Thank you again... 'S done it with greensock SWFLoader class

    com.greensock.loading import. *;

    import com.greensock.events.LoaderEvent;

    var icon1_mc:MovieClip = new MovieClip();

    var icon2_mc:MovieClip = new MovieClip();

    var iconsSWF:SWFLoader = new SWFLoader ("data / icons.swf", {onComplete:completeHandler});})

    function completeHandler(e:LoaderEvent):void {}

    var _icons: Class = e.target.getClass("icons"); "icons" is a class of symbol in library

    icon1_mc = new _icons();

    icon1_mc.x = 10;

    addChild (icon1_mc)

    icon2_mc = new _icons();

    icon2_mc.x = 135;

    addChild (icon2_mc)

    }

    iconsSWF.load ();

  • Need help to load an external SWF

    I'm not very proficient in Flash, so any help will be greatly appreciated. I am trying to load an external SWF with the following code:

    T1_Bttn_BloodCar.onRelease = function() {}

    (" t1_images_mc.loadMovie("images/T1_Gallery/BloodCar_SWF/T1_BloodCar.swf ");

    t1_images_mc._alpha = 0;

    It loads the SWF file, but it is not playing correctly when I test it. Here's how the loaded movie is supposed to look like:

    http://www.theroboteye.com/T1_BloodCar.html

    But instead, he plays without the transitions, like this:

    http://www.theroboteye.com/TRE2009b.html

    I tried to figure this out for a few days and have tried to add "this ._lockroot = true;" to the SWF I am trying to load, but I can't play properly. Can someone tell me what I am doing wrong? Thanks in advance.

    Try using MovieClipLoader (loadClip method) class rather than the loadMovie method.  In this way, you can have a listener who expects the movie to be loaded and then pull it in-game, by assigning actions and properties after the fact.

  • Load an external SWF file without overwriting my container SWF (AS2) file

    Hello world

    I want to load an external SWF with AS2, but file without overwriting my container file. How can I achieve this? What is the correct code?

    Here is the code I use :

    loadMovieNum ("external.swf", 0);

    countdown = function() {}

    trace ("OK");

    }

    countdownIt = setInterval (countdown, 1000);


    It works well, but as I said, it overwrites my container SWF file. If I load into level 1, my container file works but not the one I try to load... .



    Can someone help me with this, please?

    Try to use the loadMovie method... meaning container.loadMovie.  See below for an explanation: Load external in another SWF SWF

    If the loaded file does not work when you load it, it is probably because you have references to _root in there who do not find the expected _root.  You must set the file loaded _lockroot property to be true.

  • 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.

  • Var does not work if I load external swf.

    I have a set with two pages or labeled sections on the main timeline. I have the code for actions happening in each section page / labeled brake. On the first page, there is a VAN specified for each button

    var sourceVar:String;

    Then each button using this var to load a video in FLV player (the player itself is built in the second section of page / labeled).

    function JTV_SatelliteCenterpiece_PlayVideoPopUp(event:MouseEvent): void {}

    sourceVar = "howto_popups/jtvs18w12_LG30.flv";

    gotoAndPlay ("flv_pb");

    }

    where "flv_pb" is the label of the second section of page / labeled. It is on this second page/section labeled a FLVPlayback component named "SWF_flv2", which uses this var

    SWF_flv2.source = sourceVar;

    All above works. My problem is that I decided to take out all the elements (image buttons) in the first section. So, I saved them as an external SWF with all the code in the external swf file.

    Then link the buttons to the section 'flv_pb' in this way:

    function JTV_SatelliteCenterpiece_PlayVideoPopUp(event:MouseEvent): void {}

    MovieClip (parent.parent.parent).sourceVar="howto_popups/jtvs18w07_LG30.flv';

    MovieClip (parent.parent.parent) .gotoAndPlay ("flv_pb");

    }

    The link to the "flv_pb" section works, tells me should be putting up with "MovieClip (parent.parent.parent).".

    However the code as before with the setting up of (being in the external swf file):

    sourceVar = "howto_popups/jtvs18w12_LG30.flv";

    gotoAndPlay ("flv_pb");

    works as well, I don't know why?

    The problem seems to be in the var

    I have an error message 1120: access of undefined property sourceVar

    It is referred to the code in the second page labeled section "flv_pb".

    SWF_flv2.source = sourceVar;

    What are my actions?  I kept the code in the external swf file. Should I move it to the main timeline if possible? Should I reference only the var in the main time line?

    All code must be in the beginning of the time line, rather be broken into sections?

    If you want to use the UILoader component, then its 'content' property is what points to the swf file you load into it.

  • Content of external swf showing outside video clip

    untitled.JPG

    This is my final project for a multimedia class, I have a link which is here

    http://mmproduction.blogspot.com/2009/11/final-project-NYTimes-food-issue.html

    Basically I have a movie clip instance (loader_mc).  I have buttons for loading external swf with this code:

    Stop();

    total_photos = 20;
    function get_photo (newnumber) {}
    current_photo = 'do' + newnumber + ".swf";
    loader_mc.loadMovie (current_photo);
    }

    Next button:

    {We (Release)}
    If (n < total_photos) {}
    n ++ ;
    } else {}
    n = 1;
    }
    get_photo (n);
    }

    Previous button:

    {We (Release)}
    If (n > 1) {}
    n-- ;
    } else {}
    n = total_photos;
    }
    get_photo (n);
    }

    I want keys to load the SWF - to give users better ergonomics.  So this is the code I have for each button:

    We (Release)
    {
    loadMovie ("do1.swf", "loader_mc");
    }

    But when I run my main swf - external load swf content outside the area I want to either--because in the external swf content, I put things out of the scene - how to hide the content, I don't want to see?

    I looked at your file (s) and I guess I learned something new... If you select _without as police, it behaves as if you had a dynamic textfield.  I think it's maybe because specifying the _without police ended by saying the file choose a font of the user's machine that satisfies without criteria... so it does not incorporate the police as it normally would.

    The cure for this is to specify a truly named font, such as arial or verdana, or what font you have on your system that you want to use.

    To the extent where where to place the mask, if all these different numbered links in an external swf that had to be hidden as the one you provided, then put the mask in the main file on the layer above the layer of doclip... which means that the mask will be on top of the doclip layer which contains the loader_mc object.  This will be the approach less labour.

    A minor suggestion.  In the swf you load, you must move the layer to the first text field that moves so that it is above the three layers with the photos.  This way the white of the pictures is not visible as they move through the text.

  • How can I load an external SWF into a clip that is inside another video clip?

    Hello.

    I create my first flash (actionscript 3.0) Web site, but I'm stuck with a visual effect, I want to create.
    I have a window on my website called contentWindow. Whenever you click on a button, this window is supposed to leave the scene, loading the requested content and back on the scene.
    The sliding window is a clip with 83 frames, 21 to enter the stadium, 21 to leave the scene once again, 20 for anything (it's just to simulate the load time) and 21 to the back on the scene.

    Now, my goal is, when the user clicks a navigation button, the window leaves the scene, loading an external SWF with the content and then returned to the scene.

    I have the clip of 'window' with an instance name of "contentWindow". Inside there is an another film clip with an instance name of "contentLoader. The content that the user has requested must appear inside the 'contentLoader.

    Now, when the contentWindow leaves the scene, I get this error message:

    Quote:
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at rwd_fla::MainTimeline/trigger()
  • 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 can I add a preloader with an external swf

    HELO, I have this preloader:

    onClipEvent (load) {}

    total = _root.getBytesTotal ();

    }

    onClipEvent (enterFrame) {}

    charge = _root.getBytesLoaded ();

    % = int(loaded/total*100);

    text = p + '% ';

    gotoAndStop (percent);

    if (load == total) {}

    _root.gotoAndPlay (2);

    }

    }

    and on a movie clip with the name of all pages in frame 6 I load some swf with this files:
    swf_path = "mysongs.swf"
    loadListener.onLoadProgress = {function(target_mc:MovieClip,_bytesLoaded:Number,_bytesTotal:Number):Void}
    info. Text = Math.round ((bytesLoaded/bytesTotal) * 100) + "%";
    };
    loadListener.onLoadInit = {function(target_mc:MovieClip):Void}
    info. Text = "";
    };
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener (loadListener);
    mcLoader.loadClip (swf_path, swf_loader);
    How do I preload too these files with the preloader? Is it safe to use only the chassis 6 inside the preloader code?

    you don't need two preload, but it will be more complicated to use a preloader to load an external file and your main swf.   again, give your preloader instance name (for example, preloader_mc), delete all the code attached to it, in a table, a list of all the SWFs you want to load and display in your preloader (unless your main swf):

    var tl:MovieClip =;

    var swfA:Array = [swf_path1, swf_path2,...];

    Create your load target swf_loader1, swf_loader2 etc.

    var loadIndex:Number = 0;

    function loadF() {}

    clearInterval (preloadI);

    preloadI = setInterval(loadProgress,500);

    TL ["swf_loader" +(loadIndex+1)] .loadMovie (swfA [loadIndex]);

    function loadProgressF() {}

    var f1:Number is tl ["swf_loader" +(loadIndex+1)] .getBytesLoaded (["swf_loader" +(loadIndex+1)] /tl .getBytesTo tal());.

    var f: Number = (f1) / (swfA.length + 1) + loadIndex / (swfA.length + 1) + tl.getBytesLoaded () / (tl.getBytesTotal (*(s wfA.length+1)));

    p = Math.round (100 * f);
    preloader_mc. Text = percent + "%"; "

    preloader_mc.gotoAndStop (percent);

    {if(F1>=1)}

    loadIndex ++;

    If (loadIndex<>

    loadF();

    } else {}

    {if (TL.getBytesLoaded () > = TL.getBytesTotal ())}

    clearInterval (preloadI);

    }

    }

    }

    }

  • With the help of a button to load and unload the external SWF in AS3?

    How can I use a button to load and unload a sequence of external SWF files, as a Next button and previous?

    I don't know if it will work because apparently you are trying to load a swf AS1/2, but try

    change the line to be...

    _swfTempClip = MovieClip (event.target.content);

    If this does not work, then you will need to create _swfTempClip as a new MovieClip and add the event.target.content to this MovieClip using addChild().

  • How to get an external SWF to start playing only when the preloader is finished?

    Yet another dilemma with my external swf.
    How can I get the external SWF only start playing once the preloader has finished loading the entire file.
    Currently when the SWF file is it already started playing in progress through the file.
    Any suggestion would be appreciated... my code is fixed as follows:

    After a hunt more through discussion of other people, I think I have the solution (not sure if it is the best way, but it seems to work). My new code is detailed below, including:

    MovieClip (myloaderDB01.content) .play ();

    Then I had to change my external SWF by the first blank frame and put a stop();
    Now when the preloader does its job the external SWF plays until it is supposed to - YAY.
    Hope this helps others...
    Any other suggestions out there with regard to a better way to do this work would also be appreciated.

  • Problem with loading an external swf of in an external swf...

    OK, everything was going well on a Web site project, I worked, until yesterday. I will try to explain the whole scenario first, and I'll put the code here too so anyone can try to understand what the problem is. Here is a breakdown of the site:

    1) there a MAIN SWF file that plays an intro and then stops on the last image with the Navigation buttons 'hand'.

    2) in the root folder where the MAIN SWF resides, there is another folder called "sovereign wealth funds", which contains six main external navigation pages, but also another folder called "galleries" which contains additional external SWFs for six pages in the gallery.

    3) on one of the layers of the MAIN SWF, there is a clip called 'mySWFLoadingClip' that the buttons of Navigation of the 'hand' loading and unload pages external to swf. It all works perfectly. The beginning of the problem to the next step. This is the code I used for the buttons of navigation on the MAIN SWF scenario:

    var Xpos:Number = 0.0;
    var Ypos:Number = 0.0;
    var swf:MovieClip;
    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("swfs/home_page_swf.swf");

    Loader.Load (defaultSWF);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClip.addChild (loader);
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////

    Function universal BTNS
    function btnClick(event:MouseEvent):void {}

    this.mySWFLoadingClip.removeChild (loader);
    var newSWFRequest:URLRequest = new URLRequest ("SWFs /" + event.target.name + ".swf");
    Loader.Load (newSWFRequest);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClip.addChild (loader);
    }
    Listeners of BTN
    home_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    portfolio_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    services_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    about_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    team_page_swf.addEventListener (MouseEvent.CLICK, btnClick);
    contact_page_swf.addEventListener (MouseEvent.CLICK, btnClick);


    4) one of the external navigation SWF pages is called "portfolio_page_swf" and gets loaded into the moveclip of 'mySWFLoadingClip' on the MAIN SWF. This is where the problem begins. The "portfolio_page_swf" has six buttons facing an additional external swf in the file galleries. Now when I open the file "portfolio_page_swf" to test if the buttons work, they work perfect. When I click the buttons, the external swf gallery files appear as they should. But the problem is that when I open the "MAIN SWF" file to test the site, I can click on the main Navigation buttons and they work. I click the portfolio button on the time line of Hand SWF and place of 'portfolio_page_swf' on the stage as it should, but when I click the buttons located in the 'portfolio_page_swf' galleries are not displayed. The page "portfolio_page_swf" buttons work only if I open the file 'portfolio_page_swf' directly. The following code is used in the "portfolio_page_swf":

    var Xpos:Number = 0.0;
    var Ypos:Number = 0.0;
    var swf:MovieClip;
    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("galleries/gallery_print_swf.swf");

    Loader.Load (defaultSWF);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClipGALLERY.addChild (loader);
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////

    Function universal BTNS
    function btnClick(event:MouseEvent):void {}

    this.mySWFLoadingClipGALLERY.removeChild (loader);
    var newSWFRequest:URLRequest = new URLRequest ("galleries /" + event.target.name + ".swf");
    Loader.Load (newSWFRequest);
    Loader.x = Xpos;
    Loader.y = Ypos;
    this.mySWFLoadingClipGALLERY.addChild (loader);
    }
    Listeners of BTN
    gallery_print_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_packaging_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_web_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_video_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_others_swf.addEventListener (MouseEvent.CLICK, btnClick);
    gallery_logos_swf.addEventListener (MouseEvent.CLICK, btnClick);

    If anyone can help understand me this I would really appreciate. This is a very important project and the deadline is coming up very soon. Please help me understand how to load an external SWF on the main timeline and then charge an additional external swf within the first external swf. I'm puzzled.

    If I'm following the structure you describe, it's probably a problem of targeting.  If you load a swf into another swf I think the scenario is the same that if you load a swf in a web page...  The charging base is the document down the chain, which is your main swf if you test Flash (otherwise it would be so stable web page in a web page).  So when your portfolio is responsible in the hand, it's like living in the folder of the hand, so your swf portfolio should probably include sovereign wealth funds in targeting... as in...

    var defaultSWF:URLRequest = new URLRequest("swfs/galleries/gallery_print_swf.swf");

Maybe you are looking for