Help with onClipEvent(load)

i want to be able to pass a parameter from my webpage into flash and i couldnt get it to work so i decided to put the parameter inside flash to start with to see if was a problem on my end and it still didn’t work. can somebody please tell me what i am doing wrong and where this code should go.

[AS]
onClipEvent(load)
{set (hello, 1);
if (hello==“1”)
{
gotoAndPlay(104)
}
}

[/AS]

To pass a variable to the Flash movie, check out this TechNote: http://www.macromedia.com/support/flash/ts/documents/flashvars.htm.

By the way, the correct sintax would be:
[AS]set(“hello”, 1);
// you don’t need the set action though
// hello = 1; would do
if (hello == 1) {
gotoAndPlay(104);
}[/AS]

sorry but i still have the same problem. where exactly should i put the actionscript? my new actionscript looks like this:

[AS]
onClipEvent (load)

{
set(“hello”, 1);

if (hello == 1)
	{

gotoAndPlay(104)
}
}
[/AS]

The onClipEvent handler is only supported by MovieClip instances, which means that you’d have to put that code on the MovieClip actions.

What do you want to do exactly?

yeah ive put it in a white movieclip hidden in the bottom right of my movie. what i want to do is have it so that once a person has already been to my site they can automatically skip the intro without having to click skip intro again.

You’d be better off using a Shared Object, I think. :-\

http://www.macromedia.com/support/flash/ts/documents/local_so.htm

using a shared object would be good except i cant even get the frame to skip to frame 104 in the first place. i got rid of the parameter and it still doesn’t work, what am i doing wrong???

[AS]
onClipEvent (load)
{
gotoAndPlay(104)
}
[/AS]

put this on the frame instead

onEnterFrame = function() {
_root.hello = true;
if(_root.hello == true) {
_root.whateveryouwanttogoto104.gotoAndPlay(104)
}
}

sorry Yeldarb but your advice didn’t help either, what do i put where you have said whateveryouwanttogoto104. do i write scene1 or something else there?

[AS]var visitRecord_so = SharedObject.getLocal(“visitRecord”);
if (visitRecord_so.data.visited) {
this.gotoAndPlay(104);
} else {
visitRecord_so.data.visited = true;
visitRecord_so.flush();
}[/AS]
Just put that code on the Frame actions… :sigh:

[AS]var myLocalSO = sharedobject.getLocal(“flashcookie”);
if (myLocalSO.data.counter == 1) {
this.gotoAndPlay(104);
} else {
myLocalSO.data.counter = 1;
}
stop();[/AS]

[edit] kax beat me :stuck_out_tongue: [/edit]

Yeah, I’m faster than you. :bad:

And your code is wrong… you must save the data by using the SharedObject.flush method. :stuck_out_tongue:

Hmmm technically i dont think my code is wrong… since i didnt use the flush method, Flash will only write the shared object to a file when the browser is closed.
And i think that will work for him, since he wants the code for detecting previous visits.
Am i right?
:-\ :stuck_out_tongue:

Good point. Who cares anyway!? I’m still faster!! :stuck_out_tongue:

[SIZE=1]No more useless posts. :x[/SIZE]

Yup, ive always known you were faster :stuck_out_tongue:

kax and claudio, both of your scripts work when i do preview in the macromedia MX flash player, however when i preview it in my browser the scripts do not work, do u know if there is anyway in which i can fix this.

Hmm im sure it works on the browser :-\

You’ve probably set the Local Storage to 0KB… ?
I’m not sure if that could be the reason, though. :stuck_out_tongue:

Hi,
I’m smiddy’s supervisor.
Smiddy would like to know how to execute code at the beginning of loading the flash movieclip.
We’ve tried putting the code:
this.gotoAndPlay(104);
in the Actions for Frame 1 of Layer Name skip intro area.
However this doesn’t seem to run.
We are not concerned with the cookie, or anything else as we will pass this in via a querystring eg ?gotopage=104 or similar, we just want the code to execute as soon as it loads.
Any ideas?
Thanks,
Smiddy2

I dont get it… if you want to check if the user has visit your site before, use the previous code me and kax provided.
Both works fine on browser.
:sigh: