A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: XML, Array and correct path...syntax help!!!

  1. #1
    Junior Member
    Join Date
    Nov 2007
    Posts
    23

    XML, Array and correct path...syntax help!!!

    hi, i've been staring at this all day and for some reason can't see the correct syntax or path required to load the selected thumbnail movie clip into a movieclip holder...

    I'm loading some XML into an array in order to have a dynamically generated thumbnail gallery of video clips (external swf's). i've managed to have the gallery generated fine, but i would like the appropriate video loaded when its thumbnail is hit. i'm trying to use the same external swf path that goes into the thumbnail to go into the container movieclip, but it won't work and i'm about to faint! here's my code....any help would be great. cheers.

    Kiyo

    ///////////////////////////////

    var numOfItems:Number;
    var home:MovieClip = this;
    var Y:Number = 100;
    var Yspace:Number = 55;
    var xml:XML = new XML();
    xml.ignoreWhite = true;

    xml.load("videos.xml");

    xml.onLoad = function()
    {
    var nodes = this.firstChild.childNodes;
    numOfItems = nodes.length;
    for(var i=0;i<numOfItems;i++)
    {
    var t = home.attachMovie("thumb","thumb"+i,i+1);
    t._x = 400;
    t._y = Y;
    Y = Y + Yspace;
    loadMovie(nodes[i].attributes.vidpath,t.vidthumb); //THIS IS THE PATH THAT SUCCESSFULLY LOADS THE VID INTO THE THUMBNAIL
    t.vidname.text = nodes[i].attributes.vidname;
    t.viddate.text = nodes[i].attributes.viddate;
    t.onRollOver = rollover;
    t.onPress = function() //THIS IS THE EVENT HANDLER THAT IS PISSIN ME OFF!
    {
    loadMovie(????????,holder);

    };

    }
    }

  2. #2
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    What video formats are you using? You'll probably need to go with FLV and develope a skin to go with it. www.flashden.net - has some great examples. Check those out - should explain a lot.

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    does this method work for you ?
    PHP Code:
    xml.onLoad = function(){
    var 
    nodes this.firstChild.childNodes;
    numOfItems nodes.length;
    for(var 
    i=0;i<numOfItems;i++){
    var 
    home.attachMovie("thumb","thumb"+i,i+1);
    t._x 400;
    t._y Y;
    Yspace;
    path nodes[i].attributes.vidpath;
    loadMovie(patht.vidthumb); 
    t.vidname.text nodes[i].attributes.vidname;
    t.viddate.text nodes[i].attributes.viddate;
    buttons(tpath);
    }
    };

    function 
    buttons(clip,movie){
    trace(clip+" loads "+movie);
    clip.onRollOver rollover;
    clip.onPress = function() {
    holder.loadMovie(movie);
    };
    }; 

  4. #4
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834
    Hi 'a_modified_dog',

    When I try something similar to your code, I get strange results.
    My XML example:
    Code:
    <clients>
    <client>
       <clname>Google</clname>
       <cllogo>client1.jpg</cllogo>
    </client>
    <client>
       <clname>Yahoo</clname>
       <cllogo>client2.jpg</cllogo>
    </client>
    <client>
       <clname>MSN</clname>
    <cllogo>client3.jpg</cllogo>
    </client>
    </clients>
    AS:
    Code:
    // Code here to create XML object and load XML file
    function loadXML(loaded) {
    	if (loaded) {
    		xmlNode = this.firstChild.childNodes;
    		total = xmlNode.length;
    
    		for (i=0; i<total; i++) {
    			m.clname = xmlNode[i].childNodes[0].firstChild.nodeValue;
    			cllogo = xmlNode[i].childNodes[2].firstChild.nodeValue;
    
    			var m = grid_mc.attachMovie("logoTile", "logoTile"+i, i);
    			// code here to position m
    			mclLoader.loadClip("img/"+cllogo,grid_mc["logoTile"+i].holder_mc);
    			buttons(m);
    		}
    	} else {
    		trace("file not loaded!");
    	}
    }
    function buttons(clip) {
    	clip.onRollOver = function() {
    		_parent.tooltip_mc.client_txt.text = this.clname;
    	};
    	clip.onRollOut = function() {
    		_parent.tooltip_mc.client_txt.text = "";
    	};
    }
    When I try this, the value of this.clname starts at the second XML childnode, meaning "Yahoo". So rolling over the Google logo, the text Yahoo is seen in my tooltip. Any ideas why?

    Your help is much appreciated. I've seen a lot of your posts here on FK and find your work admirable.

    Thanks!

    /Flip
    Flipsideguy

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    the positioning of your code logic is out of sync
    try -
    PHP Code:
    for (i=0i<totali++) {
    var 
    grid_mc.attachMovie("logoTile""logoTile"+ii); // 1st - attach
    m.clname xmlNode[i].childNodes[0].firstChild.nodeValue// 2nd - assign var

    cllogo xmlNode[i].childNodes[2].firstChild.nodeValue;
    mclLoader.loadClip("img/"+cllogo,grid_mc["logoTile"+i].holder_mc);
    buttons(m);


  6. #6
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834

    resolved

    Quote Originally Posted by a_modified_dog
    the positioning of your code logic is out of sync
    try -
    PHP Code:
    for (i=0i<totali++) {
    var 
    grid_mc.attachMovie("logoTile""logoTile"+ii); // 1st - attach
    m.clname xmlNode[i].childNodes[0].firstChild.nodeValue// 2nd - assign var

    cllogo xmlNode[i].childNodes[2].firstChild.nodeValue;
    mclLoader.loadClip("img/"+cllogo,grid_mc["logoTile"+i].holder_mc);
    buttons(m);

    Ah man! Thanks for that. It works. You're awesome!!! PM me your paypal account

    Flip.
    Flipsideguy

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