flex嵌入到html和html嵌入到flex
flex嵌入到html:
用swfobject,下载的.js地址:http://www.adobe.com/devnet/activecontent/articles/devletter.html
在你的 HTML 页面头部<head>区嵌入这个脚本文件:<script type="text/javascript" src="swfobject.js"></script>
在你的 HTML 中写一个用来放 Flash 的容器,比如<div>,并随便给一个 id 比如 flashcontent。然后在里面放上你的替换内容。
<div id="flashcontent">
这里放替换内容,用来在 Flash 无法显示时显示。
</div>
使用脚本替换这个内容:
<mce:script type="text/javascript"><!--
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
//参数意思: 地址,Flash 的 id(不是容器的 id),宽,高,版本需求,背景颜色
//这是最基本的,如果你要高级的设置,就仔细翻翻说明吧。
so.write("flashcontent");
// --></mce:script>
这脚本可以写在 HTML 中也可以写在外部 .js 文件中。
html嵌入到flex
找到一个flex的iframe自定义类,比较好用,请访问http://code.google.com/p/flex-iframe/
首先从上面的网址下载iframe包
解压,找到IFrameDemo\src\IFrame.as
复制到你自己的src里
在需要用的mxml中加入xmlns:local="*"(local)
Xml代码
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()" xmlns:local="*">
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()" xmlns:local="*">
需要用的的地方
Xml代码
<local:IFrame id="iFrame" source="http://www.favzone.com" width="100%" height="100%" />
<local:IFrame id="iFrame" source="http://www.favzone.com" width="100%" height="100%" />
source就是需要引用的网页url了
相关文档:
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
......
其实就是创建普通文件, CreateFile() 和WriteFile. 然后用ShellExcuteEx()来打开就行了(会自动调用IE).
HANDLE handle;
handle=CreateFile(L"\\windows\\google.html",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(INVALID_HANDLE_VALUE!= handle )
{
DWORD Num;
::WriteF ......
一种:
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>兼容FireFox的当前时间的JS脚本</title>
</head>
<body>
<DIV id=time>当前时间
<SCRIPT>document.getElementById('time').innerHTML=new Date().toLo ......
第一种:
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
alert("返回");
window.history.back ......