当前位置: 首页 > 图文教程 > 网络编程 > ASP > 用ASP控制Flash

ASP
ASP漏洞及安全建议(3)
ASP漏洞及安全建议(4)
实现聊天室的悄悄话功能(上)
实现聊天室的悄悄话功能(中)
用ASP实现悄悄话的功能
《 优化你的ASP程序 》
让ASP应用系统成为跨平台的应用系统
让ASP应用系统成为跨平台的应用系统(2)
使用ASP加密算法加密你的数据(一)
使用ASP加密算法加密你的数据(二)
用ASP制作个性化的调查板
asp+语法介绍(二)---书写我们的第一个asp+ 文件
asp+语法介绍(一)
asp+语法介绍(三)----asp+的服务器端编程初步
asp+语法介绍(四)----asp+的服务器端编程进介
asp+语法介绍(五)----asp+的服务器端编程控件篇
sp+语法介绍(六)----数据库篇
用ASP和VBScript上载文件(一)
用ASP和VBScript上载文件(二)
解析正则表达式(原创)

用ASP控制Flash


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 114 ::
收藏到网摘: n/a

  Controlling Flash with ASP

A recent project has required a few things that I haven't done for a while. One is dealing with Flash -
which I haven't done since shortly after the release of Flash 3.0. The other is to actually figure some
way of getting dynamic content in without using Generator. One solution we've come up with involves
jumping out of a flash movie into an ASP page, then back again. Of course our designers were a little
miffed, since they've built the flash movie with all sorts of different transitions from place to place,
and this solution would mean starting from the opening scene of the movie evry time. It also stank from a
usability standpoint.

Not so, said I

To accomplish the effect of jumping back in at a specific frame, we simply load some variables into the
flash movie and use them to jump to the right frame. Cool huh?

Initially we had a little trouble, since designers don't need to know anything about ASP, so conveying
information back and forth was a little tricky, but we got there. How it works is like this

In the flash Movie, the first frame has a piece of actionscript which simply reads

GoToAndPlay(scene);
Stop();
The syntax is slightly different in Flash 4.0 - this is Flash 5.0, but you get my drift

Now, when jumping back from the ASP page to the Flash page, we tag a querystring parameter onto the links

flash.asp?scene=awards
flash.asp?scene=services
flash.asp?scene=contact
And so on. The script flash.asp looks something like this...

<%@Language="JScript"%><%
Response.Buffer = true; Response.Expires = -1441;
var s = new String(Request.Querystring("scene"));
strScene = (s!='undefined'&&s!='')?s:'default';
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Flash Control</title>
</head>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"
width="750" height="395">
<param name="movie" value="movie.swf?scene=<%= strScene %>">
<param name="quality" value="high">
<embed src="/upload/tech/20091103/20091103100749_335f5352088d7d9bf74191e006d8e24c.swf"?scene=<%= strScene %>" quality="high"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?
P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="750" height="395">
</embed>
</object>
</body>
</html>
So, if we have nothing in the querystring, it loads the scene 'default' - else it loads whatever ASP tells
it to. cool huh?

This trick will work from Flash 4.0 upwards - flash 5.0 is particularly nifty, and i could get to like
it...