A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [RESOLVED] Pausing flv in an external swf from the main swf?

  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    39

    resolved [RESOLVED] Pausing flv in an external swf from the main swf?

    I hope this question makes sense.

    I am creating I guess what you could call a swf library. It's a bunch of different interactive swfs all packaged up into a main swf that I can embed on my page. Each swf contains flv's that play. They all work great in my main swf and individually, that's not my problem.

    Everything is working great but I have a menu that pops up to change between different episodes and it works great.
    BUT
    What I'm looking to do is when you click on the menu button and the menu pops up over the externally loaded swf, I want the externally loaded swf to pause. Then when you close the menu I want it to un pause. It looks really tacky when the menu pops up and the flv's in the externally loaded swfs keep running. I knew how to pause them in as2 but only from the swf they were actually in.

    This is my code (this all works) I just can't figure out code to add that will pause everything when the menu pops up ...
    box is what I named an empty box on stage
    top_btn is the button that launches the menu


    var myLoader:Loader = new Loader();
    var myURL:URLRequest = new URLRequest("NewHarbison2.swf");
    myLoader.load(myURL);
    box.addChild(myLoader);
    box.x = 0;
    box.y = 0;

    //video1 code begins here
    video1_btn.addEventListener(MouseEvent.CLICK, video1Clicked);

    function video1Clicked(event:MouseEvent):void {
    var myURL:URLRequest = new URLRequest("NewHarbison2.swf");
    myLoader.load(myURL);


    }




    video1_btn.addEventListener(MouseEvent.CLICK, closeIT_video1);
    function closeIT_video1(event:MouseEvent):void {
    gotoAndPlay(13);
    }



    //video2 code begins here
    video2_btn.addEventListener(MouseEvent.CLICK, video2Clicked);

    function video2Clicked(event:MouseEvent):void {
    var myURL:URLRequest = new URLRequest("bolcomNew.swf");
    myLoader.load(myURL);
    }

    video2_btn.addEventListener(MouseEvent.CLICK, closeIT_video2);
    function closeIT_video2(event:MouseEvent):void {
    gotoAndPlay(13);
    }

    //video3 code begins here
    video3_btn.addEventListener(MouseEvent.CLICK, video3Clicked);

    function video3Clicked(event:MouseEvent):void {
    var myURL:URLRequest = new URLRequest(" ");
    myLoader.load(myURL);
    }

    video3_btn.addEventListener(MouseEvent.CLICK, closeIT_video3);
    function closeIT_video3(event:MouseEvent):void {
    gotoAndPlay(13);
    }

    top_btn.addEventListener(MouseEvent.CLICK, openIT);
    function openIT(event:MouseEvent):void {
    gotoAndPlay(2);
    }
    close_btn.addEventListener(MouseEvent.CLICK, closeIT);
    function closeIT(event:MouseEvent):void {
    gotoAndPlay(13);
    }

    stop();


    Thanks so much if there is anyone anyone can do to help. I'm just learning as3 finally for the last like week. I'm pulling my hair out trying to get this done by the deadline Thanks!

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You have to explain more what all those buttons are and what they have to do with your problem. Please focus on the important script for your problem. Otherwise it is hard to understand.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Sep 2008
    Posts
    39
    Sorry... All the code I posted was what works fine for me. I need to add to it and I can't get the code remotely correct. what I have so far is some buttons, when the buttons are pressed a new swf file loads up.

    I have a main swf. All the main swf contains is some buttons and an empty movie clip. the buttons load up a bunch of different swfs. I will eventually have like 20 + swfs to be loaded into this main file


    I have a movie clip on the stage that has an instance name of box. And the first swf I have is called "NewHarbison2.swf" this swf loads automatically in the 1st frame. This is the "feature". Each swf contains about 10 flvs that play inside the externally loaded swf.


    THIS stuff is my menu button. When You click on the top_btn which is the instance name for my menu button, it pops up a white box over the stage that contains a list of different swfs to jump to.


    top_btn.addEventListener(MouseEvent.CLICK, openIT);
    function openIT(event:MouseEvent):void {
    gotoAndPlay(2);
    }

    This close_btn is in the pop up menu, and tells the menu to go and play frame 13 where the close animation is...

    close_btn.addEventListener(MouseEvent.CLICK, closeIT);
    function closeIT(event:MouseEvent):void {
    gotoAndPlay(13);
    }


    I need some way that when the top_btn pops up, the swf that is loaded at the time pauses.

    I hope this makes more sense.
    Thank you so much for taking time to help!
    Thanks!
    Last edited by laurabeth; 09-27-2008 at 07:24 PM.

  4. #4
    Member
    Join Date
    Sep 2008
    Posts
    39
    I can't figure out how to just edit my reply,
    but I wanted to rephrase my question again

    All the externally loaded swfs work fine when loaded up. And I can switch between them fine.
    I just want to find a way to pause them from the swf they are loaded into ...

  5. #5
    Member
    Join Date
    Sep 2008
    Posts
    39
    I have this done this, and I think works if the flv is in the same swf (I re wrote my as2 code I had). What I want to do is adapt this code so that I can have a button in my main swf, that will pause the flv that is in the externally loaded swf ... ?

    I guess I need to find a way to target the flv that sits in the externally loaded swf from my main swf...

    anyone? please? I'm sorry to be so confusing ...

    menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
    Movie_flv.pause();
    }

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Try
    myLoader.contentLoaderInfo.content. Movie_flv.pause();
    if myLoader is the Loader, in which the movie is loaded.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Senior Member
    Join Date
    Mar 2003
    Posts
    120
    LauraBeth, did this work for you? I need the same thing today, to pause an flv from the mail timeline.

    Thank you,
    Brittany
    *brittany*

  8. #8
    Senior Member
    Join Date
    Mar 2003
    Posts
    120
    Excuse me, I meant "main" timeline, not mail.
    *brittany*

  9. #9
    Member
    Join Date
    Sep 2008
    Posts
    39
    well - this does work if the flv is in the same swf
    and menu_btn is the button you want to press to pause the swf and if Movie_flv is the instance name of the flvplayback component or whatever your using to load it up.

    menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
    Movie_flv.pause();
    }

    I still can't get it the main swf to pause an flv that is in an external swf. I'm on the right track though with help from the post from cancerinform. But I can't figure it out yet because adding in something like myLoader.contentLoaderInfo.content. Movie_flv.pause(); doesn't work.

  10. #10
    Senior Member
    Join Date
    Mar 2003
    Posts
    120
    Does the code go in a keyframe on the timeline, or on the pause button?
    *brittany*

  11. #11
    Member
    Join Date
    Sep 2008
    Posts
    39
    Quote Originally Posted by Brittany
    Does the code go in a keyframe on the timeline, or on the pause button?
    for as3 that code goes in the main timeline just like other buttons.

    for as2 it can go on the button
    something like this i think it is:
    on (release) {
    Movie_flv.pause();
    }


  12. #12
    Member
    Join Date
    Sep 2008
    Posts
    39
    Quote Originally Posted by cancerinform
    Try
    myLoader.contentLoaderInfo.content. Movie_flv.pause();
    if myLoader is the Loader, in which the movie is loaded.

    This is what I've tried
    top_btn.addEventListener(MouseEvent.CLICK, menubtnclicked);
    function menubtnclicked(event:MouseEvent):void {
    box.contentLoaderInfo.content.miMovie_flv.pause();
    }

    I've been playing around with this and it's still not working.

    I get this error:

    TypeError: Error #1010: A term is undefined and has no properties.


    I'm still trying to see if I can find something in books I have but so far I can't get it still. I'm sure it's like some little tiny thing.

    How I'm loading the swf's is

    var myLoader:Loader = new Loader()
    var myURL:URLRequest = new URLRequest("JohnHarbison/JohnHarbisonnew.swf");
    myLoader.load(myURL);
    box.addChild(myLoader);
    box.x = 0;
    box.y = 0;


    Then I have buttons that load up different swfs into that container.
    I have a flvplayback in each swf that has instance names of miMovie_flv

    I'm still looking but thanks so much for your help I really appreciate it.

  13. #13
    Junior Member
    Join Date
    Mar 2010
    Posts
    1
    Hi, I have the same problem here. Have u solved that problem? Can I know how to pause the external swf from the main file?

    thanks.

  14. #14
    Member
    Join Date
    Sep 2008
    Posts
    39
    I'm having trouble remembering what I did for this, I think I just ended up doing the whole thing a different way... I'm sorry I don't remember I wish I had posted what I did!

    What exactly are you trying to do maybe I can help you out

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center