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
    PHP Code:
    import flash.external.ExternalInterface;
    ExternalInterface.call("focus"); 
    will set the focus to the Flash

    Check the ExternalInterface Class in the liveDocs (link in my footer) for all communications between JS and Actionscript.

    Your first post was unclear to me. My 1st answer was on how to trigger something in Flash when a key is pressed. Obviously not what you need right now.

    gparis

  2. #2
    Senior Member
    Join Date
    Aug 2009
    Posts
    113
    yes, thank you. Is this externalinterface has something to do with AS3? bec i started creating the website in AS2..

  3. #3
    Senior Member
    Join Date
    Aug 2009
    Posts
    113
    anyone who could help me? Bec. I dont really have an idea how to start. Is it possible?


    and can someone tell me what is the meaning of this.addEventListener(KeyboardEvent.KEY_UP,keyPres sed); in this code:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
    <mx:Script>
    <![CDATA[
    private function init():void {
    i.setFocus();
    this.addEventListener(KeyboardEvent.KEY_UP,keyPres sed);
    }

    private function keyPressed(event:KeyboardEvent):void {
    if(event.keyCode.toString()=="84" && event.ctrlKey==true)
    ExternalInterface.call('newtab');
    }

    ]]>
    </mx:Script>
    <mx:TextInput x="23" y="268" width="256" id="i" text="Text Box"/>
    </mx:Application>

    <script type="text/javascript">
    function newtab(e){
    document.body.focus();
    window.open('about:blank');
    }
    </script>


    Or is it possible to setfocus on both flash file and html?

    I mean, F1, F2, F3 when clicked will set focus on flash and run Key.getCode() == 113 from flash
    but letters and arrow keys will function in textbox (html)..
    Last edited by ayusuits; 11-02-2009 at 04:43 AM.

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