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.

Tags: Adobe Animate

Similar Questions

  • Prevent the load of his own muse js libraries

    Is it possible to prevent the loading of his own muse js libraries?

    If you mean while mounting / work on the layout page, then no.. Of course, you can remove all references later after the publication of the code, but then what would be the point of work even in Muse? 70% of its functions depend on the JS and when stripping away pages simply break.

    Mylenium

  • Photoshop does not open all the files on my Imac it will open work and recent files very well but will not save. I have the latest version. What is "cleanmymac3" that prevents the loading of files?

    Photoshop does not open all the files on my Imac it will open work and recent files very well but will not save. I have the latest version. What is "cleanmymac3" that prevents the loading of files?

    I must add that when I try and open a file, it freezes and I have to force photoshop completely.

    Try resetting your Photoshop preferences.

  • 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

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

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

  • Prevent the loading application if the user is in offline mode

    Hello

    I was wondering if there was a way to prevent the user to access a web application wrapped in webworks if they start the application without a data connection.

    I added event listeners to the window if a user is in the application and goes offline / comes online.

    I would stop at the splash screen and displays an informational message.

    I don't have the time in my current project to perform offline caching etc then hoped for this as a miracle despite that hinder the UX.

    BB10 on a Z10 with webworks last SDK is also used.

    I tried to use the navigator object, but it doesn't seem to detect on first loading of the application.

    Also it does not switch the value when going offline online in the app itself so just left the detection online/offline for event listeners for the moment until I had time to find a better solution.

  • Prevents the external SWF?

    I'm having a problem handling a loaded swf file. I'd like to load, play once, and not continue until told to.

    I looked on the web and became confused.

    I was using a charger, but I read that to control a time line you need to a movieclip (?)

    so, I had a mc vacuum and placed the charger with the SWF in the mc.

    that worked

    Try to get control of the SWF... That's the problem... Do not know how

    Can anyone help

    You will need to add a listener to wait for the file to load before trying to address/assign it.

    var showswf:Loader = new Loader;

    var swfLocation:URLRequest = new URLRequest("");

    showswf.contentLoaderInfo.addEventListener (Event.COMPLETE, loadComplete);
    showswf. Load (swfLocation)

    addChild (showswf);

    var loadedSWF:MovieClip;

    function loadComplete(e:Event):void {}

    loadedSWF = MovieClip (e.currentTarget.content);

    }

  • latest and greatest: conditional statements for referring to the loaded swf format click

    Good forum,

    I'm so close indeed with this update of the site, it's exciting! I'll be sure to throw it here for you to see, because without this forum I was wrong!

    The last big hurdle I have, is this, and I hope that someone can just throw me a bit of advice on this.

    I'm looking for a way to write a function, that the click on my button 'next' in the script, made reference to my loaded swf MovieClip (imageLoader.content) he said to go to the next image tag, so really a compound if/then situation - simply evoking the loaded file throws me.

    So, my next button is 'pNext', and what I'm looking for something in the sense of is:

    If (loaded film) is on frames 12-144, then go here (click).

    If (loaded film) is on the 144-155 frames, then submitted here (click)

    etc. etc.

    Thank you very much! Here is my code that works on one click Next, so you can see bodies etc.

    b

    pNext.addEventListener (MouseEvent.CLICK, nextClick);

    function nextClick (e:MouseEvent): void {}
    MovieClip (imageLoader.content) .gotoAndPlay ('aboutS1');
    }

    If I'm just reading your request, what you can try is to create a table of image tags in the order they appear and use the currentLabel property to determine where you are and indicate where to go...

    var labels: Array = new Array("one","two","three","four","five"...etc...);

    pNext.addEventListener (MouseEvent.CLICK, nextClick);

    function nextClick (e:MouseEvent): void {}
    var mc:MovieClip = MovieClip (imageLoader.content);
    var nextLabel:String = labels [labels.indexOf (String (mc.currentLabel)) + 1];
    mc.gotoAndPlay (nextLabel);
    }

  • How to prevent the loading of the images?

    I'm working on creating a web gallery in Dreamweaver CS3.  The thumbnails are in a horizontal Strip in a layer above the layer of the image in full size, in other words, the Strip lies the part of the image, but only when the image is in a vertical position. (the band has no background, so all that is visible are the actual thumbnails) When you click Show/hide text, in a configuration of rocker, the band fades or shows.   On my computer, it works perfectly. However, once downloaded, it takes forever to load the images.
    The problem: even though I have thumbnail images are defined to preload, all full-size images are loading as well, that takes a lot of time. Is there a way to prevent the images full size of loading, i.e. only when you click on the thumbnail?
    Executives, in which a picture is miniature and the other pictures, is what I normally would use, and have a page for each image. However, for what I have in mind, it will not work (transparency about the parts of an image above, another is as far as I can tell is not possible).

    So how do we stop loading images up to ask?  best regards ~ bill-o

    The problem I had in the past has to do with when you put information in the dialog box it insists on the use of the html version (< for)<) in="" the="" code,="" and="" i="" have="" to="" go="" back="" and="" fix="" them="">

    It is exactly what it OUGHT to do.  You don't need to go back and fix anything.  The code written by this behavior, as I have suggested is appropriate and correct.

  • Prevents the external SWF closure

    I spent two days on this problem and have founded TONS of threads that talk about this subject, but none who answer my exact situation. I apologize if that's the answer somewhere else, but here's my situation:

    I have a main FLA I have one of the three external sovereigns play random, via a Virgin video component (with an instance of movieTarget). Each individual swf has a stop(); on the last frame of each and when played separate main .fla very well from this stop.

    However once incorporated the main .fla, if you selected a swf file, it plays on the loop. I need to find a way to stop it. I added a loader code to my code main .fla to detect when the selected SWF is fully charged, but don't know where to go from here. I have attatched my control action script code.

    The bigger picture here, is that it will be incorporated into an html splash page that when one of these sovereign wealth funds play, will disappear in the Web site. The idea being that whenever a user comes to the site, a different intro will play and then go to the site. So if there is another, more easier way to achieve this, let me know.

    I thank anyone who takes the time to read this and help out. I can really use the help. Thanks in advance.


    I'M A FOOL.

    I solved the problem. In all my efforts and countless hours of troubleshooting to get this thing to stop a loop, I downloaded never once my new SWFS to the server. I always just imported in the main fla thought that is where they were shooting. In fact, because they are external loading SWF, they fired from the server. Things REALLY basic here.

    Thanks for your time to help. It was not everything is lost because I learned that the film was double loading from one of your answers.

    Thank you again...

  • How to prevent the loading movie before playing?

    Hello
    How do you prevent a swf to load fully before playing in the browser? When simulating a download in the application Flash, multi-stage preloading work perfectly, but not in the browser. Preload steps do not appear, instead it takes forever for the 3.5 mb file load completely before displaying the first frame of the movie.
    I tried reversing the order of loading in the export settings and the different versions of flash, but just can't make it work.
    Can anyone help? Thank you!

    unless ifFrameLoaded() is a function that you have defined, what isn't going to work.

    in a loop that executes repeatedly what follows, you can see:

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

  • hitTestPoint() shapeFlag does not not on movieClip containing the loaded swf

    I have a file .swf that contains a circle jpg I load from a URL, make a movieClip and add it to the stage.

    I would like to be able to detect when the user places the cursor over the circle. I wish it were accurate in a way he doesn't simply use the framework encompassing the circle, but the real circle himself in order to detect a collision. It is a fragment of my current code:

    var myCircle:MyCircle = new MyCircle (swf);

    myCircle.addEventListener (MouseEvent.MOUSE_MOVE, onMouseMove);

    myContainer.addChild (myCircle);

    private void onMouseMove(event:MouseEvent):void {}

    var glowFilter:GlowFilter = new GlowFilter();

    glowFilter.color = 0xffffff;

    If (event.currentTarget MyCircle) {}

    var object: MyCircle = event.currentTarget as MyCircle;

    If (object.hitTestPoint (event.stageX, event.stageY, true))

    event.currentTarget.filters = [glowFilter];

    else event.currentTarget.filters = [];

    }

    }

    I was led to believe the shapeFlag hitTestPoint() method parameter wouldn't do this, but assigning true or false doesn't make any difference. Any ideas why this could be?

    convert your png to a vector (select your png on stage, and then click Modify > bitmap > trace bitmap) and remove the background.

  • Hold the Position of the loaded SWF layer or Mc in ActionScript3

    Hi all

    I would like to RUN/LOAD my SWF loaded or Movie Clips BEHIND some existing masks already designed in a scene or simply to organize their

    position of visibility in ActionScript 3 while loading with CODING only

    is there a command to set, something similar to "Layers", "send to back", "prominent"?

    Thank you.

    You can use the addChildAt() method to place things behind other things.  You can also use the setChildIndex() method.  Both are explained in the help documentation.

Maybe you are looking for