Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Movie esterno in XML

  1. #1

    Movie esterno in XML

    ciao a tutti, premesso che le mie conoscienze di AS e XML sono minime, avrei un quesito.
    Ho scaricato e elaborato un tutorial riguiardante un menu dove gli elementi sono delle immagini, ad ogni immagine mi piacerebbe associare un link che caricasse un movie esterno (che a sua volta ne caricasse un altro, etc..)...nel file xml e' settato l'apertura di un URL, vorrei modificarlo con un movie di flash.

    aggiungo lo script:

    <?xml version="1.0"?>
    <menu>

    <!-- main parameters group (other parameters may be available by editing the ReadMe layer of each main Movie Clip within the source .fla file
    and also the scroll bar component parameters for the thumbs menu and the description box.

    - if you modify some parameter values in Flash you can remove / comment the respective parameters from xml, this way the default Flash values will not be overwritten with values given in the xml file.

    - to change the graphic elements you need to edit the file in Flash and adjust the respective symbols with your own custom graphcis

    NOTE: If you want to use FlashVars inside the html page(s) of your site where you want to insert the .swf object in order to use a different .xml
    configuration file url or to find an answer to a common question please check the General Tips & Tricks for All Flashtuning Products tutorial
    available on our site in the tutorials section at this location:

    http://www.flashtuning.net/tutorials/
    -->


    <object param="maxThumbWidth" value="320" />
    <object param="maxThumbHeight" value="324" />


    <object param="showScrollableArea" value="0" />
    <object param="scrollableAreaWidth" value="1083" />
    <object param="scrollableAreaHeight" value="600" />


    <object param="menuX" value="0" />
    <object param="menuY" value="185" />


    <object param="itemsOffset" value="5" /> <!-- the real distance between photos when using initZoomOut = 0
    or a virtual distance when using initZoomOut = 1 -->

    <object param="initZoomOut" value="0" />


    <object param="useZoom" value="1" />
    <object param="zoomDir" value="1" />
    <object param="zoomFactor" value="4" />
    <object param="zoomSpeed" value="3" />


    <object param="yFactor" value="3" />


    <object param="useBitmapSmoothing" value="1" />


    <object param="tweenDecay" value="1" />
    <object param="tweenToleration" value=".10" />


    <object param="useMirror" value="1" />
    <object param="mirrorHeightGaign" value="0.3" />
    <object param="mirrorOffset" value="0" />


    <object param="showThumbTitle" value="0" />
    <object param="titleXOffset" value="2" />
    <object param="titleYOffset" value="60" />




    <object source="images/p1.jpg" url="" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="" window="_blank" title="FT Special Pack" />
    </menu>


    grazie mille

  2. #2
    ho trovato una mezza soluzione, ho capito come modificare il file XML, pero mi dicono di sostituire nel .fla il comando getUrl con gotoAndStop, ho provato pero nn funziona. qualcuno mi puo aiutare???

    posto lo script del file .fla

    // METHODS //

    //if xml file is defined with FlashVars, overwrite the default xml file name
    if (_root.xmlFile!=undefined) xmlData = unescape(_root.xmlFile);

    init(); //init call -> load config XML and create objects

    function init() {
    xmlObj = new XML(xmlData);
    xmlObj.ignoreWhite = true;
    xmlObj.load(xmlData);
    this.onEnterFrame = checkXMLprogress;
    }

    function checkXMLprogress() {
    var tmpBytesLoaded = xmlObj.getBytesLoaded();
    var tmpBytesTotal = xmlObj.getBytesTotal();
    if ((tmpBytesLoaded==tmpBytesTotal) && (tmpBytesTotal > 4)) {
    delete this.onEnterFrame;
    addObjects();
    startEngine();
    } //end if
    }


    function startEngine() {
    this.onEnterFrame = engineHandler;
    }


    function addObjects() { //add objects in the scene

    var objects = xmlObj.firstChild.childNodes;
    var j = 0;

    for(var i=0; i<objects.length; i++) {
    //trace(objects[i].attributes.param+" "+objects[i].attributes.value);
    if (objects[i].attributes.param != undefined) {

    if (objects[i].attributes.param=="itemsOffset") this.offset = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="maxThumbWidth") this.maxThumbWidth = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="maxThumbHeight") this.maxThumbHeight = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="showScrollableArea") {
    useInvisibleMask = Number(objects[i].attributes.value);
    if (useInvisibleMask==0) {this._parent.maskMc._visible = false;}
    else {this._parent.maskMc._visible = true;}
    }

    if (objects[i].attributes.param=="scrollableAreaWidth") this._parent.maskMc._width = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="scrollableAreaHeight") this._parent.maskMc._height = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="menuX") this._parent._x = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="menuY") this._parent._y = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="tweenDecay") this.tweendecay = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="tweenToleration") this.tweentoleration = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="initZoomOut") this.initZoomOut = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="useZoom") this.useZoom = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="zoomDir") this.zoomDir = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="zoomFactor") this.zoomFactor = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="zoomSpeed") {
    this.zoomSpeed = Number(objects[i].attributes.value);
    this.maxZoom = this.zoomFactor * this.zoomSpeed;
    }


    if (objects[i].attributes.param=="yFactor") this.yFactor = Number(objects[i].attributes.value);

    if (objects[i].attributes.param=="useBitmapSmoothing") this.useBitmapSmoothing = Number(objects[i].attributes.value);


    if (objects[i].attributes.param=="useMirror") this.useMirror = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="mirrorHeightGaign") this.mirrorHeightGaign = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="mirrorOffset") this.mirrorOffset = Number(objects[i].attributes.value);


    if (objects[i].attributes.param=="showThumbTitle") this.showTitle = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="titleXOffset") this.titleXOffset = Number(objects[i].attributes.value);
    if (objects[i].attributes.param=="titleYOffset") this.titleYOffset = Number(objects[i].attributes.value);

    }
    else {


    var link = objects[i].attributes.source; //the image link in the xml file
    if (useFixedImageSize==1) source1 = "imgMc"; //image mc linkage id from the library
    else source1 = "imgMc_01";
    var sourceType1 = "library";
    var regName1 = "p"+i; //the registration name used in Flash

    this.attachMovie(source1,regName1,1000+i);

    var x1 = (this.maxThumbWidth/2 + xOffset) + (j * (this.maxThumbWidth + offset));
    var y1 = this.maxThumbHeight/2;
    this[regName1]._x = x1;
    this[regName1]._y = y1;

    if (useZoom) { //set some variables used in object zoom calculation
    this[regName1]["currZoom"] = 0;
    }

    //this[regName1]["imgBox"].loadMovieNum("pride.swf", 1); //load external image


    this[regName1]["info"] = objects[i];//keep the XML node info
    nodes[j] = this[regName1]; //add object to nodes array

    //this[regName1].onPress = pressHandler;
    //this[regName1].onRelease = this[regName1].onReleaseOutside = releaseHandler;

    j++;

    }
    }//end for

    var nr = nodes.length;
    //var inst = "p"+nr;
    //var pos = sc.getCoordinates(inst);

    totalDistance = (nr * (this.maxThumbWidth + offset)) - offset;
    //trace(totalDistance+" "+this["p0"]._width);

    if (this._parent.maskMc._width > this._width ) { leftLimit = 0 }
    else { leftLimit = this._parent.maskMc._width - this._width }

    }


    function activateHandlers(obj) {
    obj.onPress = pressHandler;
    obj.onRelease = obj.onReleaseOutside = releaseHandler;
    obj.onRollOver = rollOverHandler;
    obj.onRollOut = rollOutHandler;
    }


    function pressHandler() {

    //ADD CUSTOM CODE HERE WHEN THE IMAGE IS PRESSED

    bpress();
    }

    function releaseHandler() {

    //ADD CUSTOM CODE HERE WHEN THE IMAGE IS RELEASED

    brelease();

    //open url
    openURL(this);

    if (useRollOverColoring) {
    resetColor(this);
    }
    }


    // rollOver/rollOut handlers

    function setColor(obj) {
    var trans:Transform = new Transform(obj);
    var colorTrans:ColorTransform = new ColorTransform();
    //colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset=0;
    colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=0;
    obj.onEnterFrame = function () {
    if (colorTrans.blueOffset < maxC) {
    // colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset+=color ingSpeed;
    colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset+=coloringSpeed;
    trans.colorTransform = colorTrans;
    }
    else {delete obj.onEnterFrame;}
    }
    }

    function resetColor(obj) {
    var trans:Transform = new Transform(obj);
    var colorTrans:ColorTransform = new ColorTransform();
    //colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset= maxC;
    colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset= maxC;
    obj.onEnterFrame = function () {
    if (colorTrans.blueOffset > 0) {
    //colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset=colorTrans.alphaOffset -= coloringSpeed;
    colorTrans.blueOffset = colorTrans.greenOffset = colorTrans.redOffset -= coloringSpeed;
    trans.colorTransform = colorTrans;
    }
    else {delete obj.onEnterFrame;}
    }
    }


    function setZoom(obj) {
    obj.onEnterFrame = function () {
    //trace("set zoom");
    if (obj["currZoom"]!=maxZoom) {
    obj["currZoom"] += zoomSpeed;
    var zf = (zoomDir * zoomSpeed); //zoomDir is for back/front zoom direction
    //obj._width += zf;
    //obj._height += zf;
    obj._xscale += zf;
    obj._yscale += zf;
    obj._y += zf/yFactor;

    }
    else {delete obj.onEnterFrame;}
    }
    }

    function resetZoom(obj) {
    obj.onEnterFrame = function () {
    // trace("reset zoom");
    if (obj["currZoom"]!=0) {
    obj["currZoom"] -= zoomSpeed;
    var zf = ((-1) * zoomDir * zoomSpeed); //zoomDir is for back/front zoom direction
    // obj._width += zf;
    // obj._height += zf;
    obj._xscale += zf;
    obj._yscale += zf;
    obj._y += zf/yFactor;
    }
    else {delete obj.onEnterFrame;}
    }
    }



    function rollOverHandler() {

    if (showTitle) this["title"].gotoAndPlay(2);

    if (useRollOverColoring) {
    setColor(this);
    }

    if (useZoom) {
    this["dpth"] = this.getDepth();
    this.swapDepths(2000);
    setZoom(this);
    }

    /*if (useRollOverColoring || useZoom) {
    setEffects(this);
    }*/

    }

    function rollOutHandler() {

    if (showTitle) this["title"].gotoAndStop(1);

    if (useRollOverColoring) {
    resetColor(this);
    }

    if (useZoom) {
    this.swapDepths(this["dpth"]);
    resetZoom(this);
    }
    }

    // end rollOver / rollOut colors //


    function openURL(obj) {
    //navigate to an url if url!=undefined
    var setLink = ((obj["info"].attributes.url!=undefined) && (obj["info"].attributes.url!=""));
    if (setLink) {
    getURL(obj["info"].attributes.url,obj["info"].attributes.window);
    }
    }


    function engineHandler() {

    var xmouse = this._parent.maskMc._xmouse;
    if (xmouse > this._parent.maskMc._width) xmouse = this._parent.maskMc._width;
    if (xmouse < 0) xmouse = 0;

    mousediff = xmouse - oldxmouse;

    //trace(mousediff);
    var pct = mousediff/this._parent.maskMc._width;
    var maxdist = (totalDistance - this._parent.maskMc._width) * pct;
    //trace(mousediff+" "+totalDistance+" "+menuWidth);
    oldxmouse = xmouse;

    currspeed = tween(currspeed,maxdist);
    //race(currspeed)
    if (currspeed!=oldspeed) {
    oldspeed=currspeed;
    this._x -= currspeed;
    //this._x = Math.round(this._x);
    }

    };


    var endTween = 0;
    function tween(pos1, pos2) {
    if (Math.abs(pos2-pos1)<= tweentoleration) {
    endTween = 1
    return pos2;
    } else {
    endTween = 0
    return (pos1 + tweendecay*(pos2-pos1));
    }
    }

    //setMirror() -> added May, 21 2008
    //targetMc -> target Movie Clip to apply mirror
    //mirrorMc -> mirror Movie Clip
    //maskMcLinkageId -> mirror gradient mask linkage id mask from the library

    function setMirror(targetMc,mirrorMc,maskMcLinkageId) {

    mirrorMc._y = targetMc._y + 2*targetMc._height + mirrorOffset;

    mirrorMc._yscale = -100;

    mirrorMc.cacheAsBitmap = true;

    targetMc._parent.attachMovie(maskMcLinkageId,maskM cLinkageId,100);

    targetMc._parent[maskMcLinkageId].cacheAsBitmap = true;

    targetMc._parent[maskMcLinkageId]._width = mirrorMc._width; //set proper reflexion size
    targetMc._parent[maskMcLinkageId]._height = mirrorMc._height*mirrorHeightGaign;

    targetMc._parent[maskMcLinkageId]._y = targetMc._y + targetMc._height + mirrorOffset;
    targetMc._parent[maskMcLinkageId]._x = targetMc._x;

    mirrorMc.setMask(targetMc._parent[maskMcLinkageId]);

    }

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 © 2025 vBulletin Solutions, Inc. All rights reserved.