473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

why won't this code work?

I got this snippet online and for the life of me I can't seem to make it
write the cookie....
The Flash has the labels mentioned in the code and I used the name=movie and
the swconnect=true as mentioned in the comments.
The movie is fine.....the code is just not writing the cookie at all...
Could someone take a look and see if you can figure out why it won't work?

Thanks,

FayeC

Code as follows:
<script language="javascript">
////////////////////////////////////////////////////////////////////////////
/////
// makeCookie is called when the page loads and only sets the cookie
// if the user does not have one.
// we can communicate with the swf by naming it in the <object> and <embed>
tags
// in the <object> tag you will see id=movie and
// in the <embed> tag i put name=movie swLiveConnect=True
// a list of javascript methods for flash are available at
www.macromedia.com/support/flash
// and type javascript methods into the search box
////////////////////////////////////////////////////////////////////////////
/////
function makeCookie(){
var movie = window.document.movie;
movie.StopPlay();
// only makes the cookie if don't have one
if(document.cookie == "") {
// play the intro
movie.Play();
// the cookie expires on this date
var date = new Date();
date.setDate(date.getDate() + 30);
// make the cookie date readable by the browser
var da_date = date.toGMTString();
var da_cookie = "visited:True" + ";expires=" + da_date;
document.cookie = da_cookie;
//uncomment the alert below to see the cookies value
//alert(da_cookie)
}

else
// if they have the cookie - fire the readIt function
readIt()
}
////////////////////////////////////////////////////////////////////////////
/////
function readIt(){
var movie = window.document.movie;
// this tells the .swf which frame to go to
// it could send any number of commands to the .swf
// send the movie to frame 3
movie.TGotoLabel("/", "no_sound");
}
////////////////////////////////////////////////////////////////////////////
/////
</script>
Jul 23 '05 #1
1 1584
In article <b6********************@news20.bellglobal.com>,
"FayeC" <fa**********@sympatico.ca> wrote:
The Flash has the labels mentioned in the code and I used the name=movie and
the swconnect=true as mentioned in the comments.
I am not familiar with flash.
The movie is fine.....the code is just not writing the cookie at all...
Could someone take a look and see if you can figure out why it won't work?

// only makes the cookie if don't have one
if(document.cookie == "") {


The variable document.cookie contains all cookies created for this
path/domain. Some other program running out of the same directory may
have created a cookie that you are not aware of.

do an alert to see what is in the cookie:

alert(document.cookie);
I suggest you use an existing set of cookie routines. see this post for
some:

http://groups.google.com/groups?hl=e...b75ff.04071407
20.7fe9333b%40posting.google.com&rnum=6

Re: Javascript cookies?

Here are some more lines from the post:

Here are my suggestions.

1) Always set the expiration time. IE works better.

2) You may have disabled cookies. In IE, I had to go to the site then
check whether or not cookies were enabled.

3) Maybe your cookie rountines could use improvements.

Robert
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Kerry Neilson | last post by:
For the past couple of months, Idle won't start when I invoke it. I am at a complete loss for why this is. When this happens, they python command line still starts, and python works fine...
1
by: Jim | last post by:
Hey guys I DESPERATLY need some help with this small javascript i have on this website. All that it's supposed to do is change the button image once it's pressed but alas... I copy-pasted the code...
4
by: Mark | last post by:
the Following bit of code doesn't work. It seems to respond to the second, starting with 'add iif statement for Good Practice', but not to the first, starting 'add iif statement for archived' ...
5
by: John Warner | last post by:
I have a wierd problem that I can't find any reference to in the knowledge base. I develop simple databases at the company where I work, and many of them are used by hundreds of employees. We all...
7
by: simon | last post by:
I have simple html(aspx) page, but vertical height won't work. Even if i had set the height of a table=100%, the table is not 100% height. I spend a lot of time(my real page is more...
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
11
by: John Ortt | last post by:
Hi everyone. I have a database which I have developed in Access 2000 which is working nicely. The problem is that my customer only has Access 97. I tried to convert the database but the main...
7
by: Eran.Yasso | last post by:
Hi, I have project that automate excel(using Excel COM) which works fine in my home. I took the project from my home to work and tried to build the project but it won't built. I get error "The...
2
tpgames
by: tpgames | last post by:
Two days ago, MS office Word would type JP fonts, I thought. I didn't think I was using Works. Now, it won't type in JP. Jasc Paint shop pro 8, should type JP fonts because I am using XP, according...
4
by: z55177 | last post by:
My domain: http://www.esthevision.cz/ This is the cause of my problem. The template is supposed to look somewhat like this: PINK STRIPE http://themebot.com/website-templates/ht... I created an...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.