Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pass data from Google App Engine(Python) to Flex 4 application
    primarykey
    data
    text
    <p>I am using python and webapp framework in app engine for backend and flex 4 for front end. I would like to pass a string form backend to front end, so i write the following code in the main.py:</p> <pre><code>class MainPage(webapp.RequestHandler): def get(self): userVO = "test" template_values = { 'url': self.request.uri, 'userVO': userVO, } self.response.out.write(template.render("templates/index.html", template_values)) </code></pre> <p>And in the flex 4, I have the following code:</p> <pre><code>var user:String = FlexGlobals.topLevelApplication.parameters['userVO']; </code></pre> <p>However, I receive null value.</p> <p>Please advice how to correct it. Thanks.</p> <p><strong>Edit: 25 Feb.</strong></p> <p>Thanks for the people who answer my question. For my question, I am try to figure out how the python app engine pass data to flex app when it render the html file that include the swf file. Maybe, there is something I can set in the main.py, swfobject.js or the index.html to do my task.</p> <p>I know how to use Pyamf as a gateway to serve the flex app, I am thinking how to make the app more simple.</p> <p>Thanks.</p> <p><strong>Edit: 28 Feb.</strong></p> <p>Robert, the index.html is the standard file created by flash builder 4. Wish you can give me some hints how to modify it. The following is the file:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;!-- saved from url=(0014)about:internet --&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt; &lt;!-- Smart developers always View Source. This application was built using Adobe Flex, an open source framework for building rich Internet applications that get delivered via the Flash Player or to desktops via Adobe AIR. Learn more about Flex at http://flex.org // --&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; </code></pre> <p> html, body { height:100%; } body { margin:0; padding:0; overflow:hidden; text-align:center; }<br> #flashContent { display:none; } </p> <p> </p> <pre><code> &lt;script type="text/javascript" src="/js/swfobject.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; &lt;!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. --&gt; var swfVersionStr = "10.0.0"; &lt;!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. --&gt; var xiSwfUrlStr = "/swfs/playerProductInstall.swf"; var flashvars = {}; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; var attributes = {}; attributes.id = "index"; attributes.name = "index"; attributes.align = "middle"; swfobject.embedSWF( "/swfs/index.swf", "flashContent", "100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); </code></pre> <p> swfobject.createCSS("#flashContent", "display:block;text-align:left;"); <p> To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed. </p> <a href="http://www.adobe.com/go/getflashplayer" rel="nofollow noreferrer"> <img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /> </a> </p> <pre><code> &lt;noscript&gt; &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="index"&gt; &lt;param name="movie" value="index.swf" /&gt; &lt;param name="quality" value="high" /&gt; &lt;param name="bgcolor" value="#ffffff" /&gt; &lt;param name="allowScriptAccess" value="sameDomain" /&gt; &lt;!--[if !IE]&gt; &lt;object type="application/x-shockwave-flash" data="index.swf" width="100%" height="100%"&gt; &lt;param name="quality" value="high" /&gt; &lt;param name="bgcolor" value="#ffffff" /&gt; &lt;param name="allowScriptAccess" value="sameDomain" /&gt; &lt;![endif]--&gt; &lt;!--[if gte IE 6]&gt; &lt;p&gt; Either scripts and active content are not permitted to run or Adobe Flash Player version 10.0.0 or greater is not installed. &lt;/p&gt; &lt;![endif]--&gt; &lt;a href="http://www.adobe.com/go/getflashplayer"&gt; &lt;img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /&gt; &lt;/a&gt; &lt;!--[if !IE]&gt; &lt;/object&gt; &lt;![endif]--&gt; &lt;/object&gt; &lt;/noscript&gt; </code></pre> <p> </p> <p>Thanks, Robert.</p> <p><strong>Edit: 7 Mar.</strong></p> <p>Robert,</p> <p>Refer to <a href="http://help.adobe.com/en_US/Flex/4.0/html/WS2db454920e96a9e51e63e3d11c0bf626ae-7feb.html" rel="nofollow noreferrer">http://help.adobe.com/en_US/Flex/4.0/html/WS2db454920e96a9e51e63e3d11c0bf626ae-7feb.html</a></p> <p>Before I post the question here, I tried the following code:</p> <p>In the index.html,</p> <pre><code>&lt;% String user = (String) request.getParameter("userVO"); %&gt; </code></pre> <p>and also</p> <pre><code>flashvars.userVO = "&lt;%= user %&gt;"; </code></pre> <p>The result, I get:</p> <p>&lt; user</p> <p>Do you know why I can't get the correct data. Thanks.</p>
    singulars
    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.
    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