PDA

View Full Version : ActionScript Help



secrethatch
September 5th, 2002, 09:22 PM
Hi,

I'm creating a presentation in flash. I'm using the onmouse event command to move from frame to frame. But now I encountered a problem. This is how I have the menu button setup

Main Scene
-Main Menu 1 ( Movie Clip )
-Menu 1 ( Movie Clip )
-Button ( link to new frame in Main Scene )

There are no tweens used, because I've heard that you can't use tweens when you want the buttons to link to other parts of the scene. It works good, but only works in the editing area. The actionScript I'm using is as follows for that button.

on (release) {
gotoAndStop("Main Scene", 12);
}

Could somebody please help. I would appreciate all the help you can provide. I'm attaching the file so that you can see What I mean.

Thank you,

flex
September 5th, 2002, 09:49 PM
The easiest and tidiest way to jump to certain frames is to use frame labels. Instead of

on (release) {
gotoAndStop("Main Scene", 12);
}

Click on frame 12, in the frame properties, enter a name for the label, eg. "thispoint".

Then use for the action script:

on (release) {
gotoAndStop("thispoint");
}

If you can, post your fla.

flex
September 5th, 2002, 09:51 PM
I'm not sure also, as to what you mean by you've heard you can't use tweens if you want to link the other parts of the scene.

Also make sure the frame you want to goto is not inside a movie clip, if so the action script would have to point to that movie clip.

secrethatch
September 5th, 2002, 10:00 PM
i've attached the .fla to the original post,

That is what a friend of mines told me, but I'm not sure if that is possible or not.

if you can give me your email address and i can email it to you.

thank you for your help.

flex
September 5th, 2002, 10:30 PM
Check your private messages for my email address.

flex
September 6th, 2002, 12:23 AM
I've emailed you your fla - with modifications.

secrethatch
September 6th, 2002, 12:33 AM
I'm looking at it right now, i was reading the actionscript for the menu items, can I use the same script for the other menu items, and place something like this:

on (release) {
_root.gotoAndStop("cbombeable");
}

I would just apply a label and add that action to the next menu item.. right ?

I really appreciate your help, really i do

Thank you,

upuaut
September 6th, 2002, 12:38 AM
tweening... you can do that.. it's just a very tricky process.

flex
September 6th, 2002, 01:34 AM
Yes, on the frame labels layer, add a label and on the button use the action

on (release){
_root.gotoAndPlay("framelabel");
}

and it should go to that frame.

flex
September 6th, 2002, 01:39 AM
Cheers Dave but I prefer posting code in blue.

secrethatch
September 6th, 2002, 01:39 AM
I'm doing it right now, I've added already a couple of them, but It ends up going to the same concreto normal description, im gonna try something different this time and see what happens. Ill try what you just told me now

thanks,

flex
September 6th, 2002, 01:42 AM
Make sure on the new frame label, eg. say you want to put a frame label called "thiscompany" on frame 17, you click on the correct frame in the correct layer (frame labels) and press F7 to insert a blank keyframe, then type the label. Otherwise the frame you're on inherits from the last keyframe.

upuaut
September 6th, 2002, 01:46 AM
There are no tweens used, because I've heard that you can't use tweens when you want the buttons to link to other parts of the scene.

The problem with this obviously is that if you're in the middle of a tween, it will look strange if you seek a new section of a scene and the tween is not fluidly constructed between where the play head is, and where it's jumping too.

The three ways that I use to avoid that problem are:

1) use actionscript on movieclips to move them around. Most a/s movements can be done with an onClipEvent(){} and therefore never need more than one frame to exist in at a particular time. This is my preference, but if you're still wet behind the ears, you'll want to avoid this until you know a little about moving objects with a/s.
2) make sure, if you have an action which sends the play head to another frame, that the frame has every element, in the exact same locations, as the frame you're coming from. Usually this is accomplished with 'Copy/Paste Frames' options. This is the easiest way to solve the problem, but it adds file size to the movie.
3) use movie clips with tweens inside them, and have the buttons, in addition to sending the playhead of the main timeline somewhere, also start, or stop or gotoAndPlay the movie clips that need to animate.

secrethatch
September 6th, 2002, 01:46 AM
oh ok, i was getting that already, let me remove the frames...and re do it,

thanks,

flex
September 6th, 2002, 01:49 AM
Let me know how it works out.

secrethatch
September 6th, 2002, 02:26 AM
It's working !! yes yes yes !! thank you...

But I still have to get the tweening in there so I can have some movement on them. Im test that out once I'm done with this part. Thank you so much,

regards,

flex
September 6th, 2002, 02:33 AM
I still have your fla that I modified. Let me know what you wanted to do with the tweening.

