Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2008, 05:05 PM   PM User | #1
Heelie
New to the CF scene

 
Join Date: Nov 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Heelie is an unknown quantity at this point
player multi-FLV with XML

Hello,
I create for myself a multi FLV player with XML , i want the users to press an image (there'll be 4 images) and then the video is loading.
I try to make a function creaVignettes with createEmptyMovieClip but nothing is happening, images aren't coming, i don't understand why, can somebody try to explain it????

Thank you

Code:
playlist = new XML();
playlist.ignoreWhite = true;
playlist.load("playlist.xml");


titre = new Array;
cheminVideo = new Array;
cheminVignettes = new Array;


playlist.onLoad=function () {
var i:Number;
nombre=playlist.firstChild.childNodes.length;
for(i=0; i<nombre;i++){
titre[i] = playlist.firstChild.childNodes[i].childNodes[0].firstChild;
cheminVideo[i] = playlist.firstChild.childNodes[i].childNodes[1].firstChild;
cheminVignettes[i] = playlist.firstChild.childNodes[i].childNodes[2].firstChild;
trace (titre[i]);
trace (cheminVideo[i]);
trace (cheminVignettes[i]);
creaVignette();
}

}

function creaVignette(i){

_root.attachMovie("cadre","cadre"+i,i+1);
_root["cadre"+i].createEmptyMovieClip("vignette",1);

_root["cadre"+i].vignette._x=0;
_root["cadre"+i].vignette._y=0;

_root["cadre"+i].vignette._xscale=60;
_root["cadre"+i].vignette._yscale=60;

cheminPhoto=cheminVignette[i];
_root["cadre"+i].vignette.loadMovie(""+cheminPhoto+"");

if (i==0){
_root["cadre"+i]._y=445;
_root["cadre"+i]._x=30;
}else{
_root["cadre"+i]._x=_root["cadre"+(i-1)]._x+90;
_root["cadre"+i]._y=445;
}

_root["cadre"+i].onPress=function () {
monFlux.close();
lectureVideo(i);
}
}

<?xml version="1.0" encoding="utf-8"?>
<real>
	<video>
		<titre>BJÖRK</titre>
		<cheminVideo>videos/bjork_bachelorette.flv</cheminVideo>
		<cheminVignettes>vignettes/bjork.gif</cheminVignettes>
	</video>
	<video>
		<titre>DAFT PUNK</titre>
		<cheminVideo>videos/daftPunk_aroundTheWorld.flv</cheminVideo>
		<cheminVignettes>vignettes/daftPunk.gif</cheminVignettes>
	</video>
	<video>
		<titre>THE CHEMICAL BROTHERS</titre>
		<cheminVideo>videos/chemiBro_letForever.flv</cheminVideo>
		<cheminVignettes>vignettes/chemicalBrothers.gif</cheminVignettes>
	</video>
	<video>
		<titre>KYLIE MINOGUE</titre>
		<cheminVideo>videos/kylieMinogue_comeInto.flv</cheminVideo>
		<cheminVignettes>vignettes/kylieMinogue.gif</cheminVignettes>
	</video>
</real>
Heelie is offline   Reply With Quote
Old 11-29-2008, 07:09 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Well I was unable to really test it all the way, since I wasn't sure how your stage was setup. However this code is basically writing over each image with a new one, so if you get it to work only one image will be loaded anyways.

Also here is a revised set of code which still only displays the last image loaded

Code:
playlist = new XML();
playlist.ignoreWhite = true;
playlist.load("playlist.xml");


titre = new Array;
cheminVideo = new Array;
cheminVignettes = new Array;


playlist.onLoad=function () {
	var i:Number;
	nombre=playlist.firstChild.childNodes.length;
	for(i=0; i<nombre;i++){
		titre[i] = playlist.firstChild.childNodes[i].childNodes[0].firstChild;
		cheminVideo[i] = playlist.firstChild.childNodes[i].childNodes[1].firstChild;
		cheminVignettes[i] = playlist.firstChild.childNodes[i].childNodes[2].firstChild;
		creaVignette(i,cheminVignettes[i]);
	}
}

function creaVignette(i,cheminPhoto){
	_root.createEmptyMovieClip("vignette",1);
	
	_root.vignette._x=0;
	_root.vignette._y=0;
	
	_root.vignette._xscale=60;
	_root.vignette._yscale=60;
	
	cheminPhoto=cheminVignettes[i];
	trace(cheminPhoto);
	_root.vignette.loadMovie(cheminPhoto);
	
	if (i==0)
	{
		_root._y=0;
		_root._x=0;
	}
	else
	{
		_root._x=_root._x+90;
		_root._y=0;
	}

_root.onPress=function () {
monFlux.close();
lectureVideo(i);
}
}
What would be better is to load each image into a new movieClip, and then place them, IMO.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 11-29-2008, 07:56 PM   PM User | #3
Heelie
New to the CF scene

 
Join Date: Nov 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Heelie is an unknown quantity at this point
trying again

Thank you for your help but i didn't get this working completely, i try your way but i didn't succeed ...

i'm sorry i think i need more help...

Last edited by Heelie; 11-29-2008 at 10:38 PM..
Heelie is offline   Reply With Quote
Old 11-29-2008, 11:04 PM   PM User | #4
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Did you create the original file for this flash program or was it written by somebody else? It helps me to know how familiar you are with Flash and with this code.

If you notice, the code I provided doesn't work completely, but it is hard for me to provide help when I don't have more information about what you want. Do you have the FLA to link so I can see how things are placed on the stage?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 11-30-2008, 09:27 AM   PM User | #5
Heelie
New to the CF scene

 
Join Date: Nov 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Heelie is an unknown quantity at this point
I create the file because i'm doing it for myself to be more familiar with Flash and XML... but i'm not a pro

Here is a link to download the file
Heelie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:59 PM.


Advertisement
Log in to turn off these ads.