# Fuction call (trivial)

**URL:** <https://forum.kirupa.com/t/fuction-call-trivial/117557>\
**Category:** Uncategorized\
**Created:** [July 28, 2004, 12:25pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557 "2004-07-28T12:25:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 12:25pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/1 "2004-07-28T12:25:40Z")

</div>

I have a trivial problem, how do I call up a function from a specific frame within a MC?

onClipEvent(enterFrame(20)) -\> seemed logical but doesn’t work ☹

thanks, cheers 😃

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 12:28pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/2 "2004-07-28T12:28:37Z")

</div>

do you mean:  
[AS]  
onClipEvent(enterFrame) {  
gotoAndPlay(20);  
}  
[/AS]  
?

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 12:33pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/3 "2004-07-28T12:33:06Z")

</div>

Yoi misunderstood, I was probably too vague…

I have a MC, now, I want it to trigger my **visibleTrue** function (that makes my butons visible) on the frame 20

-\> MC plays -\> hits frame 30 -\> calls visibleTrue()

I believe this should clarify things, thx for the reply anyway

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 12:47pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/4 "2004-07-28T12:47:36Z")

</div>

Hopefully I understood you better this time. Perhaps it could be something like this:

[AS]  
onClipEvent(enterFrame) {  
if (this.\_currentframe == 20) {  
visibleTrue();  
delete.this.onEnterFrame;  
}  
}  
[/AS]

Code not tested, and beware, I’m not an expert 😉

---

<div class="post-metadata">

**Author:** ![bobdoe](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bobdoe](https://forum.kirupa.com/u/bobdoe)\
**Post date:** [July 28, 2004, 12:49pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/5 "2004-07-28T12:49:17Z")

</div>

oh nm…what sintax said.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 28, 2004, 12:51pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/6 "2004-07-28T12:51:02Z")

</div>

if (this.\_currentframe == 20) { is right, but delete.this.onEnterFrame; wont work for onClipEvent(enterFrame) events (onEnterFrame and onClipEvent(enterFrame) are two completely different processes).

It probably wont do any harm to leave an onClipEvent(enterFrame) running so long as it only has that simple if statement in it for frame 20. Otherwise use the onEnterFrame option

```auto
clipName.onEnterFrame = function() {
  if (this._currentframe == 20) {
    visibleTrue();
    delete.this.onEnterFrame;
  }
}

```

Of course the best solution would be just to put a call in frame 20 of the clip if possible 😉

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 12:53pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/7 "2004-07-28T12:53:32Z")

</div>

> [@senocular](#):
>
> if (this.\_currentframe == 20) { is right, but delete.this.onEnterFrame; wont work for onClipEvent(enterFrame) events (onEnterFrame and onClipEvent(enterFrame) are two completely different processes).

Good you mention it 🙂 Didn’t knew that 😉 But now I do…

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 12:57pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/8 "2004-07-28T12:57:21Z")

</div>

> [@senocular](#):
>
> Of course the best solution would be just to put a call in frame 20 of the clip if possible 😉

That was my first try, but it didn’t work…

will try this  
thanks people

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 1:05pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/9 "2004-07-28T13:05:20Z")

</div>

khmmm…

where exactly do I put this piece of code.

BTW -\> error -\> one ‘.’ too much (dunno why), don’t really understand why you delete whatever you are deleting?

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 1:10pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/10 "2004-07-28T13:10:23Z")

</div>

You can just use this code:

[AS]onClipEvent(enterFrame) {  
if (this.\_currentframe == 20) {  
visibleTrue();  
}  
}  
[/AS]

Put it on the movieClip you want to control with it…

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 28, 2004, 1:13pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/11 "2004-07-28T13:13:56Z")

</div>

oh yeah, the delete should have a space after it, not a . - typo

delete this.onEnterFrame;

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 1:26pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/12 "2004-07-28T13:26:10Z")

</div>

Nope, just won’t do…

I don’t know why, I’ve put several frames, just wont call it, the function works when i call it from any button or from the main timeline directly…

I’ve jut tried putting a marker so it only runs once and the trace comes out clean just after the function call, but it doesnt go into the function (I have a trace there too)…

It just won’t CALL IT! The call executes but it seems to do nothing. I’ve double checked the names, don’t know what else there is…

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 1:41pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/13 "2004-07-28T13:41:18Z")

</div>

[AS]  
onClipEvent(enterFrame) {  
if (this.\_currentframe == 20) {  
\_root.visibleTrue();  
}  
}  
[/AS]

Perhaps if you use my code, add the ‘\_root’ element?

Senoculars code should work perfectly i guess…

[AS]  
clipName.onEnterFrame = function() {  
if (this.\_currentframe == 20) {  
visibleTrue();  
delete this.onEnterFrame;  
}  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 2:36pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/14 "2004-07-28T14:36:15Z")

