Adaugare link peste imagine din XML, putin ajutor

Oferta si cerere de joburi legate de Flash, Flex sau AIR

Adaugare link peste imagine din XML, putin ajutor

Mesajde RiKardo » Mie Noi 10, 2010 9:11 pm

Salut,

Am cumparat recent un template http://www.templatemonster.com/flash-te ... 27466.html flash si am o problema. Nu reusesc sa gasesc o sintaxa corecta pentru fisierul XML in asa fel incat sa adaug hyperlink peste big images. Acestea se vad atunci cand intri pe bedrooms (sau celelalte 3 categorii) si mai departe apar 9 small images in dreapta (care sunt de fapt butoane) si un big image in stanga pentru fiecare buton apasat. Acestea sunt incarcate dintr-un folder gallery cu ajutorul unui fiser XML care are de principiu urmatoarea sintaxa:

Cod: Selectaţi tot
<?xml version="1.0" encoding="iso-8859-1"?>
<root>


<pageGallery nameGallery="GALLERY 1" name="gallery1" folder="gallery" line="3" maxImages="9">
<titleImages>
<smallImages>_gallery_small_images_1.jpg</smallImages>
<bigImages>_gallery_big_images_1.jpg</bigImages>
<infoImages><![CDATA[Fusce suscipit varius mi. Cum sociis natoque penatibus et -<br>magnis dis parturient montes, nascetur ridiculus mus. Nulla dui.<br>Fusce feugiat malesuada odio. Morbi nunc odio, gravida at. ]]></infoImages>

</titleImages>

<titleImages>
<smallImages>_gallery_small_images_2.jpg</smallImages>
<bigImages>_gallery_big_images_2.jpg</bigImages>
<infoImages><![CDATA[Fusce suscipit varius mi. Cum sociis natoque penatibus et -<br>magnis dis parturient montes, nascetur ridiculus mus. Nulla dui.<br>Fusce feugiat malesuada odio. Morbi nunc odio, gravida at. ]]></infoImages>
</titleImages>


<titleImages>


etc...

Ma intereseaza daca stie cineva cum sa introduc corect un link peste bigImages in acest context.
Imaginile au denumiri: tfile_gallery_big_images_1.jpg , tfile_gallery_small_images_10.jpg, etc...

Din ce am inteles ar trebui facut ceva si in as-ul din .fla dar nu ma pricep foarte bine.

This is the as for "load big images"

Cod: Selectaţi tot
onClipEvent (load) {
    if (_parent._parent.numLoadTitle == undefined) {



        _parent._parent.numLoadTitle = 0;



        if (_root.part == undefined) {
            xmlNod = _root.xmlNodes.childNodes[0].childNodes[0];
        } else {
            var nameGalleryTytle:Number = _root.xmlNodes.childNodes[0].childNodes[0].childNodes.length;
            var i:Number = 0;
            while (i<nameGalleryTytle) {
                titleNameGallery = _root.xmlNodes.childNodes[0].childNodes[i].attributes.name;
                if (_root.part == titleNameGallery) {
                    xmlNod = _root.xmlNodes.childNodes[0].childNodes[i];
                }
                i++;



            }
        }







        AllxmlNode = xmlNod.childNodes[_parent._parent.numLoadTitle];
        images = AllxmlNode.childNodes[1].firstChild.nodeValue;
        titleInfo = AllxmlNode.childNodes[2].firstChild.nodeValue;




        var ifFolder:String = xmlNod.attributes.folder;
        if (ifFolder == undefined) {
            loadMovie(_root.url+images, cont.pic);
        } else if (ifFolder == "") {
            loadMovie(_root.url+images, cont.pic);
        } else {
            loadMovie(ifFolder+"/"+_root.url+images, cont.pic);
        }
    } else {



        if (_root.part == undefined) {
            xmlNod = _root.xmlNodes.childNodes[0].childNodes[0];
        } else {
            var nameGalleryTytle:Number = _root.xmlNodes.childNodes[0].childNodes[0].childNodes.length;
            var i:Number = 0;
            while (i<nameGalleryTytle) {
                titleNameGallery = _root.xmlNodes.childNodes[0].childNodes[i].attributes.name;
                if (_root.part == titleNameGallery) {
                    xmlNod = _root.xmlNodes.childNodes[0].childNodes[i];
                }
                i++;



            }
        }







        AllxmlNode = xmlNod.childNodes[_parent._parent.numLoadTitle];
        images = AllxmlNode.childNodes[1].firstChild.nodeValue;
        titleInfo = AllxmlNode.childNodes[2].firstChild.nodeValue;



        var ifFolder:String = xmlNod.attributes.folder;
        if (ifFolder == undefined) {
            loadMovie(_root.url+images, cont.pic);
        } else if (ifFolder == "") {
            loadMovie(_root.url+images, cont.pic);
        } else {
            //loadMovie(ifFolder+"/"+_root.url+small[i], item["mini"+i].cont.pic);
            loadMovie(ifFolder+"/"+_root.url+images, cont.pic);
        }
    }
}



