gpt4 book ai didi

actionscript-3 - AS3 URL 字符串 -> URLRequest

转载 作者:行者123 更新时间:2023-12-04 22:15:52 26 4
gpt4 key购买 nike

我正在使用一些不接受 products.php?cat=10 作为目标的加载程序,因为弄清楚文件名和查询字符串太愚蠢了。是否有一个 AS3 函数可以解析 URL 并根据查询字符串中的变量返回 URLRequest?

最佳答案

有可能创建您需要的一切:

import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
import flash.events.Event;

// the path to the backend file
var url : String = 'http://youdomain.com/filepath.php';

// url variables all which will appear after ? sign
var urlVariables : URLVariables = new URLVariables ();
urlVariables['varname'] = 'varvalue';
urlVariables['varname1'] = 'varvalue1';
// here you can add as much as you need

// creating new URL Request
// setting the url
var request : URLRequest = new URLRequest ( url );
// setting the variables it need to cary
request.data = urlVariables;
// setting method of delivering variables ( POST or GET )
request.method = URLRequestMethod.GET;

// creating actual loader
var loader : URLLoader = new URLLoader ();
loader.addEventListener( Event.COMPLETE, handleLoaderComplete )
loader.load ( request );

关于actionscript-3 - AS3 URL 字符串 -> URLRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6085855/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com