The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 6 of 6

Thread: Adding Pause,Play,FastForward,Rewind controls to a swf file via a loaded swf file

  1. #1

    Help please - adding playback controls to a swf file via a loaded swf file


    I will try to be as clear as I can. I have an existing swf file that I want to add Play,Pause, FF and Rewind via an externally loaded swf file that has the controls contained in it.

    I am loading an external swf file that has all of the controls on it via this code:

    // Set up the Mouse to use a listener
    var mouseListener = new Object();

    // Set the speed value for the fade
    var speed = 16;

    // Set the fade down and fade up to values
    var fadeDownTo = 0;
    var fadeUpTo = 100;

    // Listen for movement using the onMouseMove event
    mouseListener.onMouseMove = function()
    // If the mouse is over the load_mc
    if(load_mc.hitTest(_root._xmouse, _root._ymouse, false))
    // Use onEnterFrame to fade the clip down
    _root.onEnterFrame = function()
    if(load_mc._alpha >= fadeUpTo)
    load_mc._alpha = fadeUpTo;
    delete _root.onEnterFrame;
    } else {
    load_mc._alpha += speed;
    else {
    // Works the same as above but fades up
    _root.onEnterFrame = function()
    if(load_mc._alpha <= fadeDownTo)
    load_mc._alpha = fadeDownTo;
    // Delete the onEventFrame so that
    // it doesn't keep fading down
    delete _root.onEnterFrame;
    } else {
    load_mc._alpha -= speed;

    I am doing this so I can rollover the viewing window and have it appear. I cannot get any code to work to control the timeline (which is broken down into sections with individual MC's in each section.

    What I am looking for is the code to apply to the buttons on the external swf file that has the controls to control the playing of the movie.

    Any help would be greatly appreciated.

    Thank you

    Last edited by media-mixx; March 25th, 2012 at 11:32 PM.

  2. #2
    Registered User
    ok - you said: "I am loading an external swf file that has all of the controls on it via this code:"

    so the above code is in the *Loaded* swf main timeline - is that right?

    if so, the issue is related to the targeting of things like "load_mc" - which your probably trying to refer the local scope or 'this', and 'root' which will end up targeting the Loader swf

    also, seems that you should be able to replace the above code with something such as this:
    import fl.transitions.*;
    import fl.transitions.easing.*;
    var frames:int = 10; //time in frames
    this.alpha = 0;
    this.onRollOver = function() {
        var trans:Tween = new Tween( this, "_alpha", Strong.easeOut, this._alpha, 100, frames, false );
    this.onRollOut = function() {
        var trans:Tween = new Tween( this, "_alpha", Strong.easeOut, this._alpha, 0, frames, false );
    as far as the buttons, if they reside in the Loaded file, their code should be there as well, and should target the files main timeline, as it would without it being loaded into another container, for instance:

    play_btn.onRelease = function() {; }
    stop_btn.onRelease = function() { this._parent.stop(); }

  3. #3
    Hey....thanks a ton for responding. I probably was not as clear as I could have been. My client after creating 5 swf presentations then requested that they have controls but their environment does not support FLV's (Honeywell).

    So I was attempting to creating a separate controller that loads as a swf into the main movie. The code that you are referring to allowed me to have it appear and disappear (on hover) and then utilize the controls ( but this code is in the MAIN movie not the loaded swf with the controls). I simply need to pause and play the movie after it starts playing (which I took care of in the movie) and then give them a control to go back to the beginning and start over (that one I know).

    The problem has been that the movie is a series of nested Mc's in different sections and everytime I hit the play control it jumps to the next stop and does not Pause the movie.

    So I need to put the btn code obviously on the buttons or in the first key frame of timeline or both? Would I also put in the main movie?

    If you can't tell I am more of a designer than a programmer so I apologize for my probable annoyance.

    Appreciate your response!


  4. #4
    Registered User
    ok so now i'm following (i think lol) no worries

    so it sounds like you need to control all of the loaded files children - unfortunately there is not a universal 'stopall' - you'd need to 'drill-down' with a recursive loop to stop all of the instances - and then similarly for them to resume play - and it'll need to be dynamic in order to work for all instances instantiated at any given point in any of the 5 timelines - it'd also be easier in AS3... but i digress

    this should do the trick:
    function pause( clip:MovieClip, paused:Boolean ):Void {
    	( paused ) ? clip.stop() :;
    	for( var prop in clip ) {
    		if( clip[prop] instanceof MovieClip ) pause( clip[prop], paused );
    then call to the method like so:

    pause( load_mc, true ); //pause playback
    pause( load_mc, false ); //resume playback

    this should reside in the *Loader* main swf, you should be able to then target any instance and pause any element on it's timeline - to incorporate into a buttton just pass it through the handler, as in:

    stopBtn.onRelease = function(){ pause(load_mc, true); }
    playBtn.onRelease = function(){ pause(load_mc, false); }

    hopefully that'll help out a fellow MN

  5. #5
    I wondered about the "frozen tundra" reference. Ok I think I can make sense of this. If not are you available for any freelance work? This is for a client of ours and of course, I am getting tight on time. (Is not appropriate to ask this on a thread?)

    Where in MN are you? TC?

    Actually we need to find more experienced coders than myself (which in theory one would think easy). We do a lot of interactive work and there are times like this where my vision exceeds my skill level.

    Let me know and thanks for your help

  6. #6
    Registered User
    LOL right on - close to, 'bout 80 miles South

    it seems like you've got a handle on this - the above code should function out of the box, and it sounds like you're pretty much already there

    i think it's ok, people meet in the forums, however i'll PM you about the OT part of the conversation

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012