Flash read cookie

Source: Internet
Author: User
Tags set cookie

Open FLASHmx, create a document, set the document size to 260*120 on the attribute panel, right-click the first frame of the timeline, and select the action option in the shortcut menu, on the action panel, select EXPERT mode and enter the following code:

Stop ();
// Create a text field: Name showbox, depth 1, coordinate position 10, 10, width 200, Height 100
This. createTextField ("showbox", 10,200,100 );
// Set the background color to ffccff.
Showbox. background = true;
Showbox. backgroundColor = 0 xffccff;
// Set the multi-line feature of text and the initial usage value
Showbox. multiline = true;
Showbox. wordWrap = true;
Showbox. text = "the COOKIE on the current page is :";
// This object is used to receive data transmitted from javascript and monitor the attribute coo. When its value changes, the show function is automatically triggered.
Obj = {};
Obj. coo = "";
Obj. watch ("coo", show );
// This function is used to display cookies in the text box.
Function show (prop, oldval, newval ){
Showbox. text = showbox. text + newline + newval;
}
// Execute the Javascript script command. unescape is used to decompile cookies. If you do not need to display them on the page, remove them by yourself.
// The following line of statements does not automatically wrap. Note that
GetURL ("javascript: this.doc ument. getElementsByTagName ('object') [0]. SetVariable
('_ Root. obj. coo', unescape (document. cookie ))");

Test: Select release preview> html format from the File menu. Check: Yi, why didn't the cookie be displayed? Forgot to tell you that the site must have
Can the cookie be displayed? The simulation is as follows: select the release under the File menu, that is, html and swf are published [default settings].
Modify the published html file and add the following code for testing:

<Script language = "JavaScript" type = "text/JavaScript">
Document. cookie = "set cookie: Haha, your username is xyz ";
</Script>

Add the above Code to the head area, open the html file in a browser, and display:

If CORS is accessed, set: System. security. allowDomain (http://www.abc.net );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.