secrethatch
September 6th, 2002, 02:38 AM
how did you do the tweening for the concreto normal link ? , Also Can I add a tween in between the 1st page of the menu and the 2nd page of the menu, like a fade in and fade out something like that... ?? I think I could do it without affecting the rest of the scene..

flex
September 6th, 2002, 02:56 AM
As your movie is now, it's harder to modify. You should try to seperate objects as much as you can by placing them in movie clips. This way you can change individual objects without changing the structure of the overall movie.

Let me have a quick look at the fla...

flex
September 6th, 2002, 03:02 AM
Actually I'm surprised how some of this fit's together! You should try and reorganise some stuff, before it's gets so that it's too difficult to reorganise.

secrethatch
September 6th, 2002, 03:04 AM
I was thinking the same thing, I dont know why I have so many items in the library.... i have alot of symbols, I'm organize them into folders so I can find it easier.

thanks for the tip,

thank you for you help,

regards,

flex
September 6th, 2002, 03:06 AM
What's even funnier is that I didn't do any tweening for the Concreto Normal section! You must have done it or acheived the fadein somehow. But I'm having a look now at tweening the two menus...

flex
September 6th, 2002, 03:07 AM
It's not so much the amount of symbols, it's just the main structure and organisation of the whole movie. Sorry to sound critical, but I'm telling you what will help you. It does look nice though, it's well presented and easy to read (apart from the Spanish!).

flex
September 6th, 2002, 03:24 AM
I've emailed you the new fla.

If you want a smoother fade in - lower the fade variable, to something lower that the current value (20).

If the fade in looks too slow, increase your frame rate.

secrethatch
September 6th, 2002, 03:28 AM
I've also emailed you what I did with .fla the menus are working now..

flex
September 6th, 2002, 03:29 AM
Have a go at changing the fade variable and frame rate like I mentioned just before your post. See what works best.

Your frame rate is very low. Change to at least 12.

secrethatch
September 6th, 2002, 03:40 AM
i changed the fps to 12, but the logo at the beginning starts moving too fast...can i control that speed separate from the rest of scene ??

flex
September 6th, 2002, 03:40 AM
Should be able to, let me have a look...

secrethatch
September 6th, 2002, 03:51 AM
ok i got the fades working....

flex
September 6th, 2002, 04:04 AM
I haven't seen the fla yet, but yes you can change the fps "on the fly", but is the scripting worthit just for what you want to acheive. It's normally for making sure movieclips play at different speed to each other, but for a fade effect wouldn't be feasable.

So now you've got the labels and the fades working. What setting did you use for the fades (or did you use another method)?

flex
September 6th, 2002, 04:08 AM
Take off the stop(); from the first frame's of the Detalle Menu's, because when you click on the link it goes to the new section and stops. You have to click on Descripcion to get the content up. This is not the case with Concreto Normal.

secrethatch
September 6th, 2002, 04:08 AM
In the properties I used the alpha and switched it to 0% and it works perfectly I gave it a 5 frame fade and it looks good, I'm adding some more text to it right now.

But the one I'm worried about is the animation at the beginning the concreto, S.A. logo it moves too fast, how can I lower the speed on that particular movie clip ?

thanks for all your help, I really do appreciate it

flex
September 6th, 2002, 04:10 AM
Where did you change the alpha from? I didn't use in the color mixer. If you click on the two main menus (the movie clips) and press F9 for actions, you should see the action script for the fade. Change the fade setting there, and the initial alpha if you want.

By the way - we both posted at the same time :cool:.

secrethatch
September 6th, 2002, 04:26 AM
i have to add the rest of the data to the presentation so I might take a little while to answer back, but so far everything is going good, I've done the changes you told me, except for the stop at the menu, I can't find it.

flex
September 6th, 2002, 04:40 AM
I've slowed down the logo and emailed you the fla. Instructions on how to speed it up or slow it down are in the email.

Next to your zoom drop down menu, there is a small icon of a triangle, a square and circle. If you hover your mouse over it, it will say "Edit Symbols". Pull down the menu and go to Detalle Menu F2. In the actions layer add a stop(); on frame 5.

Repeat the above but select, Detalle Menu 13. Put stops on all frames from 2 to 5 - first create a new layer actions, like the othes have. Do the same for Menu 14.

flex
September 6th, 2002, 06:50 AM
If you're still interested in playing different movie clips at different speeds check out this thread:

http://www.kirupaforum.com/showthread.php?s=&threadid=5101

secrethatch
September 6th, 2002, 07:26 AM
Thank you, im almost done with the presentation itself. I will email you a final to see how it turned out. Sorry for the time lapse but I needed some shuteye.

Thank you and kind regards,

Bezzer
September 6th, 2002, 09:32 AM
hrmmm this post seems popular hehe :)