Fuction call (trivial)

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

thanks, cheers :smiley:

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

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

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

oh nm…what sintax said.

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

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

Good you mention it :slight_smile: Didn’t knew that :wink: But now I do…

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

will try this
thanks people

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?

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…

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

delete this.onEnterFrame;

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…

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

Ok that solve d the getting into the function :smiley: (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

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

Or is this glM another variable?

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

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:

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

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…

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

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