Indigo Rose Software
  #1  
Old 01-08-2005
eric_darling's Avatar
eric_darling eric_darling is offline
Indigo Rose Customer
 
Join Date: Jun 2002
Location: Southeast USA
Posts: 1,804
PHP for cookie setting?

I'm working on a new web site for our corporate relaunch in a couple of months. One of things I want to do is to have a very simple splash page (no annoying animations or sounds) which will allow the user to check a small Flash animation to see if it is playing on the page. If it is, they can click yes, and if not, no. The yes click leads to our regular home page. The no click goes to Macromedia to download the current version of the Flash player.

Now, I'd like to be able to track if a computer has already seen this page and clicked "yes." Then, I could instruct the browser to skip this splash screen and go directly to the home page.

I understand this involves cookies (something I've never really dived into before), and that I can either use Javascript or PHP. Seeing as how so many users have disabled javascript nowadays, I'm thinking the PHP route is best.

Does anyone have a sample script they can provide that will handle what I'm looking to do? Obviously, my PHP skills aren't were they should be yet.
__________________
Eric Darling
eThree Media
http://www.ethreemedia.com
Reply With Quote
  #2  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
FWIW I avoid cookies. As far as I know %90 of people have Javascript enabled. It's the cookies they have blocked. The largest source of problems I see in web site performance nowadays is cookies. For example if I try to visit the web site of one of the supposed "world leaders in web usability" KPMG, all I get is an endless loop of page refreshes because I have cookies blocked. Crazy...

If you go to the worlds largest flash sites they don't have any auto-skip feature for their intro. That leads me to believe it's not worth it. Might be wrong.

Anyhow that's just my opinion. I avoid cookies at all costs so I have no code snippets to share unfortunately. The best bet for you will be to search a couple php exchange sites for "set cookie". Sorry, wish I could be more help...

If you check out the Setup Factory site you will see my reccomended way for deploying Flash. Hallucinati.com too. Front page Flash is not something I reccomend for a variety of reasons.
Reply With Quote
  #3  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
Shared Object - cookie - Flash MX 2004 - Intrigued

Here is an example on how to use the Shared Object (Think cookie for Flash).

SEE: Attachment

Here's the code (in the _action layer):

Code:
//Create a new Shared Object
data_so = SharedObject.getLocal("cookie");

/* On the release of the saveButton_btn (button)
   the data is saved to the user computer and
   the Input text field is cleared
*/

saveButton_btn.onRelease = function(){
	data_so.data.savedData = display_txt.text;
	data_so.flush();
		display_txt.text = "";
};

/* on the release of the loadButton_btn (button)
   the data is loaded into the display_txt (Input field)
*/
loadButton_btn.onRelease = function(){
	display_txt.text = data_so.data.savedData;
};
Attached Files
File Type: rar SharedObject.rar (5.5 KB, 16 views)
__________________
Intrigued
www.amsuser.com
Reply With Quote
  #4  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Shared local object is different than a cookie. If you right click on a Flash movie you can go to "Settings" and set how much memory the shared local object gets. I believe default is 100K. Some anti-virus software or anti-worm software may prevent shared local objects from being stored and accessed properly. I wouldn't create designs which rely upon it although it's an excellent tool.

The main reason it will not work as a cookie does though is that the SLO is just a FIFO stack so your data will be pushed out by anything else using SLO such as other web sites, and you have no way to personalize the data you store. With a cookie you can at least label your data and not have to worry about it being overwritten by other people's cookies. As a mere 100K FIFO stack, you can imagine, the SLO isn't a good spot for storing data more than a few minutes.

SLOs are ideally used sparingly for tiny amounts of dynamic data in Flash that runs locally.

Anyhow to be clear here you really don't want to block your Flash from loading after the first view anyhow. Imagine a few of the scenarios:

1) Someone likes your Flash and then goes to show it to someone else later but now suddenly it's no longer there.
2) Someone views your Flash from a public or network computer. Now your Flash isn't visible to anyone else on that computer.
3) Someone bookmarks your page and comes back later to really pay attention to the Flash but it's gone.

And so forth. There's tons more but that's a few. In general the more contextual control you try to build in to a web site, the less effective it will be in the real world.
Reply With Quote
  #5  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
Quote:
Originally Posted by Corey
Shared local object is different than a cookie. If you right click on a Flash movie you can go to "Settings" and set how much memory the shared local object gets. I believe default is 100K. Some anti-virus software or anti-worm software may prevent shared local objects from being stored and accessed properly. I wouldn't create designs which rely upon it although it's an excellent tool.

The main reason it will not work as a cookie does though is that the SLO is just a FIFO stack so your data will be pushed out by anything else using SLO such as other web sites, and you have no way to personalize the data you store. With a cookie you can at least label your data and not have to worry about it being overwritten by other people's cookies. As a mere 100K FIFO stack, you can imagine, the SLO isn't a good spot for storing data more than a few minutes.

SLOs are best used sparingly for tiny amounts of dynamic data in Flash that runs locally.
Yes, 100K is the default.

Corey, but the Shared Object can be named anything and is tied to that specific .swf. I am not following how this can be disvantageous.

I see examples of it being used to store scores, to user logins and more.

Hmmm... I will have to investigate more.
__________________
Intrigued
www.amsuser.com
Reply With Quote
  #6  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
I don't think SLO is "tied to a specific .swf", i.e. you get 100K total, not 100K per .swf. Or at least that is my technical understanding. Correct me if I'm wrong. My understanding is that it's FIFO, i.e. new data pushes out old data ergo "Shared", i.e. if you have hi-scores in the SLO and then some other site writes hi-scores to it, yours are toast. Anyhow let me know what you find out.

I would point to the complete abscence of online marketers using SLOs as an indication that it is not a good solution for cookie-like tasks. Those guys are vultures, they don't miss a trick. If SLOs "solved" cookies, they'd be in use *everywhere*. Or at least that's my opinion anyhow.

Personally I have had mine set to zero since day one... I learned about the undocumented SLOs way back, there's a post in here somewhere about it actually.
Reply With Quote
  #7  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
