Re: [Flashcoders] Detecting referrer in Flash

2007-05-03 Thread Leandro Amano

public _url : String [read-only]

Retrieves the URL of the SWF file that created the button.

*Availability: *ActionScript 1.0; Flash Player 6
Example

Create two button instances on the Stage called one_btn and two_btn. Enter
the following ActionScript in Frame 1 of the Timeline:

var one_btn:Button;
var two_btn:Button;this.createTextField(output_txt, 999, 0, 0, 100, 22);
output_txt.autoSize = true;
one_btn.onRelease = function() {
   trace(clicked one_btn);
   trace(this._url);
};
two_btn.onRelease = function() {
   trace(clicked +this._name);
   var url_array:Array = this._url.split(/);
   var my_str:String = String(url_array.pop());
   output_txt.text = unescape(my_str);
};



On 5/3/07, Michael Mudge [EMAIL PROTECTED] wrote:


Is there any way to determine which web page is displaying my SWF?  This
could be the referrer field of the HTTP request for the .SWF... Or any
other data that might indicate what the containing web page is.  I am
using this to determine how to match the theme of the source page, not
for security.

- Kipp

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--
--
Leandro Amano
Digital Bug
Chief Creative Officer
Adobe Certified Expert
Adobe Certified Instructor
Adobe User Group Leader
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Detecting referrer in Flash

2007-05-03 Thread Lists
The referrer is not the page displaying your SWF. The referrer is the page
you linked FROM to get to the page displayign your SWF. If I come from a
link in my blog to your site, my blog is the referrer.

You can't get the referrer from Flash, so you must use ExternalInterface and
use JavaScript to pass it back to Flash.

However, it sounds like you want the page displaying your SWF, which is
easy. It's the _url property. I think this._url in the main timeline is
sufficient but you can check the help system.

Rich


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Detecting referrer in Flash

2007-05-03 Thread David Ngo
If you'd rather have something more secure, then I'd suggest calling a
backend to pass it to you. This gets a lot more complicated as you'd now
have to tack on session management. The other option is to use
JavaScript/AJAX to pull data from a request or response. Are you putting
your SWF on an HTML page or a JSP/ASP/PHP page? If it's the former, there
really is no other way outside of using session management +
XML/JavaScript/AJX. If it's the latter, then you can have the JSP/ASP/PHP
page write the referrer to the FlashVars. However, if you get referrer URL's
with querystrings attached, you could potentially run into issues there as
well as you'd have to parse through the referrer's querystring. I'm not sure
if there's an easy answer for this outside of having Flash do a separate
call to get the referrer URL once the SWF has loaded.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Mudge
Sent: Thursday, May 03, 2007 9:00 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Detecting referrer in Flash

 You can use FlashVars to pass it into your SWF via the HTML embed.

I'm currently using an anchor (foo.swf#abc) or file parameters
(foo.swfitem=abc), which work fine.

But can I do any better than this?  I feel that passing in a parameter
is an invitation for tampering...  Not that it's incredibly critical,
but it'd be nice if developers could just drop-in the SWF without having
to configure it.

 public _url : String [read-only]

This gives the URL of the SWF itself -- this is already known.

- Kipp

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com