PDA

View Full Version : Senceless Actionscript Woes...


Scripter101
12-20-2005, 02:18 AM
Ok I would really appreciate someone shining a light on my probably very newbular problem. NOW, I started using flash 7 and upgraded recently to Flash pro 8. Im trying to get an effect of motion with actionscript. Im a pretty heavy flash user just not too big on motion with code yet :(

I am trying to complete the Easing menu tutorial located on here, this is the link if your unfamiliar.

http://www.actionscripts.org/tutorials/intermediate/Easing_Menu_System/index.shtml

HERE is my question. I have read multiple tutorials that use

onClipEvent (load) {
}
and
onClipEvent (enterFrame) {
}

yet everytime I try to use them, flash tells me I have errors, like its formatted wrong, how can it be formatted wrong if my Actionscript 2.0 dictionary says the same thing. Now the way I was taught was to define it in either a relative path like this.onEnterFrame = function or absolute _root etc etc..

how am i supposed to follow a tutorial when the code they supply and explain will work isnt working? Or am I not understanding a simple thing? Any help or even someone that can point me in the right direction would be very helpful, thanks.

Rossman
12-20-2005, 03:54 AM
My gut tells me that onClipEvent stuff isn't cool code anymore, but I could be wrong.

Paerez
12-20-2005, 03:55 AM
if you see something like:
this.onEnterFrame
it should go on an instantiated object, or on the root script and reference another object (myMC.onEnterFrame).

If you see
onClipEvent(load) {
}

it has to go on the object on the stage. This is done by clicking the object and opening the AS panel.

Here is a demo of the two ways of doing it:

Paerez
12-20-2005, 03:56 AM
Rossman: True, it isn't as cool, cause it breaks up your code into a lot of places, instead of one big script, but I like putting the on(click) on buttons, cause then it is easy to find out what the button does: you click it in the IDE and open the AS panel and boom, there is what it does.

Headshotz
12-20-2005, 09:00 AM
No, onClipEvent is so not cool :p

Use the frame and have:


//You dont need any load thingy here, just set your variables
speed = 3;
myMC.onEnterFrame = function() {
//Script where the onClipEventEnterFrame stuff used to go now goes here
};
//So much cooler than AS1 ;)

Scripter101
12-20-2005, 03:34 PM
if you see something like:
If you see
onClipEvent(load) {
}

it has to go on the object on the stage. This is done by clicking the object and opening the AS panel.

Here is a demo of the two ways of doing it:

shweet, jus wat i needed to hear... Thanks

Headshotz
12-20-2005, 09:00 PM
Oh, I didnt notice the fla file :p