PDA

View Full Version : [MX] problem with function



Felipe Bastos
July 17th, 2003, 01:30 PM
On the main timeline, layer as, I have the function goPage:

_root.C.anterior._visible=0;
function goPage (whichWay) {
_root.content.destinationFrame = _root.content._currentFrame+whichWay;
_root.content.alphaChange = -20;
_root.C.proximo._visible=(_root.content.destinatio nFrame<>1);
_root.C.anterior._visible=(_root.content.destinati onFrame<>_root.content._totalFrames);
//trace("function goPage OK");
updateAfterEvent;
}

On a movieclip (instance name "content") I set:

onClipEvent(load) {
stop();

}

onClipEvent(enterFrame) {
_root.C.frameatual = "( " + _root.content._currentframe;
_root.C.framestotal = "/ " + _root.content._totalframes + " )";
_alpha+=alphaChange;
if(_alpha<1) {
gotoAndStop(destinationFrame);
alphaChange=20;
_root.C.frameatual = "( " + _root.content._currentframe;
_root.C.framestotal = "/ " + _root.content._totalframes + " )";
}
if(_alpha>100) {
alphaChange=0;
}
}

on the btn "next" I set:

_root.goPage(+1);

on the "previous" btn:

_root.goPage(-1);

When I hit the next btn the content does not go to the next frame. It goes to the last one. I used this actions in another work and it works fine. What is happening here?

Thanks

Danneman
July 17th, 2003, 06:52 PM
Well, Im not sure, but you are sending "+1" to the goPage-function as a parameter.

Then, in goPage, you are adding "+1" to currentFrame, resulting in the expression:

currentFrame + +1

I mean, if you send "-1" that is a number (minus one), but if you are sending "+1" that is an expression (ADD one - not a simple one).

Try just sending "1" in the goPage-next call, and leave the "-1" in the goPage-previous call, and perhaps it will work.

Felipe Bastos
July 17th, 2003, 08:33 PM
I tried that but it doesnt work!
I think it might be something with the swf that is loaded into the movieclip.
Its has some layers with text, mcs, fotos, like a page of a book. And there are some actions and empty movieclips. Sometimes I think its misunderstanding something and cant go to the next frame stooping at the last one.
Thanks for helping!!!
Comeback if I find something else.
:)

[m]
July 18th, 2003, 08:34 PM
try
_root.C.anterior._visible=0;
function goPage (whichWay) {
_root.content.destinationFrame = _root.content._currentFrame+Number(whichWay);
_root.content.alphaChange = -20;
_root.C.proximo._visible=(_root.content.destinatio nFrame<>1);
_root.C.anterior._visible=(_root.content.destinati onFrame<>_root.content._totalFrames);
//trace("function goPage OK");
updateAfterEvent;
}

senocular
July 18th, 2003, 08:39 PM
one quick thing I noticed skimming

updateAfterEvent;

should be

updateAfterEvent();