#1
  1. PHP Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    England
    Posts
    163
    Rep Power
    13

    Javascript to flash


    I need javascript to be able to tell flash to do something, for example i have a function called test and all it does it dump some text on the screen in flash.

    I want javascript to be able to call this function from within a browser without having to submit a form. something like what i have tried.

    Code:
    <HTML>
    <HEAD>
    <meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
    <TITLE>test</TITLE>
    </HEAD>
    <BODY bgcolor="#FFFFFF">
    <!-- URL's used in the movie-->
    <!-- text used in the movie-->
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
     codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
     WIDTH="550" HEIGHT="400" ALIGN="">
     <PARAM NAME="movie" VALUE="test.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="test.swf" quality=high bgcolor=#FFFFFF  WIDTH="550" HEIGHT="400" NAME="test" ALIGN=""
     TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveconnect="true" ></EMBED>
    </OBJECT>
    </BODY>
    </HTML>
    <button onclick = "window.document.movie.test();">go</button>
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    4
    Rep Power
    0
  4. #3
  5. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    151
    Rep Power
    0
    now i cant be certain, but im not sure if you can have javascript call a function in flash. i do know that you can have javascript tell flash what frame in the main timeline to go to.

    so if you can, put a function call to your actionscript function in some frame of the main timeline, and have ur javascript tell it to go to that frame.

    so lets say that you arrive at your form on frame 5. your movie is stopped via stop(). the function call is on frame 6. so the button tells the flash movie to go to frame 6, and voila ur function gets called.

IMN logo majestic logo threadwatch logo seochat tools logo