ActionScript

出自 ProgWiki
前往: 導覽搜尋

ActionScript,參照:『維基百科~ActionScript

技術文件

ActionScript Reference

應用

字串剖析

網路

HTML

其他


相關

FAQ

區域變數與全域變數

var counter;     //這是時間軸變數或區域變數
_global.counter; //這是全域變數, 不可用 var 去定義, 在ActionScript的各動作中, 變數沒有互通, 故要用全域變數去傳遞

開啟網頁到指定的頁框

  • getURL(url:String, [window:String, [method:String]]) : Void (ActionScript 2.0)

將指定的URL的檔案資料載入

<%@ WebHandler Language="C#" Class="GetVars" %>
 
using System;
using System.Web;
using System.Collections.Generic;
using System.Data;
using System.Web.SessionState;
 
 
public class GetVars : IHttpHandler, IRequiresSessionState {
 
    public void ProcessRequest (HttpContext context) {
 
        context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
 
        Dictionary<string, string> mapValues = new Dictionary<string, string>();
 
        mapValues.Add("UserIP",  context.Request.UserHostAddress);
        mapValues.Add("WebHost",  context.Request.Url.DnsSafeHost);
 
        context.Response.ContentType = "text/plain";
        foreach (KeyValuePair<string, string> kvp in mapValues) {
            context.Response.Write(string.Format("&{0}={1}", kvp.Key, kvp.Value));
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }
}
    • ActionScript端的Code
var strUserIP;
var strWebHost;
 
myVars = new LoadVars();
myVars.onLoad = function(success) {
	if(success){
		strUserIP = this.UserIP;
		strWebHost = this.WebHost;
	}
}
myVars.load("GetVars.ashx");

取得在HTML裡定義的param參數

var globalParam = LoaderInfo(this.root.loaderInfo).parameters;
var xyz = globalParam['xyz'];