A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Js and Flash

  1. #1
    Member
    Join Date
    Jan 2006
    Location
    Florida
    Posts
    51

    Js and Flash

    I have been having a problem passing information from a JS function back to the Flash

    Here is my code

    JS
    Code:
    <script language="javascript" type="text/javascript">
    function test(){
    if (navigator.appName.indexOf("Microsoft") != -1) {
    
    window["FlashVars"].readRewardsText();
    }else{ 
    
    document["FlashVars"].readRewardsText();
    }
    }
    </script>

    /// BTN that calls the JS
    <a href="#" onclick="test()"> Test</a>


    /////Loadin the Flash


    Code:
    <script language="javascript">
    /***********************************************
    * Author: Moises Zaragoza
    * Create date: 11/07/07
    * Description: removes flash border
    ***********************************************/
    if (AC_FL_RunContent == 0) {
    //alert("This page requires AC_RunActiveContent.js.");
    } else {
    AC_FL_RunContent(
    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', '993', 
    'height', '520',
    'src', 'FlashVars',
    'quality', 'high',
    'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'opaque',
    'devicefont', 'false',
    'id', 'FlashVars',
    'bgcolor', '#000000',
    'name', 'FlashVars',
    'menu', 'true',
    'allowFullScreen', 'true',
    'allowScriptAccess','sameDomain',
    'movie', 'test.swf',
    'salign', ''
    ); //end AC code
    }
    </script>
    /// Inside flash at the root level

    Code:
    
    function readRewardsText() {
    _root.clip1.start(0,1);
    tester.text = "readRewardsText was called";
    }
    this.createEmptyMovieClip("redeemnow",this.getNextHighestDepth());
    var clip1:Sound = new Sound(s1);
    clip1.attachSound("redeemnow");





    thanks for all the help
    Moises Zaragoza

  2. #2
    Member
    Join Date
    Jan 2006
    Location
    Florida
    Posts
    51
    Moises Zaragoza

  3. #3
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    have you looked into using ExternalInterface() to communicate with function in the wrapper (ie: html page)

    it can be used both ways actually flash movie to external function..or wrapper to flash function..

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