Checking an external swf is loaded?

Hi
I'm loading an external .swf via typing the swf name into an input text field and hitting a submit button.
The swf loads fine, but I'm trying to incorporate updating a status text field on a succesful load or if there is an error during loading.
I can't find my mistake in the code - to me it should be making  load_status_txt display "ok", but the swf just loads with no status update.
All the text fileds are fine, because if I code  load_status_txt.text = "hello" straight after addChild(loader); -  load_status_txt displays "hello"
Can anyone see an obvious mistake below?
Thanks so much again.
Shaun
loadSwfBut.addEventListener("mouseDown", sendData)
function sendData(evt:Event){
    if(loadSwf.text !=""){
var Xpos:Number = 0;
var Ypos:Number = 100;
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest(loadSwf.text);
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
        loader.addEventListener(Event.COMPLETE, dataOnLoad);
    } else load_status_txt.text = "All fields are mandatory"
function dataOnLoad(evt:Event): void{
    load_status_txt.text = "ok";
stop();

use:
loadSwfBut.addEventListener("mouseDown", sendData)
function sendData(evt:Event){
    if(loadSwf.text !=""){
var Xpos:Number = 0;
var Ypos:Number = 100;
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest(loadSwf.text);
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataOnLoad);
    } else load_status_txt.text = "All fields are mandatory"
function dataOnLoad(evt:Event): void{
    load_status_txt.text = "ok";
stop();

Similar Messages

  • I want to load external swf in movieclip and next external swf should load Automatically

    I want to load external swf in movieclip and next external swf should load Automatically when current swf is finished in AS3.
    How can we can check total frame and current frame of imported swf in a movie clip.
    any help will be appreciated
    regards,
    Jatin Dembla

    in as3 you use the loader class (not movieclips) to load external swfs.
    you can use an Event.COMPLETE event listener (applied to the loader's contentLoaderInfo property) to check when loading is complete and start the next swf loading.
    you can use the loader's content property (caste as a movieclip) to determine info (including totalFrames) about the loaded swf's main timelnie (once loading is initialized, for the totalFrames, or complete, for some other properties like height and width).
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadcompleteF);
    loader.load(new URLRequest("swf1.swf"));
    var loadedSWF:MovieClip;
    function loadcompleteF(e:Event):void{
    loadedSWF=MovieClip(loader.content);
    trace(loadedSWF.totalFrames);

  • Urgent! external swf not loading with swfobject!

    hello there,
    I have a swf that loads another one into it through an empty
    movieclip - When i embed it with swfobject it doesnt appear.
    My guess is that i would have to mention the external swf in
    the flashvars ... Done that with no success.
    Does anyone have an idea of what could be causing me this
    trouble?
    thanks

    Generally the problem will be that the path of all externally
    loaded content is relative to the html page, NOT the swf location.
    If everything is in the same folder then that isn't it.
    Otherwise nice dice is correct, we will need to see your code
    to go further.

  • External .swf not loading on HTML pages

    Good morning,
    I'm having trouble and I was hoping someone could shed some light on what I'm doing wrong. I have a main .swf file from which external .swf files are being loaded through the use of buttons.
    When I preview the animation, everything works just fine. The problem occurs when I put the animation on the website where it needs to be. The main animation appears like it's supposed to, but the buttons are not successful in loading the external .swf files. I've made sure that all .swf files are on the server but still nothing. Could anyone help? I'm not sure what the problem is.
    Here's the AS:
    stop();
    var presentationLoader:Loader = new Loader();
    addChild(presentationLoader);
    //Navigation
    presentation1.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation2.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation3.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation4.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation5.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation6.addEventListener(MouseEvent.CLICK, buttonClick);
    function buttonClick(event:MouseEvent):void
    presentationLoader.load(new URLRequest(event.target.name + ".swf"));
    function homeClick(event:MouseEvent):void
    presentationLoader.unload();
    Thank you,
    - Cmarcoux

    For anyone having a similar problem in the future, the solution is in bold:
    stop();
    var presentationLoader:Loader = new Loader();
    addChild(presentationLoader);
    //Navigation
    presentation1.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation2.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation3.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation4.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation5.addEventListener(MouseEvent.CLICK, buttonClick);
    presentation6.addEventListener(MouseEvent.CLICK, buttonClick);
    function buttonClick(event:MouseEvent):void
    presentationLoader.load(new URLRequest("../../media/flash/" + event.target.name + ".swf"));
    function homeClick(event:MouseEvent):void
    presentationLoader.unload();
    For the animation to work on a website, the file path was needed.

  • Loading an external swf that loads an object from url

    i am trying to load an external swf that in turn automatically loads an object. i want the external swf to only be loaded once the object is loaded in it. right now it loads the external swf first and then the external swf loads the object specified at a url...

    thanks kglad. i think i need to try and load the external swf, wait for it to load its object, and then display it... will look into it and get back...

  • How do I get my external swf to load in the release build?

    My external swf loads in the debug build, but not in the release build.  How can this be fixed?
    Thanks,
    Doug

    After exporting the Flex project on my Macintosh, then importing it on my PC, then rebuilding the relase
    build, it works.  Probably some "path" issues between Mac and PC.
    Doug

  • External swf when loaded isn't synced?

    Hi,
    When I load an external SWF into my flash movie, the video
    lags behind. Any ideas why?
    Everything is fine when that SWF movie plays on it's own.
    thanks,
    Dave

    HI,
    My files loads an external swf (containing the video) into a
    container on my stage. The loaded swf contains the embedded wmv
    movie file, which is quite large I might add. Do I need to cut file
    size or change to flv?
    thanks again.

  • Enabling Parent button while external swf is loaded [AS3]

    Hello everyone,
    I am very new to Flash and it takes me a while to understand what code is trying to tell me
    The problem I am currently facing is as follows:
    After searching the net for hours I finally figured out, how to load an external swf into my main timeline. As far as I understand this main timeline is the "parent". Hence the loaded, external swf should be the "child" (a quiz).
    Now the child (a quiz) loads into the flash file and is played properly, but I cannot access the button on the parent anymore. Unfortunately, I really need the home button on the parent to exit the quiz and allow for new navigation within the flash document.
    I would greatly appreciate any help.
    Thank you all in advance.
    Kliph
    my AS3 Code:
    import flash.events.MouseEvent;
    function onClick611 (event:MouseEvent) :void
            gotoAndPlay("home_einf")
    home_btn.addEventListener (MouseEvent.CLICK, onClick611);
    import flash.net.URLRequest;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    function startLoad()
        var mLoader:Loader = new Loader();
        var mRequest:URLRequest = new URLRequest("quiz.swf");
    mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
    mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
    mLoader.load(mRequest);
    function onCompleteHandler(loadEvent:Event)
    addChild(loadEvent.currentTarget.content);
        function onProgressHandler(mProgress:ProgressEvent)
        var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
    trace(percent);
    startLoad();
    stop();

    By simply using addChild like you have, you're placing the loaded content above everything on the display list - covering your button. There are a few ways to solve. The easiest, if it works for you, is to just make a new layer in your timeline - make it the top most layer, and place your home button in that layer.
    Then change your addChild line from:
    addChild(loadEvent.currentTarget.content);
    to:
    addChildAt(loadEvent.currentTarget.content, numChildren - 2);
    This will place the loaded content behind the button.
    Alternatively, you can set the button to export for AS and then add it after you add the loaded file. Or you can use content containers - empty sprites that you add first, and then fill with other objects, in order to control layering.

  • External SWF file load problem

    I'm loading external SWF file which has motion tween.After
    the loading progress bar finished to load than calls SWF file.If I
    test the movie locally works fine but when simulate the download it
    seems it jumps end of the timeline.Is anyone could tell me why is
    this??
    Thanks

    k, never mind..... finally figured it all out.

  • External swf movie loading slow

    Hello,
    I am working on this site and I am doing a video page. I am
    loading video externally by creating an empty movie clip. I then
    assign a video to a button to call the external swf video. This
    works great locally but when I upload it to production it is SUPER
    slow.
    My purpose of loading it externally was to make it load
    faster. The video is 3 minutes long. The external swf file I
    created for the video is 5.2 MB.
    I would appreciate any help you can provide.
    Thanks

    Here are a couple of references that might help:
    http://www.adobe.com/devnet/flash/articles/video_guide_03.html
    http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00000338.html
    Using the video as a SWF file means it has to load the entire
    movie before it plays anything. As a FLV file, it starts to play as
    the file is still being loaded. I would recommend trying to use the
    File -> Import -> Import Video and look a Progressive
    Download option. I don't recall off-hand if it's available that
    easily in MX2004, but that's how it works with CS3. If that doesn't
    work, the second link has some code to try.

  • Loading external swf using Loader.load() method is delayed with flash player 10.1 and next versions.

    I am trying to load an external swf file of size 300 kb using Loader.load() method and trying to access some objects in it and i am getting some delay in loading the external file with flash players 10.1 and next versions.
    The action script code used to load:
    var strUrl:String="toLoad.swf";
    var urlReq:URLRequest=new URLRequest(strUrl);
    var ldrLoader:Loader = new Loader();
    var ldrLoaderContext:LoaderContext = new LoaderContext();
    ldrLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, externakSwfLoaded);
    ldrLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorInLoadingSwf);
    ldrLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorInLoadingSwf);
    ldrLoaderContext.applicationDomain = ApplicationDomain.currentDomain;
    ldrLoader.load(urlReq, ldrLoaderContext);
    addChild(ldrLoader);
    System specifications:
    O.S. Windows XP sp2 (32 bit)
    Browser IE 6.0 (128 bit)
    Flash Player version WIN 10,2,152,32

    I think you are lost. This forum is for ROME. It sounds like you want one of the Flash or Flex forums...
    Good luck!
    Harbs

  • Loading External SWF that loads XML

    Hey all I have a swf that loads an swf file into that loads pictures from an XML file thanks to Ned Murphy.  I have a new problems with it.  It works everywhere I try it except on the webserver.  When I try it I get nothing.  It doesnt seem to load the external SWf file or it may not be loading the XML file.  I am not sure why.  Has anyone ran into this before ? thanks.
    EDIT
    It works if I try the SWF from the webserver but when I embed it in an HTML file and run it through a broweser I get nothing.

    If the swf is is another folder from the html page that embeds it, you probably need to adjust how you target the files that the swf's load. 
    When you embed an swf file into a web page, anything the swf loads has to be targeted as if that swf is in the same folder as the html page that holds it.  So if the html page uses something like "flash/main.swf" to embed the top level swf, then if the top level file loads another swf from that same flash folder it needs to also use the "flash/other.swf" regardless that it is in the same folder on the server.  When it's embedded in the page, it's as good as being wherever that page lives.

  • Check value once swf is loaded

    There are 50 movies loaded sequentially. From Q1 thru Q29 I want to attach a particular title (mc) to the main movie and then for Q30 thru Q40 another and so on. The file is on an Learning Management Sytem so I'm using SCORM code.
    A movie is loaded in a clip in the main movie. A bookmark is set.
    _parent.saveBookmark("Q1");
    _parent.test1();
    The main move has this code on the first frame:
    function saveBookmark(loc:String) {
       scorm.set("cmi.core.lesson_location", loc);
       scorm.save();
    function getBookmark():String {
      return scorm.get("cmi.core.lesson_location");
    var bookmark:String = getBookmark();
    var mySubstring:Number = Number(bookmark.substr(1));
    //There's a Q in my bookmark!
    if(bookmark.indexOf("Q") !== -1 && bookmark !== undefined){
       //add the underscore after the Q to match filename
       bookmark = bookmark.split("Q").join("Q_");
       swfURL = bookmark +".swf";
       trace(swfURL);
    function testi() {
        trace(mySubstring);
        trace("ahhh");
    if (mySubstring <= 29 && isNaN(mySubstring) == true && bookmark !== undefined){
        attachMovie("title_foundational", "ttl_foundational", 1, {_x: 217, _y: 5});
    startPreload(swfURL);
    I'm lost.

    Hi, I noticed at the top of your code, you have _parent.test1 and at the bottom of your code, you call function testi<------ not sure if this helps..!!
    _parent.saveBookmark("Q1");
    _parent.test1();
    // The main move has this code on the first frame:
    function saveBookmark(loc:String) {
    scorm.set("cmi.core.lesson_location",loc);
    scorm.save();
    function getBookmark():String {
    return scorm.get("cmi.core.lesson_location");
    var bookmark:String = getBookmark();
    var mySubstring:Number = Number(bookmark.substr(1));
    //There's a Q in my bookmark!
    if (bookmark.indexOf("Q") !== -1 && bookmark !== undefined) {
    //add the underscore after the Q to match filename
    bookmark = bookmark.split("Q").join("Q_");
    swfURL = bookmark+".swf";
    trace(swfURL);
    function testi() {
    trace(mySubstring);
    trace("ahhh");
    if (mySubstring<=29 && isNaN(mySubstring) == true && bookmark !== undefined) {
      attachMovie("title_foundational","ttl_foundational",1,{_x:217, _y:5});
    startPreload(swfURL);

  • Bring loaded external swf to the front

    Hi,
    I am now implementing to create a website using side scrolling platform game approach. Since the player/actor (character that moves according to keyborad events) should always be at the top layer, I am having difficulties to get my loaded swf on top of the player. I am currently using Flash cs6 (as3).
    Basically, in my main stage, there are 3 layers. 1 for actionscript, the scond one for player and lastly for background.
    Layer player contains player mc and background mc.
    Background mc contains visual and collisions layers.
    Anything that got to do with visual, i have to put it in visual layer.
    In visual layer i have backgroundcontainer mc
    So, as i put the button in the backgroundcontainer mc to call the external swf, the loaded external swf appears in the container.
    (I am using load/unload snippet code to call the external swf)
    I want the external swf to appear on top of the player.
    for (var fl_ChildIndex_2:int = 0;
            fl_ChildIndex_2 < this.numChildren;
            fl_ChildIndex_2++)
        this.getChildAt(fl_ChildIndex_2).addEventListener(MouseEvent.CLICK, fl_ClickToBringToFront_2);
    function fl_ClickToBringToFront_2(event:MouseEvent):void
        this.addChild(event.currentTarget as DisplayObject);
    Any help would greatly appreciated 

    If you want an object to move atop all others you can just use addChild(thatobject), where thatobject is the item you want to move atop anything else.  I don't know what object(s) your loop is attempting to act on, but it appears to be trying to change the index of all child objects rather than just one.

  • External swf loader probs

    HI, we have a situation which has done our heads in for two
    days non-stop,
    We have a pre-loader loading the area's and then have the
    loadmovienum to load in additional swf's now when we use the nav
    bar at the top of the page, it opens the right file but when it
    loads the page it moves onto the next load movie for some reason
    with out stopping, even though the stop command is in place....
    We have uploaded the dodgy version which you can test and see
    what problems we are having, the contact page is the same as the
    service page for the moment, but you will see the contact page
    display the "cloned" service page then it restarts the whole movie
    Here are the URL's to the zip file with all the swf's and
    fla's including the live what we have done so far online version.
    http://www.drsolutions.co.uk/premiere/wwwroot/
    http://www.drsolutions.co.uk/premiere/fla/premiere.zip
    Please reply asap thanks
    PS WE ARE USING FLASH 8

    Ok... I figured out how to get the swf to play correctly. I
    changed my publish settings to Flash 8 Player. This worked in
    getting the external swf to load... Now I ran into a new problem,
    hopefully someone can help me with this.... I need the swf to load
    in a VERY specific location, and at the EXACT scale as the original
    swf file. I have attempted to accomplish this by opening the
    original file that I am attempting to load. I selected all of the
    elements on the page, and looking at the X and Y coordinates, as
    well as the over all pixels measurement... then I placed these in
    numerals in the fields for the loader component in the "mother"
    file. I previewed it, and the placement and scale are wrong... how
    do I overcome this?? How can I control where the loader component
    loads and at what scale?
    Ken

Maybe you are looking for

  • Logic Pro X fading out audio when sharing to iTunes

    When I try to share a track I've edited to iTunes, the output has an unwanted fade out effect during the last 10 seconds, leaving the last 2 seconds unaudible. Is there any way I can stop this fade out from happening? I've tried turning off automatio

  • Create a new instance of a class without starting new windows.

    I've a class with basic SWING functions that displays an interface. Within this class is a method which updates the status bar on the interface. I want to be able to reference this method from other classes in order to update the status bar. However,

  • How can I install my copy of PSE on my netbook which doesn't have a disc drive?

    How can I installl my copy of PSE on my netbook which doesn't have a disc drive?

  • Camera not working in T440

    Web Camera is not working on my Thinkpad T440. - Running Windows 8.1 pro (64 bit) - Integrated Camera in enabled in BIOS - Camera is NOT in Device manager: I do not see any  "Camera Plus (VGA resolution maximum)" and "Intergrated camera") or Imaging

  • ATP Customizing Integration Model

    Experts, I would like to use the ATP customizing integration model to do a one time transfer of ATP customizing from our ECC system to SCM.  The model is found in CFM1.  When I create the model and send it so SCM, I do not know what configuration tra