Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex/Flash 4 ExternalInterface.call - trying to get a string from HTML to Actionscript
    primarykey
    data
    text
    <p>I need to obtain a string from HTML and put it into Actionscript.</p> <p>the actionscript:</p> <pre><code>import flash.external.ExternalInterface; protected function getUserName():void{ var isAvailable:Boolean = ExternalInterface.available; var findUserName:String = "findUserName"; if(isAvailable){ var foundUserName:String = ExternalInterface.call(findUserName).toString(); Alert.show(foundUserName);}} </code></pre> <p>the javascript:</p> <pre><code>function findUserName() { var label = document.getElementById("username-label"); if(label.value != ""){ alert("the name in the box is: " + label.value); return label.value;} else return "nothing in the textbox";}} </code></pre> <p>the JSP:</p> <pre><code>&lt;%IUserSession userSession = SessionManager.getSession();%&gt; &lt;logic:notEmpty name="userSession"&gt; &lt;logic:notEqual value="anonymous" name="userSession" property="userLoginId"&gt; &lt;td align="right" width="10%" &gt; &lt;input id="username-label" type="text" value="&lt;bean:write name="userSession" property="userLoginId"/&gt;" /&gt; &lt;/td&gt; &lt;/logic:notEqual&gt; &lt;/logic:notEmpty&gt; </code></pre> <p>the rendered HTML:</p> <pre><code>&lt;td align="right" width="10%"&gt; &lt;input id="username-label" type="text" value="a-valid-username" /&gt; &lt;/td&gt; </code></pre> <p>when the javascript execution hits</p> <pre><code>var label = document.getElementById("username-label"); </code></pre> <p>a null is returned and crashes, no alert shows no error message is shown. I can successfully do a search firefox DOM Inspector by "username-label" (document.getElementById())</p> <p>The only alert box that pops up is the action script alert box and the contents are blank.</p> <p>firfox 3.5 windows, container is Tomcat.</p> <p>Please advise, and thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload