A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: JAVASCRIPT running flash button

Hybrid View

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I don't see what your JS function is supposed to do. Also, the element and its ID need to be in the DOM, like a div for instance; certainly not a button instance name inside an embeded swf. A JS function, like AS, can accept parameters, though. So if you need to pass a variable value, insert it in your JS.

    if you HAVE to use javascript, use ExternalInterface.call to call the JS from flash.

    If not, this will suffice in Flash alone. Use a dyn txtfield with instance name keynum. Since you'll need to test the swf in standalone. The Function keys in authoring or test mode being reserved :

    PHP Code:
    var myListener:Object = new Object();
    myListener.onKeyDown = function () {
        if (
    Key.getCode() == 113) {
            
    keynum.text "F2 pressed";
        }
    }
    myListener.onKeyUp = function () {
        
    keynum.text "F2 released";
    }
    Key.addListener(myListener); 
    gparis

  2. #2
    Senior Member
    Join Date
    Aug 2009
    Posts
    113
    this will be inside flash right?

    What I want to do is allow javascript to trigger the flash button. I have a quiz like flash file but the textbox and questions are separated. They are in javascript. Then I have a Clue button in flash which will operate this:

    Code:
    getURL("javascript:command('clue',1)","_self");
    and the Clue button should have a keyboard shortvut F2.

    So if the client is typing in the textbox (focus is in html), he/she wont be able to press F2 and operate the flash button function. He/she needs to click on the swf interface first before he could press F2.

    The problem is not all clients know it. So we have to do something that even if the focus is in html, and the client presses F2, he/she would still be able to operate the Clue button.


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