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

    quando si clicca sulla news deve scaricare un file pdf

    ciao ragazzi..vorrei sapere come far aprire un file pdf al click sulla news che scorre...

    File XML

    <?php
    session_start();
    require("../common/funzioni.php");

    $res_news=dbquery("SELECT * FROM news ORDER BY data DESC ");

    header("Content-type: text/xml");
    echo '<?xml version="1.0" encoding="UTF-8" ?> '."\n";
    echo '<messaggi>'."\n";
    while ($news=mysql_fetch_array($res_news)) {
    echo '<url>http://....../$news['allegato_eng']</url>
    <testo><![CDATA['.convertiData($news['data']).' - '.stripslashes($news['descrizione_eng']).']]></testo>'."\n";
    }
    echo '</messaggi>'."\n";
    ?>

    ACTION SCRIPT

    function loadXML()
    {
    function ElaboraXML(success)
    {
    if (datiXML.loaded)
    {
    contenuto = datiXML.firstChild;
    i = 0;
    node = contenuto.firstChild;
    while (node != null)
    {
    j = 0;
    for (childNode = node.firstChild; childNode != null; childNode = childNode.nextSibling)
    {
    trace (childNode.nodeValue);
    text.testo.htmlText = text.testo.htmlText + childNode.nodeValue;
    text.testo.htmlText = text.testo.htmlText + " ";
    ++j;
    } // end of for
    trace (text.testo._width);
    text.testo.autoSize = true;
    node = node.nextSibling;
    ++i;
    } // end while
    text._x = -text._width;
    muovi();
    } // end if
    } // End of the function
    unico = new Date().getTime();
    datiXML = new XML();
    datiXML.ignoreWhite = true;
    datiXML.onLoad = ElaboraXML;
    datiXML.load("../xml/news_eng.php");
    } // End of the function

    function muovi()
    {
    this.onEnterFrame = function ()
    {
    if (text._x < -text._width)
    {
    text._x = 630;
    } // end if
    text._x = text._x - 2;
    };
    } // End of the function
    function ferma()
    {
    delete this.onEnterFrame;
    } // End of the function
    loadXML();

  2. #2
    Per scaricare il pdf basta passare il percorso alla funzione, quindi quello che devi fare è leggere il percorso dall'xml e passarlo alla funzione lanciata dal click.

    getURL()

  3. #3
    dici di fare una funzione di questo genere?


    datiXML.onPress=function(){
    getURL(url, "_blank");
    }

  4. #4
    No, non puoi usare onPress su un oggetto xml.

    Devi mettere un clip sullo stage (magari puoi farlo con attachMovie), e usare l'onPress (meglio ancora l'onRelease) su quello.

  5. #5
    il problema è che non so come farlo..potresti aiutatmi?perchè questo è un file che mi hanno dato e dovrei modificarlo ma di programmazione con AS non me ne intendo per niente

  6. #6
    Eh, bisognerebbe sapere come è fatto quello che già hai, se a già un clip con la news basta che metti da qualche parte un bottone (disegna ad esempio un quadrato, poi ci fai F8 sopra e lo converti in clip), lo chiama ad esempio "bottone" sul pannello con le proprietà.
    Poi sul frame che lo ospita scrivi

    bottone.onRelease = function(){
    getURL(url, "_blank")
    }

    ovviamente url dovrai averla dichiarata correttamente

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.