在Flash中嵌入网页 [英] Embedding webpage in Flash

查看:58
本文介绍了在Flash中嵌入网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Flash知之甚少,因此也不编程.我有一个PHP网站,显然还有HTML,CSS,JS等.

我想要做的是允许用户全屏显示DOM的某些片段.所以我的问题是,有没有办法动态地将Flash包裹在DOM的某些部分上,以允许对该部分进行完全屏蔽.

当前的响应非常有趣,并且可能是唯一的选择.

但是在我理想的世界中,将有一个嵌入式Flash对象,并且在其中将是某种iframe或等效的Flash,以便渲染仍由浏览器处理,而不是Flash本身.

解决方案

Flash仅限于它可以自行呈现的HTML(我认为是唯一支持的标记(粗体,斜体,下划线,a,ul,li和img).).AIR呈现完整的HTML,但这根本无法帮助您.

您可以尝试使用html解析器.我没有花很多时间在Flash中使用html,所以我不知道哪个解析器能做得最好.这看起来不错:

http://code.google.com/p/htmlsprite/

一旦您的html正确呈现在Flash中,剩下的就很简单了.假设全屏是您的全屏按钮.

  fullscreen.addEventListener(MouseEvent.CLICK,fullscreenClicked);函数fullscreenClicked(event:MouseEvent):void {开关(stage.displayState){情况StageDisplayState.NORMAL:stage.displayState = StageDisplayState.FULL_SCREEN;休息;情况StageDisplayState.FULL_SCREEN:默认:stage.displayState = StageDisplayState.NORMAL;休息;}trace('stage.displayState:'+(stage.displayState));} 

正如Krish所说,请不要忘记在 embed object 标签中都将allowFullScreen设置为true.另外,您只能在浏览器中进行测试,而不能在IDE中进行测试.

I know very little about Flash, and so is not programming in it. I have a website in PHP, and obviously, HTML, CSS, JS, etc.

What I want to do is to allow users to full-screen certain pieces of the DOM. So my question is, is there any way to wrap flash around certain portions of the DOM dynamically in order to allow full screening of that portion.

Edit:

The current responses are very interesting and could be the only options.

But in my ideal world there would be an embedded flash object, and inside that would be some sort of iframe or the flash equivalent so that the rendering is still handled by the browser and not flash itself.

解决方案

Flash is very limited to what HTML it can render by itself ( bold,italic,underline, a, ul, li and img I think are the only tags supported ) in the Flash Player. AIR renders full HTML, but that won't help you at all.

You could try and use an html parser. I didn't spent to much time with html in flash, so I don't know which parser does the best job. Here's one that looks ok-ish:

http://code.google.com/p/htmlsprite/

Once you have your html rendered in flash properly, the rest is easy peasy. Assuming fullscreen would be your fullscreen button.

fullscreen.addEventListener(MouseEvent.CLICK, fullscreenClicked);

function fullscreenClicked(event:MouseEvent):void{

switch(stage.displayState) {
                case StageDisplayState.NORMAL:
                    stage.displayState = StageDisplayState.FULL_SCREEN;
                    break;
                case StageDisplayState.FULL_SCREEN:
                default:
                    stage.displayState = StageDisplayState.NORMAL;
                    break;
            }
            trace('stage.displayState: ' + (stage.displayState));

}

As Krish stated, don't forget to set allowFullScreen to true in both embed and object tags. Also, you can only test in the browser, not in the IDE.

这篇关于在Flash中嵌入网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