Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 11:38 PM.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •