PDA

View Full Version : Skip intro help



ladyorelinde
June 15th, 2009, 10:07 AM
I need a skip intro link in my movie that, when clicked, goes to the last frame of the movie and plays it.

I've tried almost everything I've found on the internet but nothing is working. Can someone please help me out with this?

BoppreH
June 15th, 2009, 10:11 AM
MovieClip(root).gotoAndStop(totalFrames)

It'll send the root movie to the last frame and stop there. It'll play anything that is inside that frame, though.

ladyorelinde
June 15th, 2009, 11:05 AM
MovieClip(root).gotoAndStop(totalFrames)

It'll send the root movie to the last frame and stop there. It'll play anything that is inside that frame, though.


Thanks for the info, but I'm not sure what frame this is supposed to be put in....how do I associate it with my "skip intro" text that's on my stage?

I don't want it to go to and stop...I definitely want it to go to and play because I have an action in the last frame that leads into my site. So if I want it to go to and play frame 100 for ex., where do I put the 100...where you have (totalFrames)?

Thanks

BoppreH
June 15th, 2009, 11:48 AM
Thanks for the info, but I'm not sure what frame this is supposed to be put in....how do I associate it with my "skip intro" text that's on my stage?
To associate this code with a display object (be it a button, text or movie clip), use the following code:

myObjet.addEventListener(MouseEvent.CLICK, gotoEnd)

function gotoEnd(e:MouseEvent) {
MovieClip(root).gotoAndPlay(100)
}


I don't want it to go to and stop...I definitely want it to go to and play because I have an action in the last frame that leads into my site. So if I want it to go to and play frame 100 for ex., where do I put the 100...where you have (totalFrames)?

Thanks
Exactly. You can use gotoAndPlay instead of gotoAndStop and change the "totalFrames" by any number o frame label you want.

ladyorelinde
June 15th, 2009, 01:25 PM
To associate this code with a display object (be it a button, text or movie clip), use the following code:
ActionScript Code:

myObjet.addEventListener(MouseEvent.CLICK, gotoEnd)

function gotoEnd(e:MouseEvent) {
MovieClip(root).gotoAndPlay(100)
}




Firstly, I am very grateful for your willingness to try and help me learn this, so, thank you. But here's my dilemma, I am really a newbie at AS3 and am not quite sure where any of what you've written goes.

Currently, the only actions I have are in the actions layer in the first frame and in the last frame. The graphic that says "skip" is on a completely different layer. Currently, I have it set as a button, but that's not necessary, I can change it to anything. However, as a button, in AS3, you are not allowed to enter any scripts inside a button...I don't know why. So, let's say I change it to an MC. Where would your code (quoted above) go? What frame and what layer do I put it on? It can only go on the actions layer correct?

I tried putting it on the first frame of the actions layer and all that happened was a cursor hand showed over the MC but when I clicked, nothing happened. Am I doing something wrong?




Exactly. You can use gotoAndPlay instead of gotoAndStop and change the "totalFrames" by any number o frame label you want.

Maybe this is the part that I'm lost on. We have a large intro that goes up to 1124 frames, which is what I have the skip set to according to your direction....but alas...it does not work. :(

Help!? :)

BoppreH
June 15th, 2009, 01:49 PM
In AS3, you have to options to place the code: inside the frames or inside a document class, that is a separated .as file with only the code. For now, let's go for frames.

First, select a frame. It does not have to be in the same layer as the button, but you must be able to see your button somewhere in stage (unless you use alpha, it's covered by something, etc. But you got the idea, it must be present).

Then open the actions panel of that frame by pressing F9 or right click -> Actions. Paste the code and replace the needed variables.


myObject.addEventListener(MouseEvent.CLICK, gotoEnd)

function gotoEnd(e:MouseEvent) {
MovieClip(root).gotoAndPlay(100)
}
Explanation:

myObject.addEventListener(MouseEvent.CLICK, gotoEnd) - it binds any click on the button the "gotoEnd" function. It is, this function will be called when the user clicks the myObject (replace with the actual button name).


function gotoEnd(e:MouseEvent) {
} - it states a function, that is a little piece of reusable code. But in this case it's required by the event system, no matter if we will reuse it or not.


MovieClip(root).gotoAndPlay(100) - the first part gets the root property, that is, the timeline, and states that it wants the timeline to behave like a movie clip, since timelines are naturally sprites. The second part sends the player to the frame 100, or 1124, whatever number you put there.

ladyorelinde
June 15th, 2009, 02:03 PM
In AS3, you have to options to place the code: inside the frames or inside a document class, that is a separated .as file with only the code. For now, let's go for frames.

That was the first time anyone actually took the time to break something down and actually explain it to me.

I figured out there was another action in my first frame that I removed, that was causing the conflict in my button working. When I removed it, the button works perfectly now.

Thank you again, very...very much.

BoppreH
June 15th, 2009, 02:24 PM
That was the first time anyone actually took the time to break something down and actually explain it to me.

I figured out there was another action in my first frame that I removed, that was causing the conflict in my button working. When I removed it, the button works perfectly now.

Thank you again, very...very much.
The problem here is that it's hard to know what is the experience level of the person asking the question.

For someone migrating from AS2 to AS3, explaining what gotoAndStop() does is pontless, but for someone coming to AS altogether, it's completely new.

So, it's not that anyone here does not want or know how to explain things, it's just that sometimes we assume the person on the other side knows more (or less) than what he really does.