A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How do I remove .flv from externally loaded .swf?

  1. #1
    Junior Member
    Join Date
    Feb 2009

    How do I remove .flv from externally loaded .swf?

    With the assistance of a very kind member of this forum, I have got as far as getting an .FLV to load into my API via its own .SWF.


    Please click on "Animalia - Verse from the Zoo" to load the VideoPlayer .swf which contains the .FLV

    I will add more functionality when I've solved this. Now that I have a Video Player which closes, the next set of hurdles to overcome are these:

    Click "Close" with the .FLV playing and the sound keeps playing because the .FLV is still playing. Click "Close" with the .FLV paused and when you call the player back, it plays from the same spot. So, my tiny brain says it's an "add/removeChild" issue. Obviously when happy user clicks "Close" and then re-loads by clicking "Animalia", happy user wants the video to play from scratch. That's what I want, anyway. Not from where it left off after clicking "Close". I've made several attempts at adding a "remove FLV" object to the function and Event Dispatch method, but what I did is wrong because the code I put in removed the .FLV permanently and when you call the player back by clicking on "Animalia", the .FLV does not play at all. I'm going round in circles looking for the correct NetStream/removeChild/unload.nsplay/etc/etc .. AS3 coding and where to put it.


    My .FLV video load object on "NewPlayer.swf" is:

    var myVideo:Video = new Video(360, 264);

    var nc:NetConnection = new NetConnection();
    var ns:NetStream = new NetStream(nc);
    ns.client = new Object();


    myVideo.x = 217;
    myVideo.y = 20;

    The event dispatch method in the .FLV .swf is:

    closeBut.addEventListener(MouseEvent.MOUSE_DOWN, unloadThisSkin);

    function unloadThisSkin(event:MouseEvent):void {

    //FI: dispatch event here instead of making new function
    this.parent.dispatchEvent(new Event(Event.CLOSE));

    pauseBut.visible = false
    playBut.visible = true

    //FI: corrected below - sorry for the confusion- AnimalSkinLoader is detected properly
    trace('Im looking for '+ AnimalSkinLoader +' and I am '+this);


    The code that listens for this event in the main API .swf is:

    Animalia2.addEventListener(MouseEvent.MOUSE_DOWN, loadFromAnimalia);

    function loadFromAnimalia(event:MouseEvent):void {

    AnimalLoader.addEventListener(Event.CLOSE,removeAn imalia);


    //FI NOTE: here is the closing function:
    function removeAnimalia(event:Event = null):void{
    trace('removing animalia');

    My questions is:- What is the correct coding to get the VideoPlayer .swf to unload its .FLV completely, SO THAT when a user clicks "Close". Either with or without the .FLV playing, everything closes completely and when re-loaded, the video plays from scratch? Many thanks to all! QP

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    Use ns.seek(0); This will bring the video back to the beginning.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Feb 2009
    Many thanks, Cancerinform. I will try it. Do you have any suggestions on stopping the sound the .flv if a user clicks "Close" with the video playing? QP

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