Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MovieClip or Button or What? 1

Status
Not open for further replies.

tfhwargt3

Programmer
Sep 19, 2006
61
US
Hi, I am rather new to flash, but not new to programming. I am going to type everything I want to do, so it might be long, but please stick with me. :) I have two questions. Oh, and sorry if this is posted in the wrong forum, i do consider myself a flash-newb.

I have a folder with a bunch of .flv files that I want to import as soon as my flash program is opened. I want to space them out using purely actionscript so that no clicking and adding of movies is necessary. I have been through all the movie related tutorials that came with flash 8 and I have been unable to find a good way to import using strictly actionscript. I would for instance want to make a loop in actionscript that would just start at frame 1 and then not display any of the videos until they are all loaded up in a gird with 1 or 2 pixels betwen each one. I know how to write the code if I could just figure out how to import and play using actionscript. All the examples have you create a movie clip using the window->library window.

The optimal way for me to do this would be to read from a text file that had only the names of the .flv files contained within the directory. I woudl just parse the file and then open the .flv file and place it correctly in the scene in my grid fashion. There don't seem to be any tutorials on how to do this... can someone lead me in the right direction?

Secondly, and more importantly, once I get these stupid videos on the stage I only want to do only one thing. The videos will sit all sit at frame one in the beginning. Then when the user moves the mouse over the video it will play from frame one to however long he/she hovers.

I have tried this method:

on(rollOver){
//
}

on(rollOut){
//
}

But it says to only use those for buttons. So should I make videos that are buttons? Or buttons that are videos? Does anyone know a good tutorial for that. And yes, I have been googling and I am googling right now too. Thanks in advance. Sorry for the long post, just trying to be thorough.
 
Well, I have FLV's and they are just files on my HD, is there a way to convert these with actionscript to the .swf files you are talking about? Or is there a way to embed them using action script? I need to do everything on the fly so ... yeah.

Thanks.
 
Right now, after googling and forum'ing for a while the only way I can figure out how to dynamically load all the videos and place them on stage is by doing this:

1.)Window->Library
2.)New Video
3.)Drag video object to the stage
4.)Highlight video
5.)Click frame 1
6.)Window->actions
7.)Type in actionscript below

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(3);
video1_video.attachVideo(stream_ns);
stream_ns.play("video1.flv");

I want to complete steps 1-6 with actionscript and just already have all that done. That way I can absolutely space these videos for the user, instead of having an "eyeballed" like I have now. It would really help if anyone could give me some insight. THanks !
 
yes!!! That is rather close. And you did no manual click on window->library crap? What did you do? I guess I will pm you my email address. Thanks!!!
 
Yes I think I understand most of the code. The use of "this" is somewhat confusing... What is the this? Is it an array of the videos? How do you use the .vid command on this as well as call it's array using []? Also, I was wondering if it would be possible to also add other properties besides the simple play and pause. Could I add _alpha as well, and then change it on rollout?

I tried this number:

this["vidHolder"+vidNumber].vid.attachVideo(netStream);
netStream.setBufferTime(0.5);
netStream.play(theFlvs[vidNumber]);
netStream.onStatus = function(info) {
if (info.code == "NetStream.Buffer.Full" && !checked) {
//some code
netStream._alpha(50);
}
};

But this did nothing. I realized that I was adding an _alpha to a so i tried this

this.vid._alpha(50)

but this also did nothing. What am I doing wrong here?

Thanks.
 
i wont go into a discussion on the use of 'this' lots of previous threads on scope

to change the alpha property on rollover or rollout just add

this.vid._alpha = 50;

to the rollover or rollout functions

 
I checked over the threads in this forum and I am pretty sure I understand now. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top