Categories

Partners
  • Website Templates

  • Design Feeds

  • Adobe Photoshop Tutorials

  • Website Templates, WordPress Themes

  • Website Templates

  • Flash Web Sites

  • Photoshop Templates

  • Photo Contests

  • Photo Tips
  • Search


    Advanced Search


    Partner Links
  • Adobe Photoshop Tutorials

  • Free Stock Photos and Images



  • Website Templates

    Streaming FLV files in Flash MX 2004
    Published  06/19/2006 | Macromedia Flash
       




    "Streaming" FLV files in Flash MX 2004

    If you haven't yet used NetConnection and NetStream right in Flash MX 2004, why don't you give it a try. Now you can dynamically load FLV files right in Flash without the FlashCom server.

    1. var connection_nc:NetConnection;
    2. var stream_ns:NetStream;
    3. var clickListener:Object = new Object();
    4. clickListener.click = function() {
    5.     connection_nc = new NetConnection();
    6.     connection_nc.connect(null);
    7.     stream_ns = new NetStream(connection_nc);
    8.     stream_ns.setBufferTime(5);
    9.     movie_video.attachVideo(stream_ns);
    10.     stream_ns.play("video1.flv");
    11. };
    12. play_btn.addEventListener("click", clickListener);

    Note that if you strict type inside the function, this code will not work. So, if you don't use a function, this code works just fine.

    1. var connection_nc:NetConnection = new NetConnection();
    2. connection_nc.connect(null);
    3. var stream_ns:NetStream = new NetStream(connection_nc);
    4. stream_ns.setBufferTime(5);
    5. movie_video.attachVideo(stream_ns);
    6. stream_ns.play("video1.flv");
    Article Series
    This article is part 2 of a 13 part series. Other articles in this series are shown below:
    1. Flash FAQ - Introduction
    2. Streaming FLV files in Flash MX 2004
    3. Creating an XML Packet with Flash - the easy way
    4. Creating an XML Packet with Flash - the hard way
    5. Getting more colors for your Halo
    6. Loading in Images Using the MovieClipLoader Class
    7. Parsing an XML Packet in Flash
    8. Parsing XML in Flash Using the XMLConnector
    9. Sending an XML Packet to a Server-Side Page
    10. Using LoadVars.send Method to Exchange Data with a Server-Side Script
    11. Using the Alert component
    12. Using the LoadVars Class to Load Variables
    13. Using XPath in Flash MX 2004