[Javascript] HTTP_GET_VARS on JavaScript.

Chris Tifer christ at saeweb.com
Tue Aug 26 08:20:36 CDT 2003


Have PHP write out the cookie to a page like I said and use loadVariables.
Otherwise, I suggest you look into FSCommand as that's the best way for
browsers and Flash files to talk to each other. Easiest way in my opinion is
to have your server (if you have some sort of dynamic server-side scripting
abilities) handle this and let Flash read it. Just because I showed ASP
doesn't mean you must use ASP. That's just an example as it's the
server-side language we use (VBScript)

Chris Tifer

----- Original Message ----- 
From: "Prabu Subroto" <prabusubroto at yahoo.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Tuesday, August 26, 2003 9:14 AM
Subject: Re: [Javascript] HTTP_GET_VARS on JavaScript.


> Hi Chris...nice to meet you again.
>
> But your codes is reading the cookie with ASP and what
> I need is reading the content of the cookie with
> actionscript.
>
> I want to do like this :
> Putting a variable into the cookie (my_cookies="50")
> with JavaScript this way :
> window.document.cookie="my_cookies='50'"
>
> and then my ActionScript will read the content of the
> cookies ( "50" of my_cookies).
>
> Could you tell me how to read the "my_cookie" with
> actionscript?
>
> Thank you very much in advance.
> --- Chris Tifer <christ at saeweb.com> wrote:
> > I'm not sure of the PHP syntax, so you might have to
> > look that up, but with
> > loadVariables, you just need to have a page output
> > something like this:
> >
> > varName=value&varName2=value
> >
> > So with ASP, I could do something like this to get a
> > cookie setting:
> >
> > cookieID=<%=Response.Cookies("ID")%>
> >
> > Then in my flash movie, cookieID will be the value
> > of the cookie AFTER the
> > loadVariables executes. It's not set just as soon as
> > you call it, and could
> > take a few seconds depending on your server's
> > response time as well as
> > traffic.
> >
> > Chris Tifer
> > http://emailajoke.com
> >
> > ----- Original Message ----- 
> > From: "Prabu Subroto" <prabusubroto at yahoo.com>
> > To: "[JavaScript List]" <javascript at LaTech.edu>
> > Sent: Tuesday, August 26, 2003 8:12 AM
> > Subject: Re: [Javascript] HTTP_GET_VARS on
> > JavaScript.
> >
> >
> > > Hallo Murugesan, thank you very much for your
> > > respond...
> > >
> > > I am still wondering how to read the value of the
> > > variable in the cookie with LoadVars of the
> > > ActionScript. Do you know that? Could you give a
> > clear
> > > syntax as the sample?
> > >
> > > Please....
> > >
> > > Thank you very much in advance.
> > > --- murugesan <murugesan at hotpop.com> wrote:
> > > > <input type=hidden name=cookie>
> > > >
> > > > functiion submitform()
> > > > {
> > > >     name=document.forms[0].uname.value;
> > > >     now=new Date();
> > > >     setCookie("visname",name, now);
> > > > }
> > > >
> > > >
> > > > function setCookie(name, value, expires, path,
> > > > domain, secure)
> > > >  {
> > > >   var curCookie = name + "=" + escape(value) +
> > > >      ((expires) ? "; expires=" +
> > > > expires.toGMTString() : "") +
> > > >      ((path) ? "; path=" + path : "") +
> > > >      ((domain) ? "; domain=" + domain : "") +
> > > >      ((secure) ? "; secure" : "");
> > > >   document.cookie = curCookie;
> > > >  }
> > > > function getCookie(name)
> > > >  {
> > > >   var dc = document.cookie;
> > > >   var prefix = name + "=";
> > > >   var begin = dc.indexOf("; " + prefix);
> > > >     if (begin == -1)
> > > >   {
> > > >       begin = dc.indexOf(prefix);
> > > >       if (begin != 0)
> > > >     return null;
> > > >     }
> > > >   else
> > > >       begin += 2;
> > > >      var end = document.cookie.indexOf(";",
> > begin);
> > > >     if (end == -1)
> > > >       end = dc.length;
> > > >     return unescape(dc.substring(begin +
> > > > prefix.length, end));
> > > >  }
> > > >
> > > >
> > > > if(getCookie("uname!= null)
> > > >  {
> > > >     var cook;
> > > >
> > document.forms[0].visnme.value=getCookie("uname");
> > > >     if(document.forms[0].cookie.value=='on')  |
> > > >      document.forms[0].cookie.value='off';
> > |
> > > >   else
> > > >               |
> > > > setvalueof cookie
> > > >      document.forms[0].cookie.value='on';      |
> > > >  }
> > > >
> > > > <input type=checkbox onclick=set value of
> > cookie>
> > > >
> > > > -murugesan
> > > > ----- Original Message -----
> > > > From: "Prabu Subroto" <prabusubroto at yahoo.com>
> > > > To: "[JavaScript List]" <javascript at LaTech.edu>
> > > > Sent: Tuesday, August 26, 2003 4:42 PM
> > > > Subject: Re: [Javascript] HTTP_GET_VARS on
> > > > JavaScript.
> > > >
> > > >
> > > > > Dear my friend, Chris...
> > > > >
> > > > > I tried to understand your advice but I still
> > > > loose my
> > > > > self.
> > > > >
> > > > > How can I put the cookies? and How can I load
> > the
> > > > > value of the variable in the cookie?
> > > > >
> > > > > Could you give me a clear syntax as an example
> > of
> > > > > putting the cookie in JavaScript or PHP and to
> > > > read
> > > > > the cookie with LoadVars?
> > > > >
> > > > > Please tell me my friends. I am really stuck.
> > > > >
> > > > > Thank you very much in advance.
> > > > > --- Chris Tifer <christ at saeweb.com> wrote:
> > > > > > Yes, it's possible. My method to fix this
> > would
> > > > be
> > > > > > to use Cookies and have
> > > > > > the first thing Flash does is check this
> > cookie
> > > > by
> > > > > > using a loadVariables
> > > > > > command which simply checks the value of the
> > > > cookie
> > > > > > and outputs something
> > > > > > like:
> > > > > >
> > > > > > blHasCookie=1 (or blHasCookie=0)
> > > > > >
> > > > > > Then judging by that variable in Flash, you
> > > > either
> > > > > > tell it to play from the
> > > > > > opening sequence or the other frame (I
> > recommend
> > > > > > using Labels instead of
> > > > > > frame numbers. Much better...
> > > > > >
> > > > > > I'm sure you could us FSCommand to talk with
> > > > > > JavaScript and issue a command
> > > > > > directly to Flash based off the value of the
> > > > cookie
> > > > > > keeping you from making
> > > > > > another call to the server, but
> > loadVariables is
> > > > > > easier to me.
> > > > > >
> > > > > > Does that make sense or did I lose you?
> > > > > >
> > > > > > Chris Tifer
> > > > > >
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "Prabu Subroto"
> > <prabusubroto at yahoo.com>
> > > > > > To: "[JavaScript List]"
> > <javascript at LaTech.edu>
> > > > > > Sent: Friday, August 22, 2003 9:58 AM
> > > > > > Subject: Re: [Javascript] HTTP_GET_VARS on
> > > > > > JavaScript.
> > > > > >
> > > > > >
> > > > > > > Dear my friend, Christ....
> > > > > > >
> > > > > > > I am very new in Flash and Macromedia
> > > > web-pack.
> > > > > > >
> > > > > > > I am making a homepage
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> (http://www.i-am-e-system.de/www.lam-ag.de/index.html),
> > > > > > > so far this is good enough already for me
> > but
> > > > my
> > > > > > boss
> > > > > > > has a difficult command for me. He wants
> > that
> > > > the
> > > > > > > visitors can see and read clearly all of
> > the
> >
> === message truncated ===
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list