2009-11-11 146 views

回答

0

的JavaScript Flex应用程序驻留在HTML页面内..

<script language="JavaScript" type="text/javascript"> 
function images(url) 
{ 
var width = 700; 
var height = 500; 
var left = (screen.width - width)/2; 
var top = (screen.height - height)/2; 
var params = 'width='+width+', height='+height; 
params += ', top='+top+', left='+left; 
params += ', directories=no'; 
params += ', location=no'; 
params += ', menubar=no'; 
params += ', resizable=no'; 
params += ', scrollbars=no'; 
params += ', status=no'; 
params += ', toolbar=no'; 
newwin=window.open(url,'Screenshots', params); 
if (window.focus) {newwin.focus()} 
return false; 
} 
</script> 

,并单击该按钮时调用的Flex功能...

private function imagesButtonClick():void { 
    var url:String = data.images; 
    ExternalInterface.call("images", url); 
} 
1

您可以使用HTTPService调用一个php或html文件。

import mx.rpc.http.HTTPService 


<mx:HTTPService method="post" url="{php path}" resultFormat="e4x" ShowBusyCursor="true" /> 

PHP或HTML

<?php 

echo "<script>window.open('url path','mywindow','width=400,height=200,scrollbars=no, toolbar=no,menubar=no')</script>"; 


?> 

请检查小错误。

希望这有助于

+0

喜Treby,我不太确定POST方法对PHP文件是如何工作的......在浏览器中调用的php代码有效,但不在Flex代码中。我已经做了进一步的研究,并相信我应该能够使用ExternalInterface函数将JavaScript放入Flex中,但不能确定。 – medoix

+0

您可以忽略method =“post”,只需将url路径设为php或html即可。而在html方面,你只需把代码放在 – Treby