Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    Template Galleria Photoshop

    Salve, ho scaricato dal sito di adobe il source file della flash gallery 1 per photoshop.
    vorrei che oltre ai jpg mi caricasse anche gli swf e per farlo mi sa che devo modificare una stringa dell'as.
    Da quel poco che ne ho capito è questa
    basename = src.attributes.thumbpath.substring(0, src.attributes.thumbpath.indexOf('.jpg'));

    Mi aiutate ad aggiungere anche '.swf' insieme a jpg...grazie

  2. #2
    mi sa che è meglio che vi posti tutto il codice

    Codice PHP:
    function WPGallery(url) {
        
    this.url                    url;            /* < url for the WPGallery's xml file */
        
    this.length                false;            /* < number of images in the WPGallery */
        
    this.$data                = new XML();    /*    < private var holding the xml data */
        
    this.base                 '';                /*    < private var for gallery base */
        
    this.thumbnailbase     '';                /*    < private var for thumbnail base */
        
    this.largebase         '';                /*    < private var for large image base */
        
    this.$data.ignoreWhite true;        /*    < set ignore white for the xml */
        
        
    var self            this;                // hacky backref to the WPGallery object

        // called when xml is loaded, sets length and call user callback
        
    this.$data.onLoad = function (ok) {
            if (
    ok) {
                var 
    iprop;                    // counters
                
    var fc this.firstChild;        // firstchild node
                
                // set the length for the gallery
                
    self.length this.images.childNodes.length;
                
                
    // copy all gallery attribs into the object
                
    for (i in fc.attributes) {
                    
    self[i] = fc.attributes[i];
                }
                
                
    // copy all non-image nodes into the WPGallery object
                
    for (i=0i<fc.childNodes.lengthi++) {
                    
    // skip images, add banner, thumbnail, large attributes
                    
    switch(fc.childNodes[i].nodeName) {
                        case 
    'banner':
                        case 
    'thumbnail':
                        case 
    'large':
                            for (
    prop in fc.childNodes[i].attributes) {
                                
    self[fc.childNodes[i].nodeName prop] = fc.childNodes[i].attributes[prop];
                            }
                            break;

                        case 
    'images':
                            break;                    
                            
                        default:
                            
    self[fc.childNodes[i].nodeName] = fc.childNodes[i].firstChild.nodeValue;
                            break;
                    }
                }
                
                
    self.onLoad();
            } else {
                
    trace('The XML file was not loaded.');
            }
        }
    }

    /**
    * load the xml for the WPGallery
    */
    WPGallery.prototype.load = function() {
        
    this.$data.load(this.url);
    }


    /**
    * return the image for the given index
    * @param:    imgnum the index of the image to return
    * @return:    an object with all properties for this image
    */
    WPGallery.prototype.getImage = function(imgnum) {
        var 
    src;        /** < the xml node for this image */
        
    var img = {};    /** < the parsed image node to return as an object */
        
    img.meta = [];    /** < holder for meta data */
        
    src this.$data.images.childNodes[imgnum];

        
    // add meta.title set as filename (default)
        
    img.meta.title src.attributes.path;

        
    // get attributes

        // escape filename for highbit languages
        
    var basename src.attributes.path.substring(0src.attributes.path.indexOf('.jpg'));
        
    basename escape(basename)+'.jpg';
        
        
    img.file                basename;
        
    img.largeurl             this.base this.largebase basename;
        
    img.largewidth             src.attributes.width;
        
    img.largeheight            src.attributes.height;

        
    // escape thumbname
        
    basename src.attributes.thumbpath.substring(0src.attributes.thumbpath.indexOf('.jpg'));
        
    basename escape(basename)+'.jpg';

        
    img.thumbnailurl        this.base this.thumbnailbase basename;
        
    img.thumbnailwidth         src.attributes.thumbwidth;
        
    img.thumbnailheight        src.attributes.thumbheight;

        for (var 
    i=0i<src.childNodes.lengthi++) {
            
    // add the url and prepend the image base
            
    if (src.childNodes[i].nodeName == 'meta') {
                
    img.meta[img.meta.length] = {
                    
    name:src.childNodes[i].attributes.name,
                    
    contentsrc.childNodes[i].firstChild.nodeValue
                
    }
                
    img.meta[src.childNodes[i].attributes.name] = src.childNodes[i].firstChild.nodeValue;
            } else if (
    src.childNodes[i].nodeName == 'keywords') {
                
    img.meta.keywords = [];
                for (var 
    j=0j<src.childNodes[i].childNodes.lengthj++) {
                    
    img.meta.keywords.push(src.childNodes[i].childNodes[j].firstChild.nodeValue);
                }
            }
        }
        
        return 
    img;
    }

    /**
    * return an iterator for the gallery
    * @return:    an WPGalleryIterator object
    */
    WPGallery.prototype.iterator = function() {
        return new 
    WPGalleryIterator(this);
    }


    // ------------------------------------------
    // iteration functions
    // --

    /**
    * returns an iterator for the gallery
    * @param:    gallery. The gallery to get an interator for.
    * @return:    WPGallery Iterator object
    */
    function WPGalleryIterator(gallery) {
        
    this.$current    false;                    /* < private var of the current index */
        
    this.length        gallery.length;        /* < number of items in the iterator */
        
    this.parent        gallery;                /* < gallery this iterator handles */
    }


    /**
    * returns the next image in the gallery if it is available, otherwise returns false
    * @return:    an object with all properties for this image
    */
    WPGalleryIterator.prototype.next = function() {
        if (
    this.$current === false) {
            
    this.$current 0;
        } else if (
    this.$current < (this.length-1)) {
            ++
    this.$current;
        } else {
            return 
    false;
        }
        return 
    this.parent.getImage(this.$current);
    }

    /**
    * returns the last image in the gallery if it is available, otherwise returns false
    * @return:    an object with all properties for this image
    */
    WPGalleryIterator.prototype.prev = function() {
        if (
    this.$current 0) {
            --
    this.$current;
        } else if (
    this.$current == 0) {
            
    this.$current this.length-1;
        } else {
            return 
    false;
        }
        return 
    this.parent.getImage(this.$current);
    }


    /**
    * reset the gallery for iteration
    */
    WPGalleryIterator.prototype.reset = function() {
        
    this.$current false;
    }

    /**
    * set the internal pointer and return the image there
    * @param:    i the index to seek to
    */
    WPGalleryIterator.prototype.seek = function(i) {
        
    this.$current i;
        return 
    this.parent.getImage(this.$current);
    }

    /**
    * get the current image number
    */
    WPGalleryIterator.prototype.getCurrentIndex = function() {
        return 
    this.$current;
    }



  3. #3
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    un po' tosta leggersi e comprendere tutto quel codice in poco tempo...

    comunque se hai isolato nella riga indicata nel primo messaggio, potresti provare questo, anche se non so se possa funzionare o se te lo considera come un errore di parsing

    Codice PHP:
    basename src.attributes.thumbpath.substring(0src.attributes.thumbpath.indexOf('.jpg')) || src.attributes.thumbpath.substring(0src.attributes.thumbpath.indexOf('.swf')); 

  4. #4
    Ritorno su questa discussione per chiedervi un'altra cosa sempre su questo file.
    Devo piazzare un mc contenente una scritta che deve rimanere sempre in basso a sinistra indipendentemente dal ridimensionamento del filmato. Potete dirmi qual'è l'as necessaria?
    Grazie

  5. #5
    _root.oggetto._x = Stage.height - 10
    _root.oggetto._y = Stage.width - 10

    questi due divertenti comandi ti potrebbero aiutare!

  6. #6
    grazie mille

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.