www.webdeveloper.com
Results 1 to 3 of 3

Thread: Flash AS unload video problem

  1. #1
    Join Date
    Oct 2007
    Posts
    1

    Flash AS unload video problem

    Pease help!
    I have the following code in a swf file to load the external video from google video which works fine:

    Code:


    //Actionscript code
    System.security.allowDomain("http://video.google.com/");
    System.security.loadPolicyFile("http://video.google.com/crossdomain.xml");
    Stage.scaleMode = "noScale";

    this.createEmptyMovieClip("container",this.getNextHighestDepth());
    container.createEmptyMovieClip("subcontainer",this.getNextHighestDepth());
    var stgHeight = Stage.height;
    var stgWidth = Stage.width;
    _root._lockroot = true;
    _root.container._lockroot = true;
    _root.container.subcontainer._lockroot = true;
    var mclListener:Object = new Object();

    mclListener.onLoadStart = function(target_mc:MovieClip) {
    target_mc.startTimer = getTimer();
    };

    mclListener.onLoadComplete = function(target_mc:MovieClip) {
    target_mc.completeTimer = getTimer();
    };

    mclListener.onLoadInit = function(target_mc:MovieClip) {
    var timerMS:Number = target_mc.completeTimer-target_mc.startTimer;
    //trace("loaded in "+timerMS+" ms.");
    };

    var video_mcl:MovieClipLoader = new MovieClipLoader();
    video_mcl.addListener(mclListener);

    //waits till some content has been loaded
    this.onEnterFrame = function() {
    if (container._width>0) {
    //height and width of youtube movie
    cWidth = container._width;
    cHeight = container._height;
    //trace('widthxheight = '+cWidth+"x"+cHeight);
    //required height and width in which to fit the youtube movie
    rCWidth = 620;
    rCHeight = 346;
    container._xscale = (rCWidth/cWidth)*100;
    container._yscale = (rCHeight/cHeight)*100;
    //trace((rCWidth/cWidth)*100);
    //trace((rCHeight/cHeight)*100);
    //manual placement of the mc
    container._x = 205;
    container._y = 135;
    delete this.onEnterFrame;
    }
    };


    Still_imagery1.onPress = function() {
    //when you unload the movie, sounds remains playing, so we need this line
    stopAllSounds();
    //without this line the other video keeps playing
    video_mcl.unloadClip(container.subcontainer);
    //your video address
    my_video_id = "6083988774814179881"
    full_address = "http://video.google.com/googleplayer.swf?docId=" + my_video_id + "&hl=en-GB";
    //ready to load
    video_mcl.loadClip(full_address, container.subcontainer);

    }





    This loads the video into the container

    The YouTube video loads correctly. When I click another button in my menu to play another rmovie or to jump to a frame with no video or audio the video disappears, but the sound continues. the strange thing is that the swf works fine and video stops when testing it within flash, im confused!

    Please help i need this site up and running tomorrow! :S

    Thankyou,
    vikki.

  2. #2
    Join Date
    Nov 2007
    Posts
    2
    Hi Vikki,

    Your last lines of code:
    Code:
    full_address = "http://video.google.com/googleplayer.swf?docId=" + my_video_id + "&hl=en-GB";
    //ready to load
    video_mcl.loadClip(full_address, container.subcontainer);
    }
    should be completed with:
    Code:
    full_address = "http://video.google.com/googleplayer.swf?docId=" + my_video_id + "&hl=en-GB";
    //ready to load
    video_mcl.unloadClip(container.subcontainer);
    video_mcl.loadClip(full_address, container.subcontainer);
    }

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    I'm sorry, I went to fast... you already had the line...
    I'm sorry...
    I'm sorry...

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
  •  
HTML5 Development Center



Recent Articles