How to load local FLV file into a movieclip?

Posted on 2004-03-24
Last Modified: 2012-06-27
How to load local FLV file into a movieclip? I've found the next code but don't know what to do with it.
// Set the name of the movie to be played
 fileName = "Intro.flv";
// Create a NetConnection object:
 var netConn:NetConnection = new NetConnection();
// Create a local streaming connection:
// Create a NetStream object
 var netStream:NetStream = new NetStream(netConn);
// Define an onStatus() function:
 netStream.onStatus = function(infoObject) {
  status.text += "Status (NetStream)" + newline;
  status.text += "Level: " + infoObject.level + newline;
  status.text += "Code: " + infoObject.code + newline;
  // Turn on the mouse listener if the movie clip has ended.
  // This is how we are restarting the movie.
  if(infoObject.code == "NetStream.Buffer.Empty"){
   mouseListener = new Object();
   mouseListener.onMouseMove = function(){
    trace('play again');
    // Clear status window
    status.text = "";
    // Replay the video
   }; Mouse.addListener(mouseListener);
 function playExternalVideo(fn){
 // Attach the NetStream video feed to the Video object:
  // Set the buffer time (seconds):
  // Begin playing the FLV file: on frame 3 not here."media/video/"+fn);

I've tried to place it into the movieclip's onLoad() event but with no luck.
Could anybody give me a working FLA or at least actionscript code with accurate instructions what and how to do?

Thanks in advance.
Question by:abb1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

SandyCooke earned 500 total points
ID: 10668219
If anyone knows how to script steps 1-3 I would be very interested, but this should help you in the short term:

1) Choose 'New Video' from the Library pane (call it whatever you like)
2) Drag the object from the library to the stage
3) Name the instance (in this example) 'MyVideo'
4) Add this code to the first frame:

myUrl = "montage.flv"; // change this to the path to your FLV file or you won't see owt
var myNetConnection:NetConnection = new NetConnection();
var netStream:NetStream = new NetStream(myNetConnection);

This is everything I have learned so far about FLV playback :)


Author Comment

ID: 10668402
I'm really puzzled...

I've just found the same answer in the EE through Google search but EE itself requires a bucks to use EE search engine!
What's a hell!

I understand I must (formally speaking) give these points to you but could you be satisfied if I simply explain what Flash does in fact when you perform the actions 1..3? I've just checked it and the code is pretty short and clear! I would say, it cannot be shorter!

Expert Comment

ID: 10713391
Hi abb1

I've got a better idea: You give me the points for this question and then you go and tell me how to script a New Video object in my question thread:

This way we both answer a question!


Author Comment

ID: 10729324
It is an iteresting idea to earn expert points for each other :)))

Now I have the next issue: how to synchronize the video playback with other clips (slideshows, etc.). Unfortunately MM doesn't let us to stream slides (like RealMedia does it). Now I have just the only idea - to check NetStream.time and load slides into the slide window (a movieclip) if the time has come.

Also I can't find how to get a total duration of the video currently active. Therefore I don't see a native solution of how to create slider for video navigation. The only idea here is to get the total length information from outside of video (from XML or so).

If you have another and better ideas of how to do that then we could continue our discussin in the another thread.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash being Disabled - help! 20 343
Updating Flash Player with GPO 3 362
Rotating Adobe pdf document 4 330
High Internet Explorer CPU on Flash site in Citrix 2 872
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question