______________________________________________________________________ ___________________



***** Here is the first frame frome scene:



import mx.transitions.Tween;
import mx.transitions.easing.*;




Stage.scaleMode = "noScale";
Stage.align = "TL";
setProperty("", _quality, "BEST");
url = "tfile";



_root.linkGallery=0;

_root.titleGallery = 0;



_root.cacheKiller = "true";
import gs.dataTransfer.XMLParser;
function onFinish(success_boolean, results_obj, xml) {//This fhunction gets called as soon as the XML loads and gets parsed.
    if (success_boolean) {
       
    }
}
stop();







var parsed_obj = {};//We'll use this to hold the parsed xml object (once the XML loads and gets parsed successfully).
var unCash = new Date().getTime();
if (_root.cacheKiller == "true") {



    fileToLoad = url+"_main.xml?cacheKiller="+unCash;
    fileToLoad = url+"_main.xml";
} else {
    fileToLoad = url+"_main.xml";
}
XMLParser.load(fileToLoad,onFinish,parsed_obj);



_root.emp.useHandCursor = 0;
///forplayer
_root.mus = 1;
_root.n = 1;
_root.num = 1;



______________________________________________________________________


*** This is the second frame :



import gs.dataTransfer.XMLParser;
function onFinish(success_boolean, gallery_obj, xml) {//This fhunction gets called as soon as the XML loads and gets parsed.
    if (success_boolean) {
        play();
    }
}



//system settings
// frame number where readMore movieClip is situated
pagesReadMoreFrame = 4;
// frame number of the first content page
firstPageFrame = 1;
//system settings



#include "gs/dataTransfer/xmlFunctions.as"



//_root.link=_root.getMenuSystemOrder(0);
//trace(_root.link)
_root.link = 1;



_root.titleNumPage = 1;



_root.openNewGallery = true



_root.part = _root.xmlNodes.childNodes[0].childNodes[0].attributes.name





______________________________________________________________________ ___



*** And here is the xmlFunctions.as:



import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip) {
    // Create a movie clip which will contain our
    // unsmoothed bitmap
    var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
    // Create a listener which will notify us when
    // the bitmap loaded successfully
    var listener:Object = new Object();
    // Track the target
    listener.tmc = target;
    // If the bitmap loaded successfully we redraw the
    // movie into a BitmapData object and then attach
    // that BitmapData to the target movie clip with
    // the smoothing flag turned on.
    listener.onLoadInit = function(mc:MovieClip) {
        mc._visible = false;
        var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
        this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), "auto", true);
        bitmap.draw(mc);
    };
    // Do it, load the bitmap now
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.addListener(listener);
    loader.loadClip(url, bmc);
}







var mainObj=_root.parsed_obj;
var galleryObj=_root.gallery_obj;




function textSelectable(selectedObject) {
    isTextSelected=getSettingsValue(mainObj, "textSelectable", "item");
    if (isTextSelected=="true") {
        selectedObject.selectable=true;
       
        }
    }




function getXmlSection (obj, itemName,  sectionName) {
        i=0;
    while (obj[itemName][i]) {
        if (obj[itemName][i].name==sectionName) {
            returnedResult=true;
            return (i);
            break;
        }
        i++;
    }
}




function getSettingsValue (obj, itemName, itemType) {
    sectionNum=getXmlSection(obj, "section",  "settings");
    k=0;
    while (obj["section"][sectionNum][itemType][k]) {
        if (obj["section"][sectionNum][itemType][k].name==itemName) {
            return (obj.section[sectionNum][itemType][k].value);
            break;
        }
        k++;
    }
}



function getCopyright (textObj) {
    textObj.htmlText=getSettingsValue(mainObj, "copyright", "item");
    textSelectable(textObj);
}




function getCompanyName (textObj) {
    textObj.htmlText=getSettingsValue(mainObj, "companyName", "item");
    textSelectable(textObj);
}



function getSlogan (textObj) {
    textObj.htmlText=getSettingsValue(mainObj, "slogan", "item");
    textSelectable(textObj);
}




function getSystemValue (textObj, systemOptionName) {
    textObj.htmlText=getSettingsValue(mainObj, systemOptionName, "item");
    textSelectable(textObj);
}








function getMenuLink (textObj, linkNum) {
    sectionNum=getXmlSection(mainObj, "section",  "menu");
    textObj.htmlText=mainObj["section"][sectionNum].link[linkNum].value;
    textSelectable(textObj);
}








