闪光灯和摄像头可以测心率吗_无障碍闪光灯部件1和2

闪光灯和摄像头可以测心率吗

A step towards accessible Flash content: providing real-time Flash content for search engines, and bookmarking Flash Websites.

迈向可访问Flash内容的一步:为搜索引擎提供实时Flash内容,并为Flash网站添加书签。

Part 1 – SEO for Flash, starts below.

第1部分-Flash的SEO,从下面开始。

Part 2 – Bookmarking Flash, starts here.

第2部分–为Flash添加书签,从此处开始。

比赛状态 (The State of Play)

Today’s search engines have grown up in partnership with the traditional html document; not surprisingly, they are fantastic at indexing every last piece of information found within html files.

如今的搜索引擎已经与传统的html文档一起成长。 毫不奇怪,它们非常适合索引html文件中找到的每条最后一条信息。

Great! But, what happens when your new Website has no html content at all? This occurs most often with Websites built in Macromedia Flash, where the content is locked up in a file that search engines completely ignore.

大! 但是,当您的新网站完全没有html内容时会发生什么? 这种情况最常见于Macromedia Flash内置的网站,其中内容被锁定在搜索引擎完全忽略的文件中。

This question led me to think about what could be described as the holy grail of Flash Web development: achieving good search engine listings, based on current content, for Flash Websites that have no ‘surrounding’, relevant html content — in other words, what’s come to be known as the Flash site.

这个问题使我开始思考可以说是Flash Web开发的圣杯:基于当前内容,为没有“周围”相关html内容的Flash网站获得良好的搜索引擎列表-换句话说,被称为Flash网站。

In this case study I’ll show you how to accomplish this task in a way that’s simple, scalable and transparent to your general Website visitor — no annoying redirects, refreshes or ‘hidden’ text to consider. It has the added benefit of allowing sections, including frames and scenes, of a Flash Website to be bookmarked for reference at a later date.

在本案例研究中,我将向您展示如何以简单,可扩展且对一般网站访问者透明的方式完成此任务-无需考虑烦人的重定向,刷新或“隐藏”文本。 它的另一个好处是允许将Flash网站的各个部分(包括框架和场景)添加书签,以供日后参考。

I’ll also illustrate alternate methods for providing Flash content to search engines.

我还将说明为搜索引擎提供Flash内容的替代方法。

This process is built using disparate concepts that, on the face of it, have nothing to do with Flash. Joined together, though, they provide the key to success.

这个过程是使用不同的概念构建的,这些概念表面上与Flash无关。 但是,它们在一起提供了成功的关键。

Utilise this method, and you’ll have a Flash Website with content that is directly accessible via the URL or external hyperlinks. The knowledge that search engines can index Flash Websites effectively will allow you to promote Flash as a viable technology in which to develop and promote your clients’ Websites.

利用这种方法,您将拥有一个Flash网站,其内容可通过URL或外部超链接直接访问。 搜索引擎可以有效地索引Flash网站的知识将使您将Flash推广为一种可行的技术,可以在其中开发和推广客户的网站。

最初的想法 (First Thoughts)

The idea for developing a scalable and easy-to-maintain system to allow search engines to index Flash sites hit me when I was in the initial phase of building my own Website.

当我处于建立自己的网站的初始阶段时,开发可扩展且易于维护的系统以允许搜索引擎将Flash网站编入索引的想法使我大吃一惊。

In 2000, I evaluated the options and decided to build the Website using Flash, knowing the general consensus among the online world (some gurus in there as well) was that this approach meat I’d be tossing site accessibility out the window. Among the stated crimes of an all-Flash site included assumptions such as ignoring both the browser’s back and forward buttons*, and an inability to make the site available for search engine indexing (under the general umbrella of direct linking).

在2000年,我知道了在线世界(那里也有一些专家)的普遍共识,便是我评估了这些选项并决定使用Flash建立网站,我认为这种方法将使网站的可访问性丢到窗外。 全闪存站点的上述犯罪包括以下假设:忽略浏览器的后退和前进按钮*,以及无法将该站点用于搜索引擎索引(在直接链接的总括下)。

Being the questioning person that I am, I set as one of the objectives for my Website that it competently address the issue of search engine indexing. My site had to be fully indexed by search engines, enabling prospective clients to find me amid my contemporaries in the search result listings.

作为我的提问者,我将自己的网站设定为能够有效解决搜索引擎索引问题的目标之一。 搜索引擎必须对我的网站进行完全索引,以使潜在客户可以在搜索结果列表中的同时代人中找到我。

*Robert Penner, employing some lateral thinking, proves this assumption wrong using a frameset (a solution which may not be to everyone’s liking).

罗伯特·彭纳 ( Robert Penner )运用一些横向思维,使用框架集证明了这种假设是错误的(一种解决方案可能并不符合所有人的喜好)。

As I progressed, I realised that a number of concepts were involved in my achievement of this goal.

随着我的进步,我意识到实现这一目标涉及许多概念。

概念1:外部内容是关键 (Concept 1: External Content is The Key)

After reading many, many Flash resources, I saw that a key to accomplishing Flash site SEO was to separate the Website content from the Flash movie – to load it in from external sources. These sources could constitute anything from a database table or XML file, to a simple plain text file.

在阅读了许多Flash资源之后,我发现完成Flash网站SEO的关键是将网站内容与Flash电影分开-从外部源中加载它。 这些源可以构成从数据库表或XML文件到简单的纯文本文件的任何内容。