Ah, Google helped me yet again on this one. I found this point which seems to back your comment on the location of the .sol file (that it's not in with the .swf, with say a hidden attribute of sorts):

Quote:
Shared objects are stored in .sol files located in the Flash player directory of the user's profile : "C:/Documents and Settings/Administrator/Application Data/Macromedia/Flash Player", and have their own format
I hope that most people don't set to 0 like you have Corey! This feature is something I wanted to use instead of using say a fscommand sort of work around.

*Then I read further down the page as I was typing this reply and Corey's right-cross came about and now I feel like I and the Shared Object are about to TKO!
Attached Images
File Type: gif sharedobject-important.gif (1.9 KB, 16 views)
__________________
Intrigued
www.amsuser.com
Reply With Quote
  #8  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
I would say that post you attached is correct. Use it but don't rely on it. For us AMSers we can do sooooo much with our Flash locally, i.e. read/write files, etc. But on the web it's tricky. You can bind IPs to MySQL flags, etc. and do it server side, etc. But in general it's not worthwhile.

You know what it all comes down to? For your web site to be usable, it has to be familiar to the user. Most effective path to that is to stick to slight variations on "the norm" and don't do anything radical. The closer your web site experience is to what the visitor is "used to" the more successful the experience is going to be for that particular user. So in other words if you have a Flash site, you are best off emulating the successful Flash sites and avoiding the same things they avoid.

As a video metaphor, if you are making DVDs you are better off making them similar to the DVDs people get in the stores vis-a-vis end user satisfaction. If you instead create a new type of intuitive menu system, you risk losing a portion of that satisfaction with no upside because the user will not notice the enhanced experience, i.e. "not seeing" a menu won't register in the user's mind as an enhancement. Anyhoo just opinions...
Reply With Quote
  #9  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
Corey, I am relieved with your comment about the comparisons from Flash on the Web and Flash with regards to AMS! Because that is the road I plan to travel more myself and the flexibility of the latter is music to my ears!

Well, I am walking away a more informed person thanks to eric's inquirey.

Thank you both!

Give me an "Eeee"!

Give me a "Cccc"!



ps. I found one more thing on the _so. That the 100K is for each domain. For what it's worth.
__________________
Intrigued
www.amsuser.com
Reply With Quote
  #10  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
100K is for each domain? Hmmmm... Did you test that out? That would be good news. BTW FWIW I doubt very many people tweak their Flash player settings, I would say +95% are probably set at 100K. So how does SLO handle local .swfs vis-a-vis the "domains" metaphor?

As for "Flash in AMS" you can do *anything*. Heck, by typing in a few IF statements you can create a set of SQLite functions for your .swfs so that fscommands like these become full queries:

fscommand("addDB","name;date;price;PID;url");
fscommand("delDB","name where price>50");

Obviously that's an oversimplification but you get the metaphor. Anyhow I'll share a secret with you. Pretty soon I will be free to spend *most* of my time promoting and enhancing online resources for AutoPlay Media Studio. Know what that means? TONS of new stuff for AutoPlay Media Studio from the mind of Corey with one purpose only, "To make people go WOW!".

2005 is a *complete* renaissance for AutoPlay Media Studio. My goal is to double our user base by 2006. The plan is to do that by focusing all my energy on building cool new stuff for AMS, posting it online, and showing people how it was done. I'm going to use every ounce of skill I can muster this year and I believe the world will respond to our efforts. This will dwarf all our existing online stuff. I'm going to stretch the envelope in *every direction*. I'm going to show you how to embed PHP sites/scripts (easy) into AMS projects, how to drive AMS projects with scripting languages other than Lua, how to develop advanced Flash applications in AMS, how to use Photoshop to maximum advantage with AMS, etc. And I'm going to give you everything you need to get it going on your end such as functions, code examples, resources, one-on-one help, tutorials, project downloads, etc. Heck I'm even studying up on game design basics.

Anyway you slice it you win Intrigued, it's going to be an unbelievable year for existing AMS users.
Reply With Quote
  #11  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
*Takes off 10-gallon hat and swats it against his left thigh.

Hot tobasco sauce!

I'm fired up now!

AMS alive in 2005, no jive!

Seriously, that sounds terrific! Myself (and if I may be so bold) and others that have been using AMS 5 with LUA embedded for a year-plus are surely ready to receive this bounty!

__________________
Intrigued
www.amsuser.com
Reply With Quote
  #12  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
I'll also have some resources for your site, and I'll help all the AMS fan sites get ranked at Google. I'll set up some sort of (no ads) AMS user ring once we can get a few more fan sites up, and then people will be able to cruise through all the resource sites such as yours in a circuit. Basically I'll help you guys expand your traffic, download resources, or anything else you need.

It'll be a month or so before I can get started though, we have to get TU2 and VP2 online first. Focus, focus...
Reply With Quote
  #13  
Old 01-08-2005
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,059
Woot!

Win for I.R. and win for us, the AMS developers!

M.S. VB and Java/JavaScript developers eat your heart out!

__________________
Intrigued
www.amsuser.com
Reply With Quote
  #14  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Yeah VB, I'll have to earmark that for later. Unfortunately I'm crap with MS stuff currently, so I'll have to grab some basics as I go... Ideally I'd like to post the same projects in several different languages in order to attract existing users from other scripting languages. For example PHP, I built a few basic standalone test apps last week which are PHP driven and they work great, hopefully it may lead to a PHP plug-in at some point. (no guarantee) So hopefully that will be attractive to PHP users who currently cannot build any decent type of standalone windows apps, never mind in this sort of ergonomic environment. PHP-GTK isn't even close although I like their project.

Same goes for Javascript, actionscript, etc. Hopefully one by one we can get developers from other languages here into the forum and show them how easy it is to develop full blown Windows software in their native languages using AutoPlay Media Studio.

I think we can do it. I think we can redefine the entire scope of what multimedia devleopers can create. And I think we can do it in a year or less.

Heck just the PHP plug-in alone (if we can pull it off) will blow the roof off that sector. Imagine using PHP to drive your videos, images, text, Lua scripts, Flash, web browser objects, etc. in a standalone client side context. Or being able to simply re-package your existing PHP driven web site for CD-ROM delivery. It's revolutionary, and I know it works because I've already tested it. Anyhoo..
Reply With Quote
  #15  
Old 01-08-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
BTW Eric I had a poke around, this seems to be the best page around for explaining PHP cookies easily and with some easy-to-follow code examples for creating, reading, deleting, etc...

http://ca.php.net/setcookie

If you run into any hassles using the example code just let me know.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example: Sending Email Using a Remote PHP Web Script Corey AutoPlay Media Studio 5.0 Examples 36 06-10-2007 03:07 PM
Weather data and PHP 5 . . . Intrigued Developer's Den 0 10-09-2004 12:26 PM
Function: Email Any Data Through PHP Brett AutoPlay Media Studio 5.0 Examples 8 10-02-2004 09:08 PM
The dreaded Submit to web PHP issue! Bruce AutoPlay Media Studio 4.0 2 09-19-2003 04:00 PM
INFO: Setting Environment Variables Support Setup Factory 6.0 Knowledge Base 0 10-10-2002 01:07 PM


All times are GMT -6. The time now is 04:47 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software