472,779 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 1552
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.