A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: A little preferences puzzle

  1. #1
    Multimedia Developer
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    41
    I am making a site for a friend in flash, and i have to indlude some buttons to :

    Set as homepage
    Add to favorites

    This isnt a problem in html or javascript, but i cant seem to get anything work, as all the code works with href links and the 'On Click' function!!

    Does anyone have anything similar on their flash site or know how to perform these things in callable JS functions??

    Any help welcome .

    Cheers!!

  2. #2
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    Hi,

    I'll assume that you know how to write JS & html, so this is what you do:

    Write your JS functions into the head of the html document.
    Add the following AS to a button or frame:

    getURL("javascript:functionName()");

    Thats it (assuming that the function is called functionName) and if it isn't, just change the name in the AS.

    XFM

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    7

    Heres a bit my DW extension throws in


    for others using Dreamweaver, here's some Java

    <script language="JavaScript">
    <!--
    if(document.all){
    document.write("<P ALIGN='CENTER'><A HREF='#' onclick='window.external.AddFavorite(top.location. href, top.document.title);return false'>Add my page to your Favorites</A></P>")
    }
    //-->
    </script>

  4. #4
    Multimedia Developer
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    41

    Lightbulb

    Hey, thanks for all your help......the homepage code didnt work in IE6, but the Crockatt, thank for the Favourites code!!

    I found the solution :

    I knew how to call a function, but the code for setting the homepage seemed only to work 'onClick' (used in a html link) and would not fire if made into a seperate method.

    For future reference (after much homework) anyone wanting to set a home page from flash thru JavaScript use this:

    In JS:

    function setHomePage(){
    document.all[0].style.behavior="url(#default#homepage)";
    document.all[0].setHomePage('your URL');
    }

    (uses 'document.all[0]' rather than '.this')

    In flash:

    on(release){
    getURL("JavaScript:setHomePage()")
    }






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center