Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default execution of javascript from a flash button

    I am trying to execute a javascript function in the head of my page from a flash button.

    Is this possible. I have tried fscommand with no luck.

    Specifically i am using a .swf file as my navigaion bar for my website. I would like one of my buttons to open a new window that I a have determined the size and possition of.

    Any help would be great.
    Kurt Hurst
    YWAM Tyler

  2. # ADS
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    You can use a Javascript call directly from the getURL method to open a sized window directly from a flash button.....

    Code:
    on (release) {
    getURL ("javascript:NewWindow=window.open('http://ntdesigns.net','newWin','width=400,height=300,left=200,top=200,toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No');  NewWindow.focus();      void(0);");
    }
    Edit**** The above should be a single line of code. Many forum boards have trouble parseing JS code.

    If you have lots of buttons that will open JS pop up windows, it might be better to write a function and call it from a button.......

    Code:
    function launchNewWin(url,wdth,hdth,windowNewName){
    if(windowNewName==undefined){
    var windowNewName="newWin";
    }
    getURL
    ("javascript:window.open(\""+url+"\",\""+windowNewName+"\",\"width="+wdth+",heig
    ht="+hdth+",top=\"+((screen.availHeight/2)-("+hdth/2+"))+\",left=\"+((screen.ava
    ilWidth/2)-("+wdth/2+"))); void(0);");
    }
    Just declare it on frame1 of your flash movie and whenever you want to launch a new window, just write....
    Code:
    _root.launchNewWin("myUrl.htm", 550,400,"myNewWindow");
    Regards
    NTD
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. AppleScript & Flash JavaScript API
    By scubasteveatDPS in forum General Flash
    Replies: 1
    Last Post: 08-01-2006, 05:47 PM
  2. AppleScript & Flash JavaScript API
    By scubasteveatDPS in forum Client Side
    Replies: 0
    Last Post: 08-01-2006, 02:34 PM
  3. Flash and javascript.
    By raja_cd in forum Newbies
    Replies: 0
    Last Post: 03-19-2006, 02:19 PM
  4. Javascript -> Flash 5
    By catfriedrice in forum Newbies
    Replies: 1
    Last Post: 12-23-2005, 11:45 AM
  5. Problems with flash popup javascript and IE on MACS
    By 57strat in forum General Flash
    Replies: 2
    Last Post: 06-14-2005, 07:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial