A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: XML video playlist Follow up question

  1. #1
    Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z PONYACK's Avatar
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    202

    XML video playlist Follow up question

    Is there a way to create a XML video Playlist that does not use the list box component?

    I have done a search on the net and all the tutorials I have seen use the component.

    Thanks

    Ponayck

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    not sure where yoru coming from..and where you are now...
    but you can use whatever you like.

    (is a 'listBox; the same a 'comboBox')?

    but I'm assuming the user needs to 'interact' with this list? to choose the video he/she wants to view?

    How do you want this controlled then? You can create a 'template' movieClip that looks like a button, with a synamic textField...and as many 'entries' that are in the XML doc...you can attach a button to the stage..and populate the dynamic textField with the videoClips name form the XML doc....

    and do whatever it is you have to do.

  3. #3
    Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z PONYACK's Avatar
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    202
    Hi

    Its the "list" located in the components, sorry about that confusion.

    I am using the AS code
    setStyle
    and that seems to have solved most of my design issues except for the loo of the scroll bars... I have seen a couple of tutorials about "skinning" the components but have not really tackled that aspect, yet...

    Your suggestion for the MC "template" is what I would like to do...I know how to create the button that you are talking...this is the code that i am using with the list component...

    vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for(i=0;i<videos.length;i++) {
    videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
    how do I rewrite this using the "template" MC that you suggested

    Thanks

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    you would use attchMovie

    this example has 3 options..a component button, and custom template clip, and the comboBox component..

    what I did was put a comboBox component on the stage (called: videoCombo)

    and in the library I had TWO objects:
    1.) a regular component button
    2.) a movieClip, that is nothing more than a outline (like a rectangle button) and a dynamic textField... textField name: buttonField. I also set the linkage property for this movieClip to be: buttonTemplate...and the NEW instance name to be given when attached: tempButton (+[i])

    here is the code:
    Code:
    import mx.utils.Delegate;
    var rootNode:XMLNode;
    var videosNode:Array;
    var totalVideos:Number;
    
    
    var myVideos_xml = new XML();
    	myVideos_xml.ignoreWhite = true;
    	myVideos_xml.onLoad = Delegate.create(this, getTotalVideos);
    	myVideos_xml.load("videoXML.xml"); //local version
    
    //
    function getTotalVideos(success):Void {
    	trace("Get Total Vids");
    	if (success == true) {
    		trace("Load OK");
    		rootNode = myVideos_xml.firstChild;
    		videosNode = rootNode.childNodes;
    		totalVideos = videosNode.length;
    		placeButtons();
    		this.onEnterFrame = Delegate.create(this, function() {    
    			populateComponents();
    			delete this.onEnterFrame;
    			}//end Function	
    		); //end Delegate	
    	}else {
    		trace("Load Failed");
    	}
    }
    
    //
    function placeButtons():Void {
    	trace("Place buttons");
        //Define how many columns
        var columns:Number = 1;
        //Define the item vSpacing;
        var vSpacing:Number = 10;
        //Define the item hSpacing;
        var hSpacing:Number = 0;
        for (i=0; i<totalVideos - 1; i++) {
    		
    		//template buttons
            var attachProduct:MovieClip = attachMovie("buttonTemplate", "tempButton"+i, this.getNextHighestDepth());
    		attachProduct._x += 10;
            attachProduct._x += i * 125;
    		attachProduct._y += 20;		
    		//attachProduct._y += i * 45;
            //attachProduct._y = Math.floor(i / columns) * hSpacing; //only used with multiple columns
    		//attachProduct._x = Math.floor(i % columns) * vSpacing; //only used with multiple columns
    			
    		//component buttons
    		var attachProduct2:MovieClip = attachMovie("Button", "compButton"+i, this.getNextHighestDepth());
    		attachProduct2._x += 10;
            attachProduct2._x += i * 125;
    		attachProduct2._y += 50;	
        }
    }
    
    
    //populate
    function populateComponents():Void {
    	trace("Populate Components");
    	for (j = 0; j < totalVideos-1; j++) {
    		//buttonTemplate data
    		var videoName:String = videosNode[j].firstChild.nodeValue;
    		var obj = this["tempButton" + j];
    		    obj.buttonField.text = videoName; 
    
    		//componentButton data
    		var videoName:String = videosNode[j].firstChild.nodeValue;
    		var obj = this["compButton" + j];
    		    obj.label = videoName; 
    
    		//comboBox data
    		var videoName:String = videosNode[j].firstChild.nodeValue;
    			trace("Video name: "+videoName);
    			_root.videoCombo.addItem(videoName);
    	}
    }
    and here is the .fla:

    www.dmstudios.net/xml_attachClip.zip



    I also have a link in my footer about attachMovie...but it uses a text loadVar Object..this one has the XML object you used..

  5. #5
    Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z PONYACK's Avatar
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    202
    Thanks for the files, i'll let you know how things go

  6. #6
    Member
    Join Date
    Dec 2003
    Posts
    81

    Exclamation

    I'm trying to do the same thing as Ponyack but have ALOT less xml experience so I thought going to the link posted by Whispers might help. Unfortunately the link is not working. Would you mind reposting please?

  7. #7

  8. #8

  9. #9
    Member
    Join Date
    Dec 2003
    Posts
    81
    Thanks whispers!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center