用ASP控制Flash

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="http://edu.cnzz.cn/NewsInfo/movie.swf?scene=<%= strScene %>">
<param name="quality" value="high">
<embed src="http://edu.cnzz.cn/NewsInfo/movie.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...

时间: 2024-10-08 11:51:56

用ASP控制Flash的相关文章

Asp与Flash结合开发应用基础教程

1.Flash与Asp之间的交互2.Asp与数据库之间的交互3.ASP+FLASH开发源码例子――登陆的实现 Flash 的功能已经非常强大,完全可以跟其他的服务器端语言结合起来,做出适合现在的网络应用的网站.一个典型的模式就是Flash 与Asp的结合使用.其架构如图1所示. 图01 可以把上面的结构看成是三层,Flash是一层,Asp是一层,数据库是一层.对Flash和Asp有点了解的人,只要处理好层与层之间的交互,结合使用Flash与Asp就决不是什么难事. 一.下面我们就先来看看Flas

怎么用地图控制flash移动

控制 演示效果:(用鼠标在小地图中任意拖拽可以看到效果) 问:怎么用地图控制flash移动,像QQ宠物村一样,在右上角有幅地图,可以控制左边的flash的移动? 答:运用座标转换来实现.按下鼠标,在小地图上移动,看大地图上的变化. onMouseDown = function () { B = true; }; onMouseUp = function () { B = false; }; onMouseMove = function () { if (x_mc.hitTest(_xmouse,

通过JS控制flash场景随内容而增减的方法

js|控制 本教程摘操自<Flash MX 2004 ActionScript 2.0 与RIA应用程序开发>//---------------------------------------------------在过去,Flash是无法做到随内容的增减而缩放场景的,按在Flash 6以后,利用Stage的属性控制Flash影片的固定比例(Stage.scaleMode = "noScale";)和靠左上角(Stage.align="TL";),整个影

通过ASP在Flash中妙用Cookie

cookie Written by: Günter HoffellnerTranslated by: Bernhard SpuidaFirst published: 9/8/2000 Setting or reading cookies in Flash may be necessary for example to extend the personalization of a web site to the Flash file. Flash does not support direct

Asp.Net + Flash 上传的组件,文件上传后返回值问题,急!

问题描述 我从网上下载了一个Asp.Net+Flash上传的组件,自己改了下,现在已实现以下功能: 1.上传多个文件: 2.定义上传各种类型的文件: 3.定义上传路径: 4.支持上传大文件. 主页面:Default.aspx(页面链接包含了:Default.aspx.cs.upload.swf.UploadVideo.ashx) 上传文件页面:UploadVideo.ashx 现在有个很大的问题:就是UploadVideo.ashx页面上传文件后,要如何将文件名称(处理结果)返回到Default

ios-请问原生IOS程序怎么控制FLASH程序(在IP不确定的情况下)

问题描述 请问原生IOS程序怎么控制FLASH程序(在IP不确定的情况下) 小弟在做一个项目 原生的IOS程序利用局域网控制电脑的FLASH桌面程序 本来是用SOCKET解决,不过这样需要事先绑定IP和端口,但是要求是让IOS程序自动搜索FLASH服务端 所以就想用UDP广播来解决,IOS能收发UDP广播,不过我不知道FLASH程序怎么接收这种广播 网上找了好多资料,基本上UDP都是要事先绑定IP才能通讯 不知道有没有人知道该如何解决~~~ 或者有什么其他方法在不知道IP的情况下,在同一个局域网

Ajax+ASP和Flash+ASP数据读取取方法有些相似的实现方法_应用技巧

Ajax+ASP和Flash+ASP数据存取方法两种数据存取方法差不多.===============================下面是一个ChatRoom的Ajax部分代码:var ajaxHttpRequest = false;function ajaxInit() { if(window.XMLHttpRequest) { //Mozilla, Opera, ...  ajaxHttpRequest = new XMLHttpRequest();  if(ajaxHttpRequest

js控制flash

使用JS控制FLASH动画<摘自FLASH网页动画宝典 赵英杰 著> 在网页中插入FLASH动画,并给他一个id变量,假设为"flashvar",这时你可以需要的地方用js来控制FLASH对象了... document.FLASH对象名称.方法名称() document.FLASH对象名称.属性 上面的语法适用于IE和Netscape浏览器,但是N6.0和N6.01版不支持...设定对象名称的方法,对IE同上,对Netscape浏览器则除了在当中有一个NAME="

可控制Flash Player的Javascript方法总结_Flash As

可控制Flash Player的Javascript方法: 一览表: Play() ---------------------------------------- 播放动画  StopPlay()------------------------------------停止动画  IsPlaying()----------------------------------- 动画是否正在播放 GotoFrame(frame_number)---------------- 跳转到某帧  TotalF