Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash ASP gotoandstop problem

Status
Not open for further replies.

davidste

Programmer
Mar 7, 2004
15
GB
I have a Flash movie that pulls in variables from an access database and also a cookie value.

My problem is that before I display the records from the DB an animation is run that I only want the user to see once. I have done this by checking a cookie value pulling the value in to flash and then trying to use gotoandStop to by pass the anim if the cookie
value = "beenSeen".

I.E. if this is the second time the user has viewed the page bypass the animation and go straight to the info from the DB. I have verified that the cookie is passed to Flash by using a dynamic txt Box so there is no problem with the asp. Only problem is that the movie refuses to gotoandstop at the correct frame when the cookie is set it just keeps playing the animation at the start.

I have placed everything inside a movie clip which has the following code on the movie:

onClipEvent(data)
{
strDate = myDate;
strNotes = Notes;
strFlashCookie = cookieFlash;
}

onClipEvent(load)
{
CurrentRecord = 0;
loadVariables ("get_details.asp?Record=0", this);

}

This basically pulls in the information from the db and cookie then sets up vars equal to the values.

On the first frame of the movie I have:

if (strFlashCookie == "beenSeen") {
gotoAndStop(form);
}

This should bypass the anim, i have checked the value of strFlashCookie and it is definately being displayed in a txt Box on a layer in the movie clip correctly.

On frame 73 (the end) I have a stop action.

PS To view what I am talking about go to

any help would be greatly appreciated before I go mad.
Thank You in advance.
 
Think it must be this line that is giving me the problem:

if (strFlashCookie == "beenSeen") {
gotoAndStop(form);
}

I have tried

if (strDate = 23/02/2004) {
gotoAndStop(73);
}

Using another of the vars passed in and it works everytime. Still do not know why the previous does not work though.
 
Try using a global variable.

Code:
_global.strFlashCookie = cookieFlash;

if (_global.strFlashCookie == "beenSeen"){
   gotoAndStop(73)
}

BTW: In your current AS you wrote:
Code:
if (strFlashCookie == "beenSeen") {
gotoAndStop(form);
}

If "form" is a frame label it should be:

Code:
if (strFlashCookie == "beenSeen") {
gotoAndStop("form");
}

note the quotes. That may bee the only problem you are having. Try the quotes first and the global second.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Tried the global var and it did not work i then
tried looking at the flash debugger

From this I have found that

_level0.comments has the following vars

CurrentRecord = 0
strDate = "Loading..."
strFlashCookie = "Loading..."
strNotes = "Loading..."
strPosition = "Loading..."

"Loading..." is what I have typed in the dynamic txtBoxes before the values are pulled in from the db etc

So therefor my code should look like:

if (_level0.comments.strFlashCookie == "beenSeen" ){
gotoAndStop(73)
}

on the first frame of the comments movie unfortunatelly this does not work, even more unfortunatelly is the fact that I can not trace the vars past this point as soon as the movie tries to access the vars in the debug mode I get the folloing error message:

Error opening URL "file:///C|/Inetpub/
Thank You for your help so far hope this helps.
 
I think you have all the right pieces in the wrong places. Try using the LoadVars AS instead of loadVariables.

On frame 1 of the main timeline:

Code:
myVars = new LoadVars();
myVars.load("get_details.asp?record=0");
myVars.onLoad = function(success){
   if (success){
      _global.strFlashCookie = myVars.cookieFlash;
      _global.strDate = myVars.myDate;
      _global.strNotes = myVars.Notes;
      
      //Evaluate 'strFlashCookie'
      if (_global.strFlashCookie == "BeenSeen"){
         gotoAndStop(73);
      }
   }else{
      trace("The variables didn't load");
   }
}

The .onLoad function will prevent anything from happening until the variables have successfully loaded.

Your dynamic text boxes would then reference the global variables (_global.strNotes,_global.strDate, etc...).

With this method you can remove the actions you have placed on the movie clip.

Just because I haven't asked... you are returning name/value pairs from your asp right?

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top