function getMenuSystemOrder (linkNum) {
    sectionNum=getXmlSection(mainObj, "section", "menu");
    return (mainObj["section"][sectionNum].link[linkNum].systemOrder);
   
}
//------------------------
function getGlobalText(textObj, textsNumber, optional:Boolean) {
    sectionNum = getXmlSection(mainObj, "section", "global_text");
    textObj.htmlText = mainObj["section"][sectionNum].texts[textsNumber].value;
    if (optional == undefined) {
        textSelectable(textObj);
    } else {
        // do nothing
    }
}
function getGlobalImageName(imageNumber) {
    sectionNum = getXmlSection(mainObj, "section", "global_img");
    //currentPage = _root.link-_root.firstPageFrame;
    imageParams = new Array();
    imageParams['name'] = mainObj["section"][sectionNum]["image"][imageNumber]["imageUrl"];
    imageParams['linkToOpen'] = mainObj["section"][sectionNum]["image"][imageNumber]["link"];
    return (imageParams);
}
//------------------------




function getCurrentText(textObj, textNumber) {
    sectionNum=getXmlSection(mainObj, "section", "pages");
    currentPage=_root.link-_root.firstPageFrame;
    textObj.htmlText=mainObj["section"][sectionNum]["page"][currentPage][ "texts"][0]["pageText"][textNumber].value;
    textSelectable(textObj);



}








function getMenuPreviousLink (linkNum) {
    k=0;
    systemOrder=getMenuSystemOrder(k);
    while (systemOrder) {
        if (systemOrder==linkNum) {
            orderResult=k+1;
            break;
        }
        k++;
        systemOrder=getMenuSystemOrder(k);
    }
    return (orderResult);
}




function getCurrentImageName(imageNumber) {
    sectionNum=getXmlSection(mainObj, "section", "pages");
    currentPage=_root.link-_root.firstPageFrame;
    imageParams=new Array();
    imageParams['name']=mainObj["section"][sectionNum]["page"][currentPag e]["image"][imageNumber]["imageUrl"];
    imageParams['linkToOpen']=mainObj["section"][sectionNum]["page"][curr entPage]["image"][imageNumber]["link"];
    imageParams['target']=mainObj["section"][sectionNum]["page"][currentP age]["image"][imageNumber]["target"];
    return (imageParams);
}



function getCurrentImageName_splash(imageNumber) {
    sectionNum=getXmlSection(mainObj, "section", "settings");
    imageParams=new Array();
    imageParams['name']=mainObj["section"][sectionNum]["image"][imageNumb er]["imageUrl"];
    imageParams['linkToOpen']=mainObj["section"][sectionNum]["image"][ima geNumber]["link"];
    return (imageParams);
}



function checkLinkType (linkTextType, linkNumber) {
         k=0;
        typeCount=0;
        finalLinkNumber=parseInt(linkNumber)+1;
        currentPage=_root.link-_root.firstPageFrame;
        sectionNum=getXmlSection(mainObj, "section", "pages");
        linkTypeCkeck=mainObj["section"][sectionNum]["page"][currentPage]["li nk"][k]["linkType"];
        while (linkTypeCkeck){
            if (linkTypeCkeck==linkTextType) {
                 typeCount++;
            }
            if (typeCount==finalLinkNumber) {
               
                return(k);
                break;
            }
            k++;
            linkTypeCkeck=mainObj["section"][sectionNum]["page"][currentPage]["li nk"][k]["linkType"];
        }
}



_root.readMoreFrameType = 'readmore';



