Welcome, Guest
  • Author Topic: Import Javascript  (Read 2602 times)

    Casper Lammertink

    • Server what's that
    • *
    • Posts: 4
      • View Profile
      • Email
    Import Javascript
    « on: 10/30/03, 04:00 »
    I received the code bellow from sophos antivirus to show a list of latest virusses, but i want to show this in a swf file(not in a popup, html), can anybody help me with this??

    Thanks

    Casper Lammertink

    === START OF CODE ===

    <!-- Sophos info feed: latest virus alerts - START -->
    <script language="JavaScript1.1" src="http://www.sophos.com/virusinfo/infofeed/tenalerts.js"></script>
    <script language="JavaScript1.1">
    <!--

    // Want to customise the look and feel of the virus information // on your site? Simply change the following values to your own // preferences. // // Changing the value of 'count' will change the number of rows // displayed. // Changing the value of 'target' to 'new' will display the link in
    // a new window.

    // *****************************************************************

    var bgcolour_main     = '#cccccc'
    var bgcolour_heading  = '#99cccc'
    var text_colour       = '#000000'
    var link_colour       = '#000099'
    var font_size         = '1'
    var font_face         = 'verdana, arial, helvetica, sans-serif'
    var count             =  10   // number should be between 1 and 10
    var first_column      = 'yes' // 'yes' or 'no'
    var cellspacing       = 'yes' // 'yes' or 'no'
    var target            = '_self' // '_self' or 'new'

    // *****************************************************************
    //  Be careful not to change anything below this line!


    var htmltxt = "";
    var font_desc = '<font face="' + font_face + '" size="'
     + font_size + '" color="' + text_colour + '">';
    var tmp_count = 0;
       
    if (first_column == "no") {
     colspan = 1;
    } else {
     colspan = 2;
    }

    if (cellspacing == "no") {
     cellspacing = 0;
    } else {
     cellspacing = 2;
    }  

    if (count > 0) {
     if (count > 10) {count = 10}
     htmltxt += '\n<table cellpadding="6" cellspacing="'
     + cellspacing + '" border="0" bgcolor="#ffffff">';
     if (count == 1) {
       htmltxt += '\n<tr><td colspan="' + colspan + '" bgcolor="'
       + bgcolour_heading + '">' + font_desc
       + '<b>Latest virus alert</b></font></td></tr>';
     } else {
       htmltxt += '\n<tr><td colspan="' + colspan + '" bgcolor="'
       + bgcolour_heading + '">' + font_desc + '<b>Latest '
       + count + ' virus alerts</b></font></td></tr>';
     }

     for (var i=0; i<tenalerts.length; i+=3) {
       tmp_count++;
       if (tmp_count > count) {
         break;
       } else {
         if (first_column == "no") {
           htmltxt += '\n<tr><td bgcolor="' + bgcolour_main + '">'
           + font_desc + '<a href="' + tenalerts[i+2] + '" target="'
           + target + '"><font color="'
           + link_colour + '"><nobr>' + tenalerts[i+1]
           + '</nobr></font></a></font></td></tr>';
         } else {  
           htmltxt += '\n<tr><td bgcolor="' + bgcolour_main + '">'
           + font_desc + '<nobr>' + tenalerts[i+0]
           + '</nobr></font></td><td bgcolor="' + bgcolour_main + '">'
           + font_desc + '<a href="' + tenalerts[i+2] + '" target="'
           + target + '"><font color="'
           + link_colour + '"><nobr>' + tenalerts[i+1]
           + '</nobr></font></a></font></td></tr>';
         }
       }  
     }
    } else {
     document.write
     ("=== Sophos info feed error: Specify value of count > 0 ==="); }

    // Please do not remove the code after this point.

    htmltxt += '\n<tr><td colspan="' + colspan + '" bgcolor="'
    + bgcolour_heading + '">' + font_desc
    + 'Source: <a href="http://www.sophos.com" target="'
    + target + '"><font color="' + link_colour
    + '">Sophos Anti-Virus</font></a></font></td></tr>';
    htmltxt += '\n<tr><td colspan="' + colspan + '" bgcolor="'
    + bgcolour_heading + '">' + font_desc
    + '<a href="http://www.sophos.com/virusinfo/infofeed/" target="'
    + target + '"><font color="' + link_colour
    + '">Add this info to your website</font></a></font></td></tr>';
    htmltxt += '\n</table>';

    document.write(htmltxt);
    //-->
    </script>
    <!-- Sophos info feed: latest virus alerts - END -->

    === END OF CODE ===

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    Re:Import Javascript
    « Reply #1 on: 10/30/03, 11:48 »
    http://www.macromedia.com/support/flash/ts/documents/java_script_comm.htm

    see ur JS: [script]document.write(htmltxt);[/script] - that is part what writes the virus-text to page...  it should be something like: window.document.myFlash.SetVariable("myVar", htmltext); and in Flash the dynamic textfield should be named as (variable) myVar

    Casper Lammertink

    • Server what's that
    • *
    • Posts: 4
      • View Profile
      • Email
    Re:Import Javascript
    « Reply #2 on: 10/31/03, 03:35 »

    http://www.macromedia.com/support/flash/ts/documents/java_script_comm.htm

    see ur JS: [script]document.write(htmltxt);[/script] - that is part what writes the virus-text to page...  it should be something like: window.document.myFlash.SetVariable("myVar", htmltext); and in Flash the dynamic textfield should be named as (variable) myVar


    I am a beginner, but i don't quite understand what i have to do. I donwloaded the sample file from the macromedia website but can't figur it out. Can you please desribe by step what i have to do?

    Thanks

    Casper ???

    Casper Lammertink

    • Server what's that
    • *
    • Posts: 4
      • View Profile
      • Email
    Re:Import Javascript
    « Reply #3 on: 10/31/03, 03:54 »


    http://www.macromedia.com/support/flash/ts/documents/java_script_comm.htm

    see ur JS: [script]document.write(htmltxt);[/script] - that is part what writes the virus-text to page...  it should be something like: window.document.myFlash.SetVariable("myVar", htmltext); and in Flash the dynamic textfield should be named as (variable) myVar


    I am a beginner, but i don't quite understand what i have to do. I donwloaded the sample file from the macromedia website but can't figur it out. Can you please desribe by step what i have to do?

    Thanks

    Casper ???


    If it's more easy they also have an RRS feed available and it sound like this:

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/">
    - <channel rdf:about="http://www.sophos.com/virusinfo/infofeed/hoax.xml">
     <title>Top virus hoaxes from Sophos</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/</link>
     <description>Top virus hoaxes from Sophos</description>
    - <items>
    - <rdf:Seq>
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/hotmail.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/meninasdaplayboy.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/bonsai.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/budweiserfrogs.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/jdbgmgr.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/virtualcard.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/billgates2.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/frogfish.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/wtcsurvivor.html" />
     <rdf:li rdf:resource="http://www.sophos.com/virusinfo/hoaxes/bloodhound.html" />
     <rdf:li rdf:resource="http://www.sophos.com/" />
     </rdf:Seq>
     </items>
     </channel>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/hotmail.html">
     <title>1 Hotmail hoax</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/hotmail.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/meninasdaplayboy.html">
     <title>2 Meninas da Playboy</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/meninasdaplayboy.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/bonsai.html">
     <title>3 Bonsai kitten</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/bonsai.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/budweiserfrogs.html">
     <title>4 Budweiser frogs screensaver</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/budweiserfrogs.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/jdbgmgr.html">
     <title>5 JDBGMGR</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/jdbgmgr.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/virtualcard.html">
     <title>6 A virtual card for you</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/virtualcard.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/billgates2.html">
     <title>7 Bill Gates fortune</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/billgates2.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/frogfish.html">
     <title>8 Frog in a blender/Fish in a bowl</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/frogfish.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/wtcsurvivor.html">
     <title>9 WTC Survivor</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/wtcsurvivor.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/virusinfo/hoaxes/bloodhound.html">
     <title>10 Bloodhound</title>
     <link>http://www.sophos.com/virusinfo/hoaxes/bloodhound.html</link>
     <description />
     </item>
    - <item rdf:about="http://www.sophos.com/">
     <title>Source: Sophos Anti-Virus</title>
     <link>http://www.sophos.com/</link>
     <description />
     </item>
     </rdf:RDF>

    ------------------
    please help they can't, or won't support flash! But we do!

    thanx

    Casper

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    Re:Import Javascript
    « Reply #4 on: 10/31/03, 09:47 »


    I am a beginner, but i don't quite understand what i have to do. I donwloaded the sample file from the macromedia website but can't figur it out. Can you please desribe by step what i have to do?

    Thanks

    Casper ???


    study MM's samples.. whats your knowledge with JavaScript anyways? How about XML & Flash ?

    Casper Lammertink

    • Server what's that
    • *
    • Posts: 4
      • View Profile
      • Email
    Re:Import Javascript
    « Reply #5 on: 10/31/03, 10:00 »
    ...almost nothing. The only thing i want is to show de data of the sophos on my website en not in a popup screen(html).


    casper

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    Re:Import Javascript
    « Reply #6 on: 10/31/03, 10:10 »
    sure you can try parse that RSS Feed, http://www.flash-db.com/services/?clientID=12&sType=Tools

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Import Javascript
    « Reply #7 on: 10/31/03, 13:28 »
    Also to read RSS feeds you can use http://flash-db.com/rss/

    Jorge