读书人

swf怎么从jsp页面中获取一个字符?

发布时间: 2012-04-10 21:03:56 作者: rapoo

swf如何从jsp页面中获取一个字符??
我的问题是:对flash不懂,就用了个现成的makepic.swf,现在我想让swf在点击“上传”按扭时,从a.jsp中取得一个字符串并把这个字符串同图像一块上传到接收的b.jsp中,作为保存图像的文件名!那么我在a.jsp中如何做才能让makepic.swf得到这个字符串?
makepic.swf中的脚本

JScript code
// Action script...// [onClipEvent of sprite 36 in frame 1]//Component construct(){    icon = "";    label = "上   传";    labelPlacement = "right";    selected = false;    toggle = false;    enabled = true;    visible = true;    minHeight = 0;    minWidth = 0;}onClipEvent (load){    function __f_click(eventObj)    {        this._parent.send_me();    } // End of the function    this.addEventListener("click", __f_click);}// [onClipEvent of sprite 36 in frame 1]//Component construct(){    icon = "";    label = "预   览";    labelPlacement = "right";    selected = false;    toggle = false;    enabled = true;    visible = true;    minHeight = 0;    minWidth = 0;}onClipEvent (load){    function __f_click(eventObj)    {        this._parent.view_me();    } // End of the function    this.addEventListener("click", __f_click);}// [onClipEvent of sprite 81 in frame 1]on (press){    startDrag("", true);}on (release, releaseOutside){    stopDrag();}// [Action in Frame 1]function changeFrontImg(picPath){    _root.pic.loadMovie(picPath);} // End of the functionflash.external.ExternalInterface.addCallback("changeFrontImg", this, changeFrontImg);function print_me(){    var _l3 = ball._x - 65;    var _l2 = ball._y - 83;    pn = new it.sephiroth.PrintScreen();    pn.addListener(listener);    pn.print(_root, 0, 0, img_w, img_h, _l3, _l2);    loader.__set__label("输出中... 0%");    loader.open(false, true, true);} // End of the functionfunction view_me(){    var _l3 = ball._x - 65;    var _l2 = ball._y - 83;    pn = new it.sephiroth.PrintScreen();    pn.addListener(listener);    pn.view(_root, 0, 0, img_w, img_h, _l3, _l2);} // End of the functionfunction send_me(){    pn = new it.sephiroth.PrintScreen();    pn.addListener(listener);    pn.send(_root, 0, 0, img_w, img_h, 225, 5);    loader.__set__label("输出中... 0%");    loader.open(false, true, true);} // End of the functionmyCam = Camera.get();myCam.setMode(440, 660, 10, true);my_video.attachVideo(myCam);var loader = this.createClassObject(it.sephiroth.mloaderWindow, "loader", 10, {_x: -1000, _y: -1000});var listener = new Object();var img_w = 130;var img_h = 165;listener.onProgress = function (target, loaded, total){    var _l1 = Math.round(loaded / total * 100);    loader.__set__label("Sending... " + _l1 + "%");    loader.__set__value(_l1);};listener.onComplete = function (target, load_var){    loader.__set__label("Sending...");    load_var.send("b.jsp", "ylzp", "POST");    loader.close();};

a.jsp:
HTML code
<body bgcolor="#ffffff"  topmargin=0 leftmargin=0><form name="f1" target="ylzp"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="350" height="360" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="makepic.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="makepic.swf" quality="high" bgcolor="#ffffff" width="350" height="360" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></form></body> 



[解决办法]
借助js,与
flash.external.ExternalInterface.addCallback("changeFrontImg", this, changeFrontImg);
类似

读书人网 >Flash

热点推荐