The benefit I saw in storing my text content outside the SWF file was that it could be used in a multitude of external devices. For instance, the text in a database table can be used in XHTML, Flash and, in looking to the future, an XML-ready device.

我将文本内容存储在SWF文件之外时看到的好处是,它可以在许多外部设备中使用。 例如,数据库表中的文本可以在XHTML,Flash中使用,并在将来使用XML就绪设备。

My choice for storing and retrieving content, which was made as a result of previous experience with the technology, was a MySQL database with PHP as the server side script. You could, however, conceivably use any database/script combination to accomplish this.

我对存储和检索内容的选择是基于该技术的先前经验,它是使用PHP作为服务器端脚本的MySQL数据库。 但是,您可以想象使用任何数据库/脚本组合来完成此操作。

Now, storing content is one thing, reliably retrieving and serving the content for it to be indexed by the search engines and viewed in a Flash movie by humans was another. Time for some search engine research…

现在,存储内容是一回事,可靠地检索和提供内容以供搜索引擎索引并由人类在Flash电影中查看是另一回事。 是时候进行一些搜索引擎研究了……

概念2:了解索引 (Concept 2: Understanding Indexing)

This is by no means an exhaustive look at how search engines get their content — that would take up more than a few dead trees! However, we still need to have a quick look at how Web content ends up in a search engine.

这绝不是穷举搜索引擎如何获取其内容的方法,因为它会占用很多死树! 但是,我们仍然需要快速浏览一下Web内容如何最终出现在搜索引擎中。

The well-known search engines get their content via bots that travel around the Web following links and sending the information they find back to their respective engines. Each bot is identified by a unique name, called a user agent string (string is code talk for a piece of text, and has nothing to do with a programmer’s shoe laces). In fact, nearly every visitor, bot, Web browser or otherwise to a Website provides their own user agent string.

著名的搜索引擎通过漫游器获取其内容,这些漫游器通过链接在Web上传播,并将找到的信息发送回各自的引擎。 每个机器人程序都由一个唯一的名称标识,称为用户代理字符串(字符串是一段文本的代码,与程序员的鞋带无关)。 实际上,几乎每个网站的访问者,漫游器,Web浏览器或其他方式都提供自己的用户代理字符串。

Let’s look at a few, to see what we’re dealing with:

