# Help with onClipEvent(load)

**URL:** <https://forum.kirupa.com/t/help-with-onclipevent-load/28560>\
**Category:** Uncategorized\
**Created:** [August 15, 2003, 12:27am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560 "2003-08-15T00:27:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![smiddy](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@smiddy](https://forum.kirupa.com/u/smiddy)\
**Post date:** [August 15, 2003, 12:27am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/1 "2003-08-15T00:27:00Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 12:43am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/2 "2003-08-15T00:43:36Z")

</div>

To pass a variable to the Flash movie, check out this TechNote: [http://www.macromedia.com/support/flash/ts/documents/flashvars.htm](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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 1:05am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/3 "2003-08-15T01:05:29Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 1:21am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/4 "2003-08-15T01:21:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 1:27am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/5 "2003-08-15T01:27:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 1:34am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/6 "2003-08-15T01:34:21Z")

</div>

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

[http://www.macromedia.com/support/flash/ts/documents/local\_so.htm](http://www.macromedia.com/support/flash/ts/documents/local_so.htm)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 2:42am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/7 "2003-08-15T02:42:49Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:16am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/8 "2003-08-15T03:16:39Z")

</div>

put this on the frame instead

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:30am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/9 "2003-08-15T03:30:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:42am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/10 "2003-08-15T03:42:46Z")

</div>

[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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:45am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/11 "2003-08-15T03:45:34Z")

</div>

[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 😛 [/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:49am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/12 "2003-08-15T03:49:20Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 3:57am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/13 "2003-08-15T03:57:50Z")

</div>

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?  
:-\ 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:04am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/14 "2003-08-15T04:04:40Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:06am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/15 "2003-08-15T04:06:35Z")

</div>

Yup, ive always known you were faster 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:10am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/16 "2003-08-15T04:10:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:13am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/17 "2003-08-15T04:13:21Z")

</div>

Hmm im sure it works on the browser :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:24am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/18 "2003-08-15T04:24:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:30am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/19 "2003-08-15T04:30:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 15, 2003, 4:41am UTC](https://forum.kirupa.com/t/help-with-onclipevent-load/28560/20 "2003-08-15T04:41:42Z")

</div>

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:
