代码之家  ›  专栏  ›  技术社区  ›  Chasester

flashas3,电影播放后重定向-使用php驱动的querystring

  •  1
  • Chasester  · 技术社区  · 15 年前

    我遇到了这样一种情况:有一个访问者使用ID键访问php页面。然后,它们导航到第2页,在该页中,它们在querystring变量中携带键id。

    http://www.mysite.com?x=abcde12345

    第2页有一个flash视频-正在播放一部电影。一旦电影停止播放,我希望flash重定向到第3页-带上querystring,因为第3页需要使用querystring来查找数据库值。

    我以前用GetURL在老版本的flash中工作得很好,但是现在需要AS3了。我已经搜索了很长一段时间了-我可以看到如何用querystring重定向-但看不到如何用动态querystring重定向-当谈到flash时,我相当迷茫。

    非常感谢。

    更新:我不知道我在这里哪里出错了。

    这是我的HTML代码

    <script>
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'); document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
    document.write('WIDTH="550" HEIGHT="400" id="movie" ALIGN="">');
    document.write(' <PARAM NAME=movie VALUE="Movie-test.swf">');
    document.write(' <PARAM NAME=FlashVars VALUE="x='+toPage+'">');
    document.write(' <PARAM NAME=quality VALUE=high>');
    document.write(' <PARAM NAME=bgcolor VALUE=#FFFFFF>');
    
    document.write('<EMBED src="Movie-test.swf"');
    document.write('    FlashVars="x='+toPage+'"');
    document.write('    bgcolor=#99CC33 WIDTH=550 HEIGHT=400 ');
    document.write('    TYPE="application/x-shockwave-flash">');
    document.write('  </EMBED>');
    document.write(' </OBJECT>');
    </script>
    

    var params:Object = this.loaderInfo.parameters;
    var id:String = params.x;
    
    //then after the movie completes
    
    function onComplete(event:Event):void
    {
       var page3URL:String = "page2.php?" + "x=" +id;
       navigateToURL( new URLRequest( page3URL ) );
    }
    

    视频只是循环播放。

    你能看出我哪里出错了吗?

    3 回复  |  直到 15 年前
        1
  •  4
  •   PatrickS    15 年前
    变量参数:对象=this.loaderInfo.parameters参数;
    var id:String=params.x;
    
    //在电影结束后
    
    {
    变量第3页URL:字符串="http://example.com?" +“x=”+id;
    navigateToURL(new URLRequest(page3URL));
    
    
        2
  •  1
  •   Joseph Allen    15 年前

    您有两个选择:

    1使用flashvars将ID加载到flash中。

    这是一个关于这个的啧啧声 http://www.permadi.com/tutorial/flashVars/index.html 然后 变量下一步:URLRequest=新建URL请求(“ http://www.domain.com/page3.php?id= 导航URL(nexturl,“_self”);

    2从flash内部调用Javascript函数

    只需在HTML中创建一个小的重定向函数

    函数nextPage(){

    从内部闪光

    变量温度:对象=外部接口.call(“下一页”);

        3
  •  0
  •   daihovey    15 年前

    我将使用php将ID键添加到Flashvars属性中,然后使用

    LoaderInfo(this.root.loaderInfo)

    ExternalInterface