让我们看一些,看看我们正在处理什么:

  • Googlebot/2.1 (+http://www.googlebot.com/bot.html)

    Googlebot / 2.1(+ http://www.googlebot.com/bot.html)
  • Mozilla/3.0 (Slurp/si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)

    Mozilla / 3.0(Slurp / si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)
  • FAST-WebCrawler/3.3 (crawler@fast.no; http://fast.no/support.php?c=faqs/crawler

    FAST-WebCrawler / 3.3(crawler@fast.no; http://fast.no/support.php?c=faqs/crawler
  • Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130

    Mozilla / 5.0(Windows; U; Windows NT 5.0; zh-CN; rv:1.2.1)Gecko / 20021130

The first three user agent strings above identify searchbots from Google, Inktomi and FAST. The last is a standard Mozilla 1.x identifier.

上面的前三个用户代理字符串标识来自Google,Inktomi和FAST的搜索机器人。 最后一个是标准的Mozilla 1.x标识符。

The very fact that reputable search engines give consistent user agent strings that differ from our human visitors allowed me to divide traffic to the Website into two main categories, and one minor category:

信誉良好的搜索引擎为用户代理字符串提供了与人类访客不同的事实,这使我可以将访问网站的流量分为两大类,一小类:

  1. Searchbots

    搜索机器人
  2. Humans using Web browsers

    人类使用网络浏览器
  3. Unknown (those visitors too difficult to identify by the supplied user agent)

    未知(那些访问者太难被提供的用户代理识别)

Searchbots, at their core, are stripped down versions of browsers. They ignore client side scripting such as JavaScript, and can ignore tricks like Meta tag refreshing and making text the same colour as the document background.

Searchbot的核心是精简版的浏览器。 他们忽略了JavaScript之类的客户端脚本,而忽略了诸如Meta标签刷新和使文本与文档背景颜色相同之类的技巧。

But what of server-side scripts? Searchbots, like their Web browser cousins, accept the page the server sends. Could I then get my Web server to send different pages based on the results of interrogation of the User Agent string? You bet!

但是服务器端脚本呢? 像他们的Web浏览器表亲一样,搜索机器人也接受服务器发送的页面。 然后,可以根据用户代理字符串的查询结果使Web服务器发送不同的页面吗? 你打赌!

概念3:从URL定位内容 (Concept 3: Targeting Content From The URL)

The starting point for targeting content in an HTML Website is the URL, and the same concept applies to Flash Websites. When a page is requested via the URL, the filename is sent to the server, along with any variables, which are appended to the end of the filename.

在HTML网站中定位内容的起点是URL,相同的概念也适用于Flash网站。 通过URL请求页面时,文件名以及附加在文件名末尾的任何变量将发送到服务器。

We’ve all seen something like this:

我们都看到过这样的事情:

google.com/search/?q=flash+and+search+engines

google.com/search/?q=flash+and+search+engines

In my case it was:

以我为例:

/index.php?go=4

/index.php?go=4

That part of the filename after the ? character is known as a query string* and will be available to the script index.php when it runs. In addition to this, any variables that are sent to a PHP script like this will be available in an array (think a cabinet where every draw holds a piece of information) called:

文件名的那部分? 字符称为查询字符串*,并且在脚本index.php运行时将可用。 除此之外,像这样发送到PHP脚本的任何变量都可以在一个数组中使用(请考虑一下每个绘图都包含一条信息的橱柜),该数组称为:

http://www.php.net/manual/en/reserved.variables.php#reserved.variables.get $_GET.

http://www.php.net/manual/en/reserved.variables.php#reserved.variables.get $ _GET。

In this case we’ll have $_GET[‘go’]. (In the Google case above, we’d have $_GET[‘q’])

在这种情况下,我们将有$ _GET ['go']。 (在上述Google案例中,我们有$ _GET ['q'])

*An alternative way to accomplish this involves rewriting the URL. For example, instead of this index.php?go=4 we might have /go/4/. This is seen to be friendlier to search engines, but has a steeper learning curve when compared to a simple query string. And yes, search engines like Google do index pages with query strings, as long as they are kept short (I’ve found through experience that I can get listings with two variables in the query string). I’ll leave the choice to you, but to keep it simple, I’ll stick with the query string for now.

*另一种实现方法包括重写URL 例如,我们可能不是/index.php?go=4,而是/ go / 4 /。 看起来这对搜索引擎更友好,但是与简单查询字符串相比,它的学习曲线更陡峭。 是的,Google之类的搜索引擎会使用查询字符串对索引页面进行索引,只要页面保持简短即可(根据经验,我可以在查询字符串中获取包含两个变量的列表)。 我将把选择权留给您,但为了简单起见,我现在将继续使用查询字符串。

My first task here was to validate the contents of $_GET[‘go’]. This is necessary because the URL can be changed by the Website visitor, and it’s a central part of good Web scripting to not trust anything that a script receives via the GET or POST methods.

我的第一个任务是验证$ _GET ['go']的内容。 这是必需的,因为网站访问者可以更改URL,并且它是良好的Web脚本的核心部分,它不信任脚本通过GETPOST方法接收的任何内容。

So, let’s start by interrogating the variable that’s fallen into our script. I’ve fully commented the PHP script that does this (lines with // or surrounded by /** **/), so if you’re codaphobic, read these!

因此,让我们开始审问脚本中的变量。 我已经对执行此操作PHP脚本进行了完整注释(以//开头或/ ** ** /包围),因此,如果您对仇视色情内容,请阅读这些内容!

Let’s also assume that the database connection was successful.

我们还假设数据库连接成功。

<?
/** - getparse.inc.php  
---------- what we want to achieve here -----------  
- check if the 'go' variable exists  
- strip out any content that may be hazardous to the script  
- convert 'go' to an integer for the sql query  
- nb : all content kept in the database is identified by a unique integer.  
- nb : error content is identified in the database by the id '-1'  
**/  
//first a function to parse the 'go' variable  
//functions are not run by the script until called  
function parsego($go_var)  
{  
        //check if the variable is an integer  
        if(!is_int($go_var))  
        {  
            //the variable is not an integer, set it to error content.  
            $go_var=-1;  
        }  
        //return the parsed variable.  
        return $go_var;  
}  
//go is passed from the URL header.  
//it is available in the super global array $_GET as element 'go'  
//$go is the variable used to identify the content to be retrieved.'  
//first check if the variable exists,  
//if not set it to retrieve default content (1).  
if(!$_GET['go'])  
{  
$go=1;  
$title_add = "welcome";  
}  
//$_GET['go'] exists  
else  
{  
  //check the 'go' variable for any 'hazardous' content  
  //it needs to be converted to an integer using intval()  
  $go = parsego(intval($_GET['go']));  
  //check to see if the content requested exists.  
  $checkGo_sql="SELECT id, header FROM sitecontent WHERE id=$go";  
  //run the query  
  //the @ symbol is used to suppress error messages from PHP  
  $checkGo_result=@mysql_query($checkGo_sql);  
  //check the number of rows returned.  
  $checkGo_rows=@mysql_num_rows($checkGo_result);  
  if(!$checkGo_result || $checkGo_rows==0 || !$checkGo_rows)  
  {  
    //if there is an error or if there are no matches,  
    //set to retrieve error content  
    $go=-1;  
    $title_add = "content not found";  
  }  
  else  
  {  
    $go = @mysql_result($checkGo_result, 0, 'id');  
    $title_add = @mysql_result($checkGo_result, 0, 'header');  
  }  
}  
/** ----- results ------------------  
- we have a valid value for $go that can now be  
used to retrieve content from the database.  
- it is targeting either the error content (-1) or existing content (>=1)  
**/  
?>
概念4:检查搜索机器人 (Concept 4: Checking for Search Bots)

I now have a valid variable for sourcing content from the database table, so it’s time to check who or what is visiting the Website. Again, everything is fully commented. For this example, I’ve introduced a tool that checks to see that the script is functioning as it should. In a live Website, you’d want to remove the if-else statement at the start of the code.

现在,我有一个有效的变量可用于从数据库表中获取内容,因此现在该检查谁或什么正在访问该网站。 同样,所有内容均已完全注释。 对于此示例,我介绍了一个工具来检查脚本是否正常运行。 在实时网站中,您希望在代码开头删除if-else语句。

<?
/** ------ botcheck.inc.php -------  
- determine if the user agent is a known search bot.  
**/  
//for spoofing the system so that it can be checked  
//and validated from the URL.  
//remove this when using live.  
if($_GET['useragent'])  
{  
$user_agent = $_GET['useragent'];  
}  
//if $_GET['ua'] is not available, treat it as a real request.  
else  
{  
$user_agent = $_SERVER['HTTP_USER_AGENT'];  
//$_SERVER['HTTP_USER_AGENT']; is where  
//PHP holds the user agent string.  
//for PHP versions older than 4.3, use $HTTP_USER_AGENT;  
}  
//a list of terms found in some searchbot strings in my log files  
//also some text only browsers thrown in. eg Lynx  
//and some that should never be allowed near a Flash movie (web tv)  
$searchbot_short_array = array("FAST-WebCrawler/", "Googlebot/",  
"Googlebot-Image/", "Ask Jeeves/Teoma", "Ask Jeeves",  
"Google WAP Proxy", "Slurp/", "Gigabot/", "Poodle predictor",  
"AlkalineBOT/", "Scooter-", "Scooter/", "ASPSeek/", "Sqworm/",  
"TurnitinBot/", "Lynx/", "Lycos_Spider", "appie", "walhello",  
"WebTV", "LinkWalker", "SurveyBot/", "suzaran", "polybot",  
"webcollage/", "Teleport Pro/", "search.ch", "LWP::Simple",  
"EasyDL", "Minerva", "RPT-HTTPClient", "IA_Archiver",  
"Spinne/", "Webster Pro", "MSProxy", "ZyBorg/",  
"Indy Library", "NPBot", "Girafabot",  
"Gulper Web Bot", "grub-client");  
//traverse the array and look at each element  
//if a bot is found, set a variable for later  
 foreach($searchbot_short_array as $search_for)  
 {  
 //attempt to match the array value against the user agent string.  
 //eregi is a case insensitive regular expression matching function  
 //in a live setting  
 //replace $user_agent with $_SERVER['HTTP_USER_AGENT'];  
      if(eregi($search_for, $user_agent))  
      {  
          $bot = true;  
      }  
 }  
?>

If, for instance, the Altavista searchbot, Scooter, hit the Website, the $bot variable would be assigned as ‘true‘.

例如,如果Altavista搜索$bot Scooter点击了网站,则$bot变量将被指定为' true '。

概念5:基于用户代理部署内容 (Concept 5: Deploying Content Based on the User Agent)

There are now two important pieces of information in the script environment:

脚本环境中现在有两个重要的信息:

  1. a valid identifier for content in the database table ($go), and

    数据库表( $go )中内容的有效标识符,以及

  2. whether the Website visitor is a bot ($bot == true) or not/unknown ($bot is not set in the script environment, i.e. ‘false‘).

    网站访问者是机器人( $bot == true )还是未知/未知(在脚本环境中未设置$bot ,即“ false ”)。

It’s now time to branch the script depending on the visitor type, and source the requested content.

现在是时候根据访问者的类型来分支脚本了,并提供请求的内容。

<?
/** --- filtering.inc.php  
- display text based content if a bot is found  
- ignore if not.  
**/  
//$bot is set in botcheck.inc.php  
if($bot)  
{  
//show searchbot friendly HTML content according to what    
was decided in getparse.inc.php  
   $getBotFriendly_sql = "SELECT header, content, id FROM sitecontent    
WHERE id=$go";  
   //run the query  
   $getBotFriendly_result=@mysql_query($getBotFriendly_sql);  
   //set some results  
   $content_header = @mysql_result($getBotFriendly_result,    
0, 'header');  
   $content = @mysql_result($getBotFriendly_result,    
0, 'content');  
   //get all the headers and id's for links that the search    
bot can follow.  
   $getAllHeaders_sql = "SELECT id, header FROM sitecontent";  
   $getAllHeaders_result=@mysql_query($getAllHeaders_sql);  
?>  
 <div id="vert">  
   <div id="header">  
   <b>From little things, big things grow :</b>  
   <br />  
   providing real-time Flash content for search engines &    
bookmarking Flash Websites  
   - <b><?echo $content_header?></b>  
   </div>  
   <div id="content">  
   <h4><?echo $content_header?></h4>  
   <?  
   //convert newlines (n or r or c) in the content to <br />  
   echo nl2br($content);  
   ?>  
   <h4>site navigation headers from the database table...</h4>  
   <?  
   //show the links to other current content available for archiving  
   //the search bot will follow these links.  
   while($header_row = @mysql_fetch_array($getAllHeaders_result))  
   {  
      if($header_row['id'] != -1)  
      {  
      echo "» <a href="$abspath?go=$header_row[id]"    
title="more on : $header_row[header]">";  
      echo "$header_row[header]</a>n<br />n";  
      }  
   }  
?>  
  </div>  
  <div id="footer">  
     
  </div>  
 </div>  
<?  
//include the html footer (</body></html>)  
include("htmlfoot.inc.php");  
// exit from the script so that the flash content is not    
displayed to the bot.  
exit;  
}  
?>
将它们链接在一起–将内容标识符传递到Flash (Linking it All Together – Passing the Content Identifier into Flash)

Finally, I need to set up a layout for the index.php file that will hold the above three inclusions, and pass the value of $go into the Flash movie. To accomplish this, we append the value to the end of the Flash filename.

最后,我需要为index.php文件设置一个布局,其中将包含上述三个包含内容 ,并将$ go的值传递到Flash电影中。 为此,我们将值附加到Flash文件名的末尾。

<?
/** ------- index.php ---------- **/  
/** ----------- start includes ----------**/  
//connect to mysql server and select the database  
include("database.inc.php");  
//parses the variables passed from the URL  
// and checks go against the database  
include("getparse.inc.php");  
//include the html head content <html><head><title> etc  
//also a <link .. /> to the stylesheet, meta tags  
//and usage of the $title_add variable  
include("htmlhead.inc.php");  
//check to see if the user agent is a bot.  
include("botcheck.inc.php");  
//provide plain text content if the user agent is a bot.  
include("filtering.inc.php");  
/** ---------  end includes -----------**/  
//deploy the flash content for the humans among us  
//note the go variable is being passed into the flash movie,  
//available as _root.go.  
//This is the key to successful bookmarking of Flash movies.  
?>  
 <div id="wrapper">  
 <!-- XHTML1.0 compliant code to deploy flash movie -->  
 <!-- if you are seeing a textarea-like box  
 you have a corrupt Flash Player ActiveX control.  
 Try uninstalling Flash Player then installing the    
latest and greatest -->  
 <object  
  data="<?echo $abspath?>index.swf?go=<?echo $go?>"  
  type="application/x-shockwave-flash" codebase="http://download.  
macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"  
  width="740"  
  height="420">  
  <param name="movie" value="<?echo $abspath?>index.swf  
?go=<?echo $go?>" />  
  <param name="menu" value="false" />  
  <param name="quality" value="high" />  
  <param name="bgcolor" value="#fefefe" />  
   <a href="http://www.macromedia.com/go/getflashplayer"  
   title="link to the Macromedia Flash Player download page">  
   Get the latest Flash Player from Macromedia  
   </a>  
 </object>  
 </div>  
<?  
//end the html  
include("htmlfoot.inc.php");  
?>
使PHP与Flash对话 (Making PHP talk to Flash)

That’s it for the PHP scripting: three simple inclusions, and one that contains script that will combine everything together.

PHP脚本就是这样:三个简单的包含,一个包含将所有内容组合在一起的脚本。

The code has successfully supplied a known searchbot with text content from the database table, and stopped it from indexing the Flash html code. The searchbot will now send back to its parent search engine the text and hyperlinks it finds, and the link to this content will soon appear in the search engine listings.

该代码已成功为已知的Searchbot提供了数据库表中的文本内容,并停止了它为Flash html代码建立索引。 现在,搜索引擎会将找到的文本和超链接发送回其父搜索引擎,并且指向该内容的链接将很快出现在搜索引擎列表中。

The second part of this process involves what happens when one of the hyperlinks that’s found in a search engine listing is activated by one of us, or when the URL is typed directly into the browser — i.e. when $bot is not set. In this case, the PHP interpreter skips entirely the supplying of text content in filtering.inc.php, and moves on to the code that displays the Flash movie.

该过程的第二部分涉及当我们中的一个人激活在搜索引擎列表中找到的超链接之一,或者直接在浏览器中键入URL时(即未设置$bot )发生的情况。 在这种情况下,PHP解释器将完全跳过filter.inc.php中文本内容的提供,然后转到显示Flash电影的代码。

The PHP script now needs to pass the valid request to Flash, accomplished by adding the $go variable to the Flash movie filename. What this does is very simple yet powerful — it will pass the value of $go into the movie, making it available to ActionScript as the variable _root.go.

现在,PHP脚本需要将有效请求传递给Flash,方法是将$go变量添加到Flash电影文件名中。 这样做非常简单但功能强大-它将$go的值传递到影片中,并将其作为变量_root.go可供ActionScript _root.go

This is the linkage between the URL and the Flash movie and, most importantly, makes the whole process possible.

这是URL和Flash电影之间的链接,最重要的是,使整个过程成为可能。

ActionScript启动 (The ActionScript Starts)

Once my Flash Website loads up, I can retrieve content from the database based on the value of _root.go, knowing that it has been validated by the previous PHP script. This will be the same content retrieved by a search engine using $go as the identifier.

一旦我的Flash网站加载_root.go ,我就可以基于_root.go的值从数据库中检索内容,知道该内容已被先前PHP脚本验证过。 这将是搜索引擎使用$go作为标识符检索到的相同内容。

There are many ways to retrieve dynamic content for Flash. One method uses LoadVars, a Flash Player 6-based object that can talk to a server side script like PHP. It won’t work with older versions of the Flash Player (lower than 6), so if your target Player is version 3 to 5 you should use the loadVariables function.

有很多方法可以检索Flash的动态内容。 一种方法是使用LoadVars,它是一个基于Flash Player 6的对象,可以与服务器端脚本(如PHP)进行对话。 它不适用于Flash Player的较早版本(低于6),因此,如果目标Player是3至5版本,则应使用loadVariables函数。

_root.go will be available to the Flash movie from frame 1, so it can instantly be added to a LoadVars object:

Here I transfer _root.go into a new LoadVars object called contentFetcher, then send the object content(s) to a PHP script called requestcontent.php. This PHP script retrieves content from the database table and prepares it for Flash in url-encoded format. Once the script is run successfully, the results are retrieved for display in the movie using an onLoad event handler.

Achieving the Target

My initial target of getting the search engines to index my Website was achieved! I soon found my Website in Google's cache. There was my listing, with all the content from my database indexed and no Flash visible at all. Paradoxically for a Flash developer, this is what I wanted!

The beauty of this system can be seen in

 _root.go will be available to the Flash movie from frame 1, so it can instantly be added to a LoadVars object:

Here I transfer _root.go into a new LoadVars object called contentFetcher , then send the object content(s) to a PHP script called requestcontent.php. This PHP script retrieves content from the database table and prepares it for Flash in url-encoded format . Once the script is run successfully, the results are retrieved for display in the movie using an onLoad event handler.

Achieving the Target

My initial target of getting the search engines to index my Website was achieved! I soon found my Website in Google's cache . There was my listing, with all the content from my database indexed and no Flash visible at all. Paradoxically for a Flash developer, this is what I wanted!

The beauty of this system can be seen in

  • Simplicity: three basic scripts do all the work

    简单性:三个基本脚本可以完成所有工作

  • Scalability: the virtue of having the content for search engines update automatically whenever the 'human readable' content is updated

    可伸缩性:每当“人类可读”内容更新时,使搜索引擎的内容自动更新的优点

  • Transparency: for both types of site visitors, bot and human, the other's content is rendered invisible with some simple scripting

    透明度:对于两种类型的网站访问者(机器人和人类),都可以通过一些简单的脚本使对方的内容不可见

  • Platform Independence: the scripts run on the server, so there are no problems with non-compliant browsers mangling the code

    平台独立性:脚本在服务器上运行,因此不兼容的浏览器处理代码不会有问题

As with most things in life, achieving something worthwhile tends to have positive run-on effects. In this case, my tinkering with passing variables to Flash from the URL partly solved an accessibility bug that acted as a barrier for many who considered building Flash Websites -- bookmarking.

与生活中的大多数事情一样,实现有价值的事情往往会产生积极的影响。 在这种情况下,我修改了从URL向Flash传递变量的方式,部分解决了可访问性错误,该错误对许多考虑构建Flash网站的人来说是一个障碍-书签。

For the second part of this case study I'll belt out some code on how bookmarking can be achieved. We'll look at some alternate methods you can use if you don't have a database, outline some advantages and disadvantages of the system, along with possible future directions, and discuss a quick warning regarding cloaking.

对于本案例研究的第二部分,我将介绍一些有关如何实现书签的代码。 如果没有数据库,我们将介绍一些可用的替代方法,概述系统的一些优点和缺点,以及未来可能的发展方向,并讨论有关伪装的快速警告。

And a note - you can download the code for both articles right here!

还有一个注释-您可以在此处下载这两篇文章的代码!

碰巧-书签 (Serendipity - Bookmarking)

Yes! Bookmarking a Flash Website for direct return is possible. With the SEO solution we discussed in the first part of this article, once each piece of content was loaded into the Flash movie it could be identified via a unique id. And, with a bit of Flash -- JavaScript interaction, I could provide a link to allow visitors to bookmark the content that was currently visible.

是! 可以为Flash网站添加书签以直接返回。 使用我们在本文的第一部分中讨论的SEO解决方案,每段内容一旦加载到Flash电影中,便可以通过唯一ID进行标识。 并且,通过一点Flash-JavaScript交互,我可以提供一个链接,以允许访问者为当前可见的内容添加书签。

Internet Explorer 4+ for Windows allows a bookmark URL to be written to it using a little IE specific Javascript. Browsers such as Mozilla, Opera, and basically anything that's not IE for Windows, do not allow this functionality, for some commonsense security reasons.

Windows的Internet Explorer 4+允许使用一些IE特定的Javascript将书签URL写入其中。 出于某些常识性的安全原因,Mozilla,Opera之类的浏览器以及基本上不是Windows的IE的浏览器均不允许使用此功能。

Flash can communicate with JavaScript if we add a function call into an HTML hyperlink and store this anchor in the content that's retrieved. Here's the ActionScript, and code for the hyperlink:

如果我们将函数调用添加到HTML超链接中并将此锚存储在检索到的内容中,则Flash可以与JavaScript通信。 这是ActionScript,以及超链接的代码:

bkurl = "http://www.webqs.com/?go=" + contentDisplay.id;
bktitle = "webqs.com : " + contentDisplay.header;    
<a href="javascript:setBookmark(bkurl, bktitle)">bookmark      
this content</a>

Simple! When clicked in Flash, this dials up a JavaScript function called "setBookmark" that can be placed in the <head> tags of the HTML page in question:

简单! 在Flash中单击时,这会调用一个名为“ setBookmark ”JavaScript函数,该函数可以放在相关HTML页面的<head>标记中:

<script type="text/javascript">
<!--    
   function setBookmark(url,pagetitle)    
   //function performs the bookmark action    
   {    
           //code for IE4+ on win32    
           if (navigator.appName == "Microsoft      
Internet Explorer" && navigator.appVersion >= "4.0" &&      
navigator.platform == "Win32")    
           {    
                         window.external.AddFavorite(url, pagetitle);    
           }    
           //this code posts a prompt if not    
           else    
           {    
                         window.prompt('Hit Ctrl-Shift-D      
(Command-D on a Mac, Ctrl-T in Opera) to bookmark this      
page.nCopy and paste this address and title for the      
bookmark :' , url + '  ' + pagetitle);    
           }    
// -->    
</script>

Note that, when compared to standard HTML pages, this method has the big disadvantage that the Website visitor can't simply hit their bookmark keystrokes to store the URL for the current content (unless it is the URL for the content requested). Why not? Because, whenever new content is requested inside a Flash movie, the URL stays the same throughout the process -- it doesn't change to reflect the updated content.

请注意,与标准HTML页面相比,此方法的主要缺点是网站访问者不能简单地按其书签击键来存储当前内容的URL(除非它是所请求内容的URL)。 为什么不? 因为,无论何时在Flash电影中请求新内容,URL在整个过程中都保持不变-不会更改以反映更新的内容。

替代方案-如果我没有数据库怎么办? (Alternative -- What if I Don't Have a Database?)

The method described above for having Flash content indexed by search engines is based on the assumption that we're using a database as the storage medium. So, what happens if your content is stored in a plain text file or embedded in the actual Flash movie?

上面描述的让Flash内容被搜索引擎索引的方法是基于以下假设:我们使用数据库作为存储介质。 那么,如果您的内容存储在纯文本文件中或嵌入到实际的Flash电影中,会发生什么情况?

Retrieving content from plain text files with PHP is a simple task that uses the language's built in filesystem functions. Simply put all the content in an array, using the file() function, then traverse the array and print out each element. To match the text files with what has been entered in the URL, we must use a naming system such as 1.txt, 2.txt etc. Instead of SELECTing data from the database table using the value of $go, you could target a '$go.txt' file for reading and printing to the screen.

使用PHP从纯文本文件中检索内容是一项简单的任务,它使用该语言的内置文件系统功能。 只需使用file() 函数将所有内容放入数组中,然后遍历数组并打印出每个元素。 要将文本文件与URL中输入的内容进行匹配,我们必须使用诸如1.txt,2.txt等命名系统。您可以使用$ go值来SELECT从数据库表中SELECT数据,而不是一个“ $ go.txt”文件,用于读取和打印到屏幕上。

If, for some reason, you have embedded text in the Flash movie, then make a copy of what has been embedded and place it in text files. It can then be retrieved using the method above. You will find that this has te done every time the Flash content is updated, so it may be wise to think about migrating to a text file, XML file or database to store the content.

如果出于某种原因在Flash电影中嵌入了文本,请复制已嵌入的文本并将其放置在文本文件中。 然后可以使用上述方法来检索它。 您会发现,每次更新Flash内容时都已完成此操作,因此考虑迁移到文本文件,XML文件或数据库以存储内容可能是明智的。

优点 (Advantages)

Just the fact that search engines can index the most up-to-date Flash content on a site, without having to manually update the search engine content, is a huge boost to the accessibility of Flash Websites.

搜索引擎可以索引站点上的最新Flash内容而无需手动更新搜索引擎内容,这一事实极大地促进了Flash网站的可访问性。

Furthermore, our clients, and we as developers, see the tangible benefits of a Flash Website achieving a good rank in the search engine listings, based on actual site content.

此外,我们的客户以及作为开发人员的我们都可以看到,基于实际的网站内容,Flash网站在搜索引擎列表中获得了良好的排名,从而带来了实实在在的好处。

Your clients may also be interested in understanding which areas of content are more popular. Most log file analysers will recognise filenames with query strings as independent files. And, as such, we can provide our client with the relevant numbers and further tailor site content based on those results.

您的客户可能还想了解哪些内容更受欢迎。 大多数日志文件分析器会将带有查询字符串的文件名识别为独立文件。 因此,我们可以为客户提供相关编号,并根据这些结果进一步调整网站内容。

Most importantly, prospective clients can be informed that, yes, a Flash Website can be indexed by search engines -- without seriously increasing the project's cost.

最重要的是,可以告知潜在客户,是的,可以通过搜索引擎为Flash网站建立索引-不会严重增加项目的成本。

缺点 (Disadvantages)

In diverting searchbots to plain text content, it's worth noting that this system relies on your keeping the stored list of bots up to date and accurate, which is possibly the solution's biggest weakness.

在将搜索机器人转移到纯文本内容时,值得注意的是,该系统依赖于您保持所存储的机器人列表的最新性和准确性,这可能是解决方案的最大弱点。

Of course, this issue's not a script-breaker, as any bot that slips through the filtering will simply find the HTML tags that hold the Flash movie. It's up to the developer, though, to keep this list up to date -- just as other Webmasters use a robot.txt file to exclude certain bots from visiting their Website.

当然,这个问题不是脚本破坏者,因为任何经过筛选的漫游器都只会找到保存Flash电影HTML标签。 不过,这取决于开发人员,以使此列表保持最新状态-就像其他网站站长使用robot.txt文件来排除某些漫游器访问其网站一样。

当心伪装 (Beware Cloaking)

Cloaking, as defined by search engines, occurs when a method such as this is used to supply a bot with content that does not match the actual content in the Website.

如搜索引擎所定义的伪装是在使用诸如此类的方法向bot提供与网站中实际内容不匹配的内容时发生的。

From the Google Webmaster's FAQ:

通过Google网站管理员的常见问题解答

"The term "cloaking" is used to describe a Website that returns altered Webpages to search engines crawling the site. In other words, the Webserver is programmed to return different content to Google than it returns to regular users, usually in an attempt to distort search engine rankings. This can mislead users about what they'll find when they click on a search result. To preserve the accuracy and quality of our search results, Google may permanently ban from our index any sites or site authors that engage in cloaking to distort their search rankings."

“掩盖”一词用于描述将更改后的网页返回给抓取该网站的搜索引擎的网站。换句话说,Web服务器被编程为向Google返回与常规用户不同的内容,通常是为了扭曲搜索引擎排名。这可能会使用户误以为他们点击搜索结果会发现什么。为了保持搜索结果的准确性和质量,Google可能会永久禁止任何涉及隐瞒搜索结果的网站或网站作者的索引扭曲了他们的搜索排名。”

Altavista has a statement, too, although it's less clear in its definition of cloaking.

Altavista也有一个声明 ,尽管在隐身的定义上还不清楚。

As can be seen, search engines frown upon cloaking and some actually ban Websites that use these techniques to gain a better search ranking. As such, I would strongly advise against supplying content that does not match what your human visitors see -- it's not worth getting banned from engines like Google that, apart from being one of the biggest search engines, also supplies search content to many other engines.

可以看出,搜索引擎掩饰不住,有些实际上禁止使用这些技术来获得更好搜索排名的网站。 因此,我强烈建议您不要提供与您的访客所看到的内容不符的内容-不值得被Google之类的引擎禁止,除了作为最大的搜索引擎之一之外,它还向许多其他引擎提供搜索内容。

And anyway, you want your visitors to be met by the content they were searching for, right?

而且无论如何,您都希望他们的搜索内容吸引访问者,对吗?

未来发展方向 (Future Directions)

An interesting feature of Flash Player 6, and one that will hopefully be made more stable, is the Named Anchor. Named Anchors allow different frames and scenes in a movie to be targeted from a URL, without reloading the entire movie. The benefit of this capability is that, as each named keyframe is targeted, the URL changes to reflect its unique id.

Flash Player 6的一项有趣功能是命名锚点,有望使其更加稳定。 命名锚点允许通过URL定位电影中的不同帧和场景,而无需重新加载整个电影。 此功能的好处是,当每个命名关键帧都被定位时,URL会更改以反映其唯一ID。

This will allow visitors to capture the URL that relates to the content they're currently viewing, by hitting the bookmark keystrokes. It will also permit users to navigate the site using a browser's back and forward buttons.

通过点击书签按键,访问者可以捕获与他们当前正在查看的内容相关的URL。 它还将允许用户使用浏览器的后退和前进按钮浏览站点。

Named Anchors are, at the present time, manually set on the timeline, which makes an ActionScript-based Flash site controlled from the URL pretty difficult to implement. This is something worth experimenting on, though, to better define its current capabilities and limits.

目前,已在时间轴上手动设置了命名锚,这使得从URL控制基于ActionScript的Flash网站变得非常困难。 不过,值得尝试以更好地定义其当前功能和限制的东西。

结论 (Conclusion)

The code and its implementation discussed here are a step towards more accessible Flash content. This information can be used as a basis on which to build Flash Websites that are fully indexed by search engines, enhancing both Website traffic, and the awareness of Flash as a viable development tool.

此处讨论的代码及其实现是朝着更易访问的Flash内容迈出的一步。 此信息可以用作构建Flash网站的基础,这些网站可以被搜索引擎完全索引,从而增强网站的访问量以及Flash作为一种可行的开发工具的知名度。

As examined in this case study, flow on effects include:

正如本案例研究中所检查的那样,影响流包括:

  • Bookmarking for direct return to content within the Flash Website

    加入书签以直接返回Flash网站中的内容

  • Scalability and stability to handle content as it is added to the Website, and

    在内容添加到网站时可伸缩性和稳定性 ,以及

  • Client confidence that a Flash Website can be indexed without major development and cost overheads.

    客户对 Flash网站可以建立索引而无需进行重大开发和增加成本开销的信心

You, the reader, are more than welcome to add and subtract from this process and implementation. Bringing about improvements on the original scheme, and making it more stable, can only assist developers and designers in the promotion of their Flash work.

读者,我们非常欢迎在此过程和实现中添加和减去。 对原始方案进行改进并使其更稳定,只能帮助开发人员和设计人员促进Flash工作。

Use it, build on it, make it better!

使用它,以它为基础,使其变得更好!

Further Resources

更多资源

Robert Penner's back/forward button implementation using a frameset:http://www.robertpenner.com/experiments/backbutton/backbutton.html

Robert Penner使用框架集的后退/前进按钮实现: http : //www.robertpenner.com/experiments/backbutton/backbutton.html

Jakob Nielsen's classic Flash diatribe from 2000. Unfortunately, this is what remains in the collective consciousness whenever Flash and accessibility are mentioned together. As the URL states 'use it' to provide another point of view:http://www.useit.com/alertbox/20001029.html

雅各布·尼尔森(Jakob Nielsen)于2000年提出的经典Flash辩护词。不幸的是,只要同时提及Flash和可访问性,这就是集体意识中保留的东西。 如URL所示,“使用它”提供了另一种观点: http : //www.useit.com/alertbox/20001029.html

Flazoom.com Flash usability white paper:http://www.flazoom.com/usability/usability_toc.shtml

Flazoom.com Flash可用性白皮书: http ://www.flazoom.com/usability/usability_toc.shtml

Flash -- 99% Good -- A first aid manual for Flash Websiteshttp://www.flash99good.com/index_flash.html

Flash-99%良好-Flash网站的急救手册http://www.flash99good.com/index_flash.html

翻译自: https://www.sitepoint.com/accessible-flash-parts-1-2/

闪光灯和摄像头可以测心率吗

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值