function more_click_func(number) {
    tempNumber = number.split(" ");
    number=tempNumber.join("");
    number=number.toLowerCase();
    num=_root.pagesReadMoreFrame;
    currentPage=_root.link-_root.firstPageFrame;
   
    if( isNaN(Number(number)) ) {
        readMoreType = number;
    } else {
        readMoreType = 'readmore';
    }
   
    //if( (_root.link<>num || _root.readMoreFrameType!=readMoreType)) {     



        if (_root.animation){
            //if (_root.link<>5 ){
           
        _root["item" + getMenuPreviousLink(_root.link)].gotoAndPlay("s2");
       
        //_root.menu2["item" + getMenuPreviousLink(_root.link)].gotoAndPlay("s2");
       
        if (number=='privacypolicy') {
            _root.readMoreFrameType = 'privacypolicy';
            sectionNum=getXmlSection(mainObj, "section", "privacyPolicy");
            titleNum=getXmlSection(mainObj.section[sectionNum], "item", "pageTitle");
            textNum=getXmlSection(mainObj.section[sectionNum], "item", "pageText");
            _root.readMoreTitle=mainObj.section[sectionNum]["item"][titleNum].val ue;
            _root.readMoreText=mainObj.section[sectionNum]["item"][textNum].value ;
        } else if (number=='termsofuse') {
            _root.readMoreFrameType = 'termsofuse';
            sectionNum=getXmlSection(mainObj, "section", "termsOfUse");
            titleNum=getXmlSection(mainObj.section[sectionNum], "item", "pageTitle");
            textNum=getXmlSection(mainObj.section[sectionNum], "item", "pageText");
            _root.readMoreTitle=mainObj.section[sectionNum]["item"][titleNum].val ue;
            _root.readMoreText=mainObj.section[sectionNum]["item"][textNum].value ;
        } else {
            _root.readMoreFrameType = 'readmore';
            sectionNum=getXmlSection(mainObj, "section", "pages");
            linkCount=checkLinkType("readMoreLink", number);
            i=0;
            linkTitleNum=getXmlSection(mainObj["section"][sectionNum]["page"][cur rentPage]["link"][linkCount], "item", "title");           
            linkTextNum=getXmlSection(mainObj["section"][sectionNum]["page"][curr entPage]["link"][linkCount], "item", "linkText");
            _root.readMoreTitle=mainObj["section"][sectionNum]["page"][currentPag e]["link"][linkCount]["item"][linkTitleNum].value;
            _root.readMoreText=mainObj["section"][sectionNum]["page"][currentPage ]["link"][linkCount]["item"][linkTextNum].value;           
        }
                _root.subMenu.subMenu.subMenu["item"+(_root.link-1)].mouseRelease = true;
                _root.link = 8;
                _root.linkClosePanel = false;
                _root.titleNumPage = _root.pagesReadMoreFrame;           
                _root.content.play();           
           
        }
        //}
}



function getContactFormText(textObj, textNumber) {
    sectionNum=getXmlSection(mainObj, "section", "contactForm");
    textObj.htmlText=mainObj["section"][sectionNum]["texts"][0]["pageText "][textNumber].value;
    textSelectable(textObj);
}




function getContactFormText_only(textNumber) {
    sectionNum=getXmlSection(mainObj, "section", "contactForm");
    return htmlText=mainObj["section"][sectionNum]["texts"][0]["pageText"][textN umber].value;



}




function getContactFormParams() {
    sectionNum=getXmlSection(mainObj, "section", "contactForm");
    ContactFormParams=new Array();
    servNum=getXmlSection(mainObj["section"][sectionNum], "item", "serverOption");
    recNum=getXmlSection(mainObj["section"][sectionNum], "item", "recipient");
    ContactFormParams['rec']=mainObj["section"][sectionNum]["item"][recNu m].value;
    ContactFormParams['serv']=mainObj["section"][sectionNum]["item"][serv Num].value
    return (ContactFormParams);
}








// gallery functions
function getGallerySystemProperty(propName) {
    sectionNum=getXmlSection(galleryObj, "section", "systemOptions");
    propNum=getXmlSection(galleryObj["section"][sectionNum], "option", propName);
    return (galleryObj["section"][sectionNum]["option"][propNum].value);
}



function getGallerySettings(propName) {
    sectionNum=getXmlSection(galleryObj, "section", "settings");
    propNum=getXmlSection(galleryObj["section"][sectionNum], "option", propName);
    return (galleryObj["section"][sectionNum]["option"][propNum].value);
}



function getGalleryImage(imageNum, categoryNum) {
    sectionNum=getXmlSection(galleryObj, "section", "imagesData");
    imageParams=new Array();
    image=galleryObj["section"][sectionNum]["category"][categoryNum]["ima ge"][imageNum];
    nameNum=getXmlSection(image, "item", "imageUrl");
    commentNum=getXmlSection(image, "item", "imageComment");
    imageParams['name']=image['item'][nameNum].value;
    imageParams['comment']=image['item'][commentNum].value;
    return (imageParams);
}



function getCurrentGalleryName(categoryNum) {
    sectionNum=getXmlSection(galleryObj, "section", "imagesData");
    return (galleryObj["section"][sectionNum]["category"][categoryNum].name);
}
RiKardo
 
Mesaje: 5
Membru din: Mie Noi 10, 2010 5:16 pm

Re: Adaugare link peste imagine din XML, putin ajutor

Mesajde RiKardo » Joi Noi 18, 2010 11:10 am

Rezolvat prin importare de .swf - uri in loc de .jpg-uri din XML.
RiKardo
 
Mesaje: 5
Membru din: Mie Noi 10, 2010 5:16 pm


Înapoi la Joburi

Cine este conectat

Utilizatorii ce navighează pe acest forum: Niciun utilizator înregistrat şi 1 vizitator

cron