それを格納するためにベースsetcookie
機能があります。フラッシュで可能ですか? それが可能ならどうやって? 値を保存します。は、FlashまたはFlexでの保存Cookieを評価することは可能ですか? PHPで
答えて
はい。 Flashアプリケーションは、ユーザーのコンピュータに最大100KBのデータ(デフォルト)を保存できます。これはFlash Cookie(ブラウザのCookieとは別)に保存されています。ユーザーは、フラッシュアプリケーションを右クリックして設定に進むことで、保存できるアプリケーションの量を調整できます。ここで
はAS3用のSharedObject APIです: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html
あなたは
を「フラッシュのSharedObjectを」グーグルによる詳細情報を取得することができ、ユーザは、あなたがデータを置くことはできませんケースを処理するために準備することを確認してくださいSharedObjectsに追加します。これは、プライバシーを懸念するハイテクなユーザーの間で人気の高い傾向にあります。
幸運を祈る!
まず第一に:PHPはクッキーを設定するために必要なHTTPヘッダを送信することができますので、サーバ上で動作し、フラッシュは、クライアントのブラウザで実行するので、同じことを行うことはできません。
しかし、flash.external.ExternalInterface
を使用して取得し、クッキーを設定するには、JavaScript関数を呼び出すことにより、フラッシュ/フレックスからクッキーにアクセスし、保存するための方法があります。
package de.slashslash.util {
import flash.external.ExternalInterface;
/**
* The Cookie class provides a simple way to create or access
* cookies in the embedding HTML document of the application.
*
*/
public class Cookie {
/**
* Flag if the class was properly initialized.
*/
private static var _initialized:Boolean = false;
/**
* Name of the cookie.
*/
private var _name:String;
/**
* Contents of the cookie.
*/
private var _value:String;
/**
* Flag indicating if a cookie was just created. It is <code>true</code>
* when the cookie did not exist before and <code>false</code> otherwise.
*/
private var _isNew:Boolean;
/**
* Name of the external javascript function used for getting
* cookie information.
*/
private static const GET_COOKIE:String = "cookieGetCookie";
/**
* Name of the external javascript function used for setting
* cookie information.
*/
private static const SET_COOKIE:String = "cookieSetCookie";
/**
* Javascript code to define the GET_COOKIE function.
*/
private static var FUNCTION_GET_COOKIE:String =
"function() { " +
"if (document." + GET_COOKIE + " == null) {" +
GET_COOKIE + " = function (name) { " +
"if (document.cookie) {" +
"cookies = document.cookie.split('; ');" +
"for (i = 0; i < cookies.length; i++) {" +
"param = cookies[i].split('=', 2);" +
"if (decodeURIComponent(param[0]) == name) {" +
"value = decodeURIComponent(param[1]);" +
"return value;" +
"}" +
"}" +
"}" +
"return null;" +
"};" +
"}" +
"}";
/**
* Javascript code to define the SET_COOKIE function.
*/
private static var FUNCTION_SET_COOKIE:String =
"function() { " +
"if (document." + SET_COOKIE + " == null) {" +
SET_COOKIE + " = function (name, value) { " +
"document.cookie = name + '=' + value;" +
"};" +
"}" +
"}";
/**
* Initializes the class by injecting javascript code into
* the embedding document. If the class was already initialized
* before, this method does nothing.
*/
private static function initialize():void {
if (Cookie._initialized) {
return;
}
if (!ExternalInterface.available) {
throw new Error("ExternalInterface is not available in this container. Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime are required.");
}
// Add functions to DOM if they aren't already there
ExternalInterface.call(FUNCTION_GET_COOKIE);
ExternalInterface.call(FUNCTION_SET_COOKIE);
Cookie._initialized = true;
}
/**
* Creates a new Cookie object. If a cookie with the specified
* name already exists, the existing value is used. Otherwise
* a new cookie is created as soon as a value is assigned to it.
*
* @param name The name of the cookie
*/
public function Cookie(name:String) {
Cookie.initialize();
this._name = name;
this._value = ExternalInterface.call(GET_COOKIE, name) as String;
this._isNew = this._value == null;
}
/**
* The name of the cookie.
*/
public function get name():String {
return this._name;
}
/**
* The value of the cookie. If it is a new cookie, it is not
* made persistent until a value is assigned to it.
*/
public function get value():String {
return this._value;
}
/**
* @private
*/
public function set value(value:String):void {
this._value = value;
ExternalInterface.call(SET_COOKIE, this._name, this._value);
}
/**
* The <code>isNew</code> property indicates if the cookie
* already exists or not.
*/
public function get isNew():Boolean {
return this._isNew;
}
}
}
wooooow何の答え! 。私はすきです 。それは私に非常に便利です 非常にサイモンレーマンありがとうございます。 –
を実際のコードの例::
は、私は非常に簡単にこれを行うために、クラスを開発した二回、それを公開し、それが保存された方法を見て、
import flash.net.SharedObject;
// get/create the shared object with a unique name.
// If the shared object exists this grab it, if not
// then it will create a new one
var so: SharedObject = SharedObject.getLocal("UniqueName");
// the shared object has a propery named data, it's
// an object on which you can create, read, or modify
// properties (you can't set the data property itself!)
// you can check to see if it already has something set
// using hasOwnProperty, so we'll check if it has a var
// use it if it does, or set it to a default if it doesn't
if (so.data.hasOwnProperty("theProp"))
{
trace("already has data! It reads: " + so.data.theProp);
}
else
{
so.data.theProp = "default value";
so.flush(); // flush saves the data
trace("It didn't have a value, so we set it.");
}
はフラッシュでこれを貼り付けデータ:)あなたの答えは非常にクリアリーで
- 1. 宣言した後、ここで文字列を再評価することは可能ですか?
- 2. 評価システム:usernameまたはipをdbまたはcookieに保存していますか?
- 3. ここでPHP cookieが保存されていますか?
- 4. Flex + Adobe Flash:それは可能ですか?
- 5. 文字列をgroovyで変数として評価することは可能ですか?
- 6. Eclipse:ファイル保存アクションでFindBugsを実行することは可能ですか?
- 7. アンドロイドにデータベースなしで保存することは可能ですか?
- 8. XmlDocumentを変数として保存することは可能ですか?
- 9. postfixとstackを使って記号式を評価することは可能ですか?
- 10. システムコールの出力をウィンドウに保存することは可能ですか?
- 11. Android:onRetainNonConfigurationInstanceによって描画可能ビットマップまたはビットマップを保存することはできますか?
- 12. jsonをamazon s3に保存することは可能ですか?
- 13. intellijでflex 3のグラフをコンパイルすることは可能ですか?
- 14. Flash経由でブラウザのブックマークを取得することは可能ですか?
- 15. これは実行可能なサブディレクトリファイル保存システムですか?
- 16. Jsonの応答はevalで評価することはできません
- 17. PHPスクリプトとmysqlをコンパイルすることは可能ですか?
- 18. PHPなしでサインアップすることは可能ですか?
- 19. クッキーを保護することは可能ですか?
- 20. Flexでは、コールバックイベントに余分なパラメータを渡して早期に評価できますか?たとえば
- 21. このクエリはどのように評価できますか?
- 22. クライアント側から画面をキャプチャしてサーバ側に保存することは可能ですか? (PHP)
- 23. このタイプのプログラムをPHPで構築することは可能ですか?
- 24. flex/as3のスーパークラスのスーパークラスにアクセスすることは可能ですか?
- 25. 次は、「hi」と評価されるのはなぜですか?
- 26. Xcode:コアデータにuiwebviewを保存することが可能です
- 27. 価格履歴を保存することができます
- 28. jquery cookieで訪問したページを保存するには
- 29. Linux、AMD、Flash-video - GPUデコードはまったく可能ですか?
- 30. Javascriptで異なるドメインのCookieを保存することはできますか
おかげジョージDeglin .Each時間。私はたくさん好きです。 :) :) –