Visualizzazione dei risultati da 1 a 6 su 6

Discussione: singolo frame in XML

  1. #1

    singolo frame 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 puntasse ha un singolo frame (per esempio il frame numero 50)...nel file xml e' settato l'apertura di un URL HTML, vorrei modificare il link a un singolo frame.
    ho trovato la soulzione sul sito dove vennero acquistati i tutorials, ho provato a eseguire le istruzioni pero nn mi funziona. qualcuno mi puo aiutare

    aggiungo la descrizione del sito per la modifica:

    If you want to link to frames within your movie, you specify the frame number or frame name instead urls and you need to edit the .fla file, edit the main application movie clip / go to the ReadMe layer and look for a getURL ( if you're using ActionScript 2 ) action and change it with a gotoAndStop() or gotoAndPlay() action.


    You'll lso need to place the correct timeline path to where your frame(s) are located before gotoAndStop() similar to:

    MovieClip(this.parent.parent).gotoAndPlay(releaseO utsideTarget["info"].attributes.url)

    ....

    // this code line was extracted from an ActionScript 3.0 application ( for ActionScript 2.0 you'll do it in a similar way )



    e questo dovrebbe essere il codice in questione (ActionScript 2.0):

    //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);
    }
    }

    grazie mille

  2. #2
    nessuno mi aiuta??? help!!!!!!!

  3. #3
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Bella la spiegazione ti mettono un codice as3 quando invece utilizzi un filmato as2.

    for ActionScript 2.0 you'll do it in a similar way

    Se per caso le variabili e gli oggetti coincidessero si potrebbe pensare di trasportare il codice, ma bisognerebbe vederlo al completo, compresa la struttura xml.

  4. #4

    actionscrip 2.0 - .fla

    //////////////////////////////// END MAIN PARAMS /////////////////////////////



    // AUXILIARY VARIABLES USED IN CALCULATION //

    //if (useInvisibleMask) {this._parent.maskMc._visible = false;}
    // else {this.setMask(this._parent.maskMc);}

    //var menuWidth;
    //menuWidth = this._parent.maskMc._width + menuWidthOffset;


    var xmlObj: XML;
    var nodes = new Array();

    var currspeed = 0;
    var oldspeed = 0;

    var dragging = false;
    var oldxmouse = 0;

    var totalDistance = 0;

    var useFixedImageSize = 1;

    var leftLimit;
    var startPos = this._x;

    // 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]);

    }

  5. #5

    codice xml

    <?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="50" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="50" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="50" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="50" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="50" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="50" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="50" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="50" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="50" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="50" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="50" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="50" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="50" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="50" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="50" window="_blank" title="FT Special Pack" />
    <object source="images/p1.jpg" url="50" window="_blank" title="3D Rotate" />
    <object source="images/p2.jpg" url="50" window="_blank" title="FT Progress Bar" />
    <object source="images/p3.jpg" url="50" window="_blank" title="Advanced Scroll Bar" />
    <object source="images/p4.jpg" url="50" window="_blank" title="HTML Table Renderer" />
    <object source="images/p5.jpg" url="50" window="_blank" title="FT Special Pack" />



    </menu>

    _________________

    grazie mille

  6. #6
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    No guarda, vederlo così non mi serve a nulla, ci vorrebbero i file, ma personalmente ora non ho neanche la possibilità di vederli, sto scrivendo da cell e ovviamente non ho flash a disposizione

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.