Skip to main content
Known Participant
November 13, 2007
Question

Why error message?

  • November 13, 2007
  • 42 replies
  • 2873 views
I am attempting to learn to do in Flash some things I have typically done in Director. Needless to say, it's been a tough go. I have been using some of the Lynda.com stuff and it's been helpful, but I now have a problem I can't figure out. I am using a script that Lynda.com uses in their tutorial movies. I copied it (except using my names for things, of course) and from what I can tell, I did it correctly, but I keep getting an error message. Here is my action script (in it's own layer):

stop();

function onIntroClick(evt:MouseEvent):void {
gotoAndStop("intro");
}
introbut2jpg.addEventListener(MouseEvent.CLICK, onIntroClick);

It's just a graphic I turned into a button that should jump to the frame labeled "intro" and stop there. Works great in the tutorial, but I get:

Location: Scene = Scene 1, layer = Actions, frame=39, Line 3
Description: The class or interface 'MouseEvent' could not be loaded.
Source: function onIntroClick(evt:MouseEvent):void {
This topic has been closed for replies.

42 replies

eddiwill9Author
Known Participant
November 13, 2007
Yes! That works great! I am still so new that I don't really understand WHY it works-- that's going to take some time and experience--and help, of course!

I have also learned that if I have a stop action in the timeline BEFORE this script, this second script doesn't work. I guess stop really means "stop!" But moving it to a point at the same time as the stop action seems to be fine. Is that the best way to do it? I basically had the playback stop right after the buttons and all of the other graphics come on stage and just "wait" for the user to select a button.
kglad
Community Expert
Community Expert
November 13, 2007
that script is almost the same as yours. it would replace your script.

use the trace() function to debug your code. place a trace() funciton on onIntroClick to make sure you function is being called. place a trace() on your "intro" frame.
eddiwill9Author
Known Participant
November 13, 2007
Thanks again, but I must be more dense than usual this a.m.

Based on what I saw in the Lynda.com stuff (sorry-- all I have to go on at this point), I made a layer just to contain scripts and called it "Actions."

I have another layer called "movies" where I have 5 sections of frames (instead of frame numbers) labeled for each of the short clips I want to play. I have 5 buttons to click to get to the movies. I was just going to get this first button to work, (intro_butjpg, which should jump to the section of frames called "intro") and then copy and paste--and change accordingly-- for the other 4 buttons.

I am not sure where your new script should go.
eddiwill9Author
Known Participant
November 13, 2007
I think I figured it out.. I had not named the instance of the button (I feel like I have to name things 3 or 4 times in 3 or 4 places-- haven't gotten the hang of it quite yet!).

Now the movie tests with no errors, but it doesn't appear to do what I have asked it to do, namely go to the frames labeled "intro" and play the movie I have there.

I'll keep messing with it and see if I can post the correct question for that problem.
kglad
Community Expert
Community Expert
November 13, 2007
"intro" needs to be the label of a frame in the timeline that contains that code. and it's best to use the goto methods, NOT the goto functions:

kglad
Community Expert
Community Expert
November 13, 2007
there's some other code causing that problem. copy and paste it using the attach code option.
eddiwill9Author
Known Participant
November 13, 2007
Here it is. Not sure I did that correctly (attaching)
eddiwill9Author
Known Participant
November 13, 2007
So close.....

Switching to the as3 component killed that error message, but still having trouble with my original script (the button).

Now it says:
Description: 1120: Access of undefined property intro_butjpg.
kglad
Community Expert
Community Expert
November 13, 2007
you're welcome.
eddiwill9Author
Known Participant
November 13, 2007
kglad,

I can not thank you enough. I haven't had to learn something from the ground up in years and help from folks like you is invaluable.

I will give it a shot now.
kglad
Community Expert
Community Expert
November 13, 2007
when you had your publish settings set at as2, you added an flvplayback component. delete that from your library. while your publish settings are set at as3, add an flvplayback component. retest.

(while the two components look the same, they are not. as2 components will not work in as3. flash changes your component library when you change your publish settings so you can't pick the wrong component version (unless you change your publish settings).
eddiwill9Author
Known Participant
November 13, 2007
Wow! That was fast! Thank you so much-- it fixed it!

BUT, I now have a new error (of course!):
WARNING: The component 'FLVPlayback' requires ActionScript 2.0.

I am guessing this is the movie that I have in place that should play when it goes to that frame. Is there an easy way around this?

Sorry for what must be very basic questions-- been awhile since I've been such a newb!