Embedding webpage in Flash

帅比萌擦擦* 提交于 2021-02-20 04:08:24

问题


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.


回答1:


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.




回答2:


The standard Flash player does not have the concept of iFrame. With AIR you can embed a browser (WebKit based) within a Flash application, but this is only for desktop applications.

The only real way to do exactly what you want would be to have Flash read out to the DOM via ExternalInterface, pull in the structure of the page, and recreate it in Flash. The complexity of this depends on the complexity of your page and how you choose to render the content you get from the DOM.




回答3:


use allowFullScreen="true" ine embed tag

<embed src="kitchen.swf" allowFullScreen="true" bgcolor="#333333" width="1024" height="576"
 name="fullscreen" align="middle" type="application/x-shockwave-flash"
 pluginspage="http://www.macromedia.com/go/getflashplayer" />



回答4:


If you're asking if it will fullscreen the HTML of the page, then no - I've never heard of anything like that before (not with Flash at least).

You could use some jQuery to accomplish something like this by increasing the scale of the content and the elements inside of a parent element, but it sounds like it would be difficult to say the least.



来源:https://stackoverflow.com/questions/1079950/embedding-webpage-in-flash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!