程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> ASP技巧 >> 用ASP控制Flash

用ASP控制Flash

編輯:ASP技巧

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="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...

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved