Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calling a javascript function in Value attribute of param

New Here ,
Jun 09, 2012 Jun 09, 2012

Hi,

I want to set a TLF text field in SWF file through HTML page. So I used flashvar, by calling a javascript function for it attribute "value" as follows.

<param name=FlashVars value="'+ SetFlashMovieParam() +'" id="message" />

SetFlashMovieParam()  is a javascript function as follows.

function SetFlashMovieParam() {                       

     document.getElementById("message").setAttribute("value", "msgText=Start");

}

Even though this doesn't work, when I set the text value directly to "value" attribute, it worked.

<param name=FlashVars value="msgText=Here%20is%20the%20text" id="message" />

I think this is because a syntax error in javascript function calling in param tag. Can anyone help to call that function correctly...

Thanks.

TOPICS
ActionScript
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 10, 2012 Jun 10, 2012

Normally when you have any executable code nested in html code you have to identify that section accordingly.  In the case of javascript you surround it with <script> tags.

Translate
LEGEND ,
Jun 10, 2012 Jun 10, 2012

Normally when you have any executable code nested in html code you have to identify that section accordingly.  In the case of javascript you surround it with <script> tags.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 10, 2012 Jun 10, 2012

Yes, javascript function is surrounded by <script> tag. Here is the full HTML code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

          <head>

                    <title>Face</title>

                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

   <script language="javascript">

 

                                   // Set parameters to send to SWF file

                                   function SetFlashMovieParam() {

                                                  document.getElementById("message").setAttribute("value", "msgText=Start");

                                   }

 

                    </script>

          </head>

          <body bgcolor="#CC99CC">

                    <div id="flashContent">

            <object type="application/x-shockwave-flash" data="Face.swf" width="550" height="400" id="flash">

                <param name="movie" value="Face.swf" />

                <param name="quality" value="high" />

                <param name="bgcolor" value="#ffffff" />

                <param name="play" value="true" />

                <param name="loop" value="true" />

                <param name="wmode" value="window" />

                <param name="scale" value="showall" />

                <param name="menu" value="true" />

                <param name="devicefont" value="false" />

                <param name="salign" value="" />

                <param name="allowScriptAccess" value="sameDomain" />

                <!-- Set parameters to send to SWF file -->

                <param name=FlashVars value="'+ SetFlashMovieParam() +'" id="message" />

                <a href="http://www.adobe.com/go/getflash">

                    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />

                </a>

            </object>

                    </div>

          </body>

</html>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2012 Jun 10, 2012
LATEST

The function might be, but the call to it is not.... SetFlashMovieParam()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines