嘿,我在那里遇到了深深的麻烦,因为我不知道有点FLEX。下面粘贴的代码来自Cirrus Sample Application(RTMFP)。
我有PHP变量$ user-> data [' username'];我需要设置为用户名。有人可以帮助我将此变量传递到FLEX代码并与之连接,而不是手动输入所选用户名,然后单击连接。
我想我得到了第一部分:
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<head>
<?php
@ $Name = $user->data['username'];
?>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var swfVersionStr = "";
var xiSwfUrlStr = "";
var flashvars = {};
flashvars.Name = "<?php echo $Name; ?>"
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
var attributes = {};
attributes.id = "FlashVarTest";
attributes.name = "FlashVarTest";
attributes.align = "middle";
swfobject.embedSWF(
"FlashVarTest.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body >
<div id="flashContent">
</body>
</html>
我对如何将其传递到Name字段并让它自动连接毫无头绪,因为我不了解FLEX。对于stackoverflow来说,源代码太长了:http://pastebin.com/b0sFySYs
<!-- Login pane -->
<s:HGroup includeIn="LoginNotConnected" verticalAlign="middle">
<s:Label text="User Name: " color="0xffffff"/>
<s:TextInput id="userNameInput" width="80" enter="onConnect()"/>
<s:Button label="CONNECT" click="onConnect()" enabled="{userNameInput.text.length > 0}" styleName="buttonStyle"/>
</s:HGroup>
<s:HGroup includeIn="LoginConnecting" verticalAlign="middle">
<s:Label text="Connecting to {connectUrl}" color="0xffffff"/>
<s:Button label="CANCEL" click="onDisconnect()" styleName="buttonStyle"/>
</s:HGroup>
<s:HGroup includeIn="LoginConnected, CallReady, CallCalling, CallRinging, CallEstablished, CallFailed" verticalAlign="middle">
<s:Label text="Connected as {userNameInput.text}" color="0xffffff"/>
<s:Button label="DISCONNECT" click="onDisconnect()" styleName="buttonStyle"/>
</s:HGroup>
<s:HGroup includeIn="LoginDisconnecting">
<s:Label text="Disconnecting from {connectUrl}" color="0xffffff"/>
</s:HGroup>
答案 0 :(得分:0)
您需要做的是在生成Flex应用程序的嵌入代码时,将PHP中的用户/昵称发送到flex。这可以通过flashVars来完成。
然后在init()
函数中,您需要检查是否已提供该变量。如果是,请将username.input.text
设置为该提供的值,然后直接从init函数调用onConnect()
。
你将必须学习一点flex(Actionscript)。 Stackoverflow不是'请为我这个网站代码'...