</div>

Ok that solve d the getting into the function 😃 (I thought functions could be called from wherever…) -\> thanks

BUT it doesn’t solve the problem, it gets into the function but does not execute it, let me show you some code…

[AS]  
// **first frame**  
//this is just so the call of the fuction doesn’t repeat  
\_root.globalMarker = 1;

//UNvisible  
function visibleFalse() {  
logo\_mc.\_visible = logo.\_visible = false;  
stat\_mc.\_visible = stat.\_visible = false;  
vector\_mc.\_visible = vector.\_visible = false;  
flash\_mc.\_visible = flash.\_visible = false;  
play\_mc.\_visible = play1.\_visible = false;  
pack\_mc.\_visible = pack.\_visible = false;  
interface\_mc.\_visible = interface1.\_visible = false;  
graphic\_mc.\_visible = graphic.\_visible = false;  
web\_mc.\_visible = web.\_visible = false;  
other\_mc.\_visible = other.\_visible = false;  
}

//making it unvisible at start  
visibleFalse();

//visible  
function visibleTrue() {  
logo\_mc.\_visible = logo.\_visible = true;  
stat\_mc.\_visible = stat.\_visible = true;  
vector\_mc.\_visible = vector.\_visible = true;  
flash\_mc.\_visible = flash.\_visible = true;  
play\_mc.\_visible = play1.\_visible = true;  
pack\_mc.\_visible = pack.\_visible = true;  
interface\_mc.\_visible = interface1.\_visible = true;  
graphic\_mc.\_visible = graphic.\_visible = true;  
web\_mc.\_visible = web.\_visible = true;  
other\_mc.\_visible = other.\_visible = true;  
trace(“id”);  
}  
[/AS]

and on the clip  
[AS]  
onClipEvent(enterFrame) {  
if (this.\_currentframe == 20) {  
if(\_root.globalMarker == 1){  
\_root.visibleTrue();  
\_root.globalMarker = 0;  
}  
}  
}  
[/AS]

**PS: I SUCK**

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 2:47pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/15 "2004-07-28T14:47:38Z")

</div>

> [@JosipRadan](#):
>
> if(\_root.glM == 1)

Shouldn’t this be  
[AS]  
if(\_root.globalMarker == 1) {  
[/AS]

Or is this glM another variable?

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 2:50pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/16 "2004-07-28T14:50:51Z")

</div>

Yes sorry, it isn’t in the code I’ve renamed all the glM to globalMarker so you would understand easier, sorry about that -\> its not an error, I’ll edit it so it doesn’t cause any more confusion

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 2:56pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/17 "2004-07-28T14:56:43Z")

</div>

What’s with that “logo\_mc.\_visible = logo.\_visible = true;”, the instance names ‘logo\_mc’ and ‘logo’?

Maybe you’ll need to change it to:  
[AS]  
logo\_mc.\_visible = true;  
[/AS]

I just don’t get the point :h:

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 3:30pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/18 "2004-07-28T15:30:57Z")

</div>

Ok I see I’m confusing everyone (because of the lack of knowlegle probably)…

could you look up the FLA, I’ve simplified it, removed everything but the problem itself -\> thanks

cheers

---

<div class="post-metadata">

**Author:** ![sintax](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sintax](https://forum.kirupa.com/u/sintax)\
**Post date:** [July 28, 2004, 4:09pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/19 "2004-07-28T16:09:16Z")

</div>

I’ve taken a look at your fla, but I still can’t quite figure out what the purpose is. Can you briefly explain (again?) what’s not working, and what should be changed so it works…

---

<div class="post-metadata">

**Author:** ![JosipRadan](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JosipRadan](https://forum.kirupa.com/u/JosipRadan)\
**Post date:** [July 28, 2004, 5:20pm UTC](https://forum.kirupa.com/t/fuction-call-trivial/117557/20 "2004-07-28T17:20:11Z")

</div>

First of all thanks for helping me out! I know I’m a pain in the \*\*\* 😃

Here goes:  
-I’ve created some obviously too complex navigation for my site  
-I have a button for the portfolio which has two types of animation (2 seperate masked MCs) one is for rollOver & rollOut and the other is for press

-the one for press is what bugs me, it “drops down” from the button (this is the second masked MC)

-apart from this I have buttons positioned where the MC scrolls down which are not visible (\_visible = false)

-\>I want to enable those buttons when my animation completes, when that “drop-down” (masked MC)

competes (on frame 20), I want to call a function that enables those buttons…

* * *

Does this clarify? If you don’t understand something please say (my english isn’t that good, that is probably the biggest problem)

cheers

[Next page](https://forum.kirupa.com/t/fuction-call-trivial/117557.md?page=2)
