A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: ExternalInterface AS3

  1. #1
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146

    ExternalInterface AS3

    hi, am looking for flash to javascript function calling external interface using AS3

    how can we call it? as i tried different ways but not working...

    check link - here


    Flash code i.e.

    Actionscript Code:
    import flash.external.ExternalInterface;
    import flash.system.Security;


    show_btn.addEventListener(MouseEvent.CLICK, popup);

    function popup(event:MouseEvent):void {
            //trace(ExternalInterface.available);
            Security.allowDomain("*");
            //ExternalInterface.call("showlayer()");
            //ExternalInterface.call("alert", "hello world");
            ExternalInterface.call("setVisibility","sub3", "inline");
    //getURL("javascript:showlayer('myName')");

    }



    hide_btn.addEventListener(MouseEvent.CLICK, myBtnClicked);
    function myBtnClicked(event:MouseEvent):void {
    //navigateToURL(new URLRequest("javascript:showlayer()"));
    ExternalInterface.call("loadnext", 1, 2);
    //navigateToURL(new URLRequest("javascript:showlayer('myName')"));
    }


    Html code i.e.
    Actionscript Code:
    <html>
    <head>
    <title></title>
    <style type="text/css">
    div {
    position: absolute;
    left: 100px;
    top: 200px;
    background-color: #f1f1f1;
    width: 180px;
    padding: 10px;
    color: black;
    border: #0000cc 2px dashed;
    display: none;
    }
    </style>

    <script language="JavaScript">
    function setVisibility(id, visibility) {
    document.getElementById(id).style.display = visibility;
    }

    function myfadeout(){
    // alert("myfadeout is called");
    $('#box1').delay(3000).fadeOut(500);

    }

    </script>


    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <script language="javascript" src="show_layer.js"></script>
    </head>
    <body >

    <input type=button name=type value='Show Layer' onClick="setVisibility('sub3', 'inline');";>
    <input type=button name=type value='Hide Layer' onClick="setVisibility('sub3', 'none');";>

    <div id="sub3">Message Box</div>

    <p>
      <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','250','height','100','src','lay','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','allowscriptaccess','always','movie','lay' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="250" height="100">
       
        <param name="movie" value="lay.swf">
        <param name="quality" value="high">
        <param name="allowscriptaccess" value="always";>
       
        <embed src="lay.swf" width="250" height="100" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" allowscriptaccess="always"></embed>
      </object>
    </noscript>
    </p>

    <div id="myName">Antonio</div>
    <a href="#" onClick="javascript:showlayer('myName')">Show/Hide Layer</a>
    </body>
    </html>
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Other than the useless Security.allowDomain call that looks okay. Be sure you are testing on an actual webserver and not just from the file system.

Tags for this Thread

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