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

kglad
Community Expert
Community Expert
November 22, 2007
show the code you used using the attach code option.
kglad
Community Expert
Community Expert
November 20, 2007
that would be one solution.

you can use the visible property of display objects to disable and enable your English button.
Participating Frequently
November 21, 2007
and I'll be able to do as you said by:
lowering the alpha on the english button that I just inserted on the same frame as the MC starts?
Participating Frequently
November 21, 2007
i did what i just explained and it gave me the same 1120 error.. =/
kglad
Community Expert
Community Expert
November 20, 2007
if English doesn't exist when that frame executes, you'll have a problem. your code that references english should execute after English is instantiated.
Participating Frequently
November 20, 2007
so basically, I should create a button layer on my main timeline and add the English button there and make it invisible? if so, can you please tell me where I could find the code to make it invisible? :)
kglad
Community Expert
Community Expert
November 17, 2007
congrats ew!!

dobe, add a listener to your button that calls function that then executes your goto function.
Participating Frequently
November 19, 2007
kglad, thanks so much for your help....

i'm designing an all flash website, what is the best way to do it? should I have scenes and buttons that jump scenes OR should i have 4 layers, content button background and actions and convert each scene in a movieclip and put them all on individual frames on the content layer and use the action layer to "make it work"?? i'm going to have an intro, about 5 dropdown menus, and lots of pictures, it's a jewelery company's website... what is the best way to go with this?
thanks so much
Participating Frequently
November 20, 2007
Ok, I decided to go with layers on a single timeline...

However, I encountered a problem..

On frame 1 of my content layer is my movieclip: IntroL, at the end of IntroL movieclip the button english fades in and the movie clip stops.

I would like when the button english is pressed for the movie to go to frame 2 in my content layer and start playing the movieclip: Menu.

I put in this code on the actionscript layer I have on my main timeline on frame 1:

IntroL.play();
import flash.display.MovieClip;
import flash.events.IEventDispatcher;
English.addEventListener(MouseEvent.MOUSE_DOWN,sta rtMenu);
function startMenu(e:MouseEvent):void {
}
IntroL.stop();
Menu.play();

..... However, when I test the movie, All you see is IntroL's first frame looping itself... with the messages:
1120: Access of undefined property English.
and
English.addEventListener(MouseEvent.MOUSE_DOWN,sta rtMenu);......

I was also wondering if a part of this problem is that I didn't create a Button layer on the main timeline and inserted button: English there because I would like it to fade in when it's time has come..

can anyone help me debug??
November 16, 2007
Here's what I discovered. As each of the 5 buttons "comes in" they have a tween where they fade in. If I cut off all the frames at the final key-frame of the fade up and then place a new instance of that button (with no tween, as it's already now at 100%), and then use that as the instance, they all work perfectly.

of course, the #2 button is still working "the old way" and I don't understand why, but I am not gonna question it too much since it appears to be working!
November 16, 2007
kglad,

that worked perfectly. gave it a new name (newbut) and inserted it where I have been inserting the others all along. Somehow, I find it even MORE odd that it workes this time!

I can't figure out why my others don't work...the names appear to be correct...

Maybe I will just rebuild a few bits and see if that solves it. Can't wait for my classes!

Thanks!
kglad
Community Expert
Community Expert
November 16, 2007
remove your 3rd button and return to a working fla that has no compiler errors.

now, copy your 2nd button. paste it on-stage. give it a different (from your 2nd button) instance name. apply a listener to it. retest.
November 16, 2007
kglad,
mental button is the instance name of a button. I have set it up the same way as the other two that work.

Note that the files also breaks when I try another additional button (also set up like the first 2), not just on mentalbut. Regardless of whichever 3rd button I am working with, I get the same result.
kglad
Community Expert
Community Expert
November 16, 2007
you already had a funciton named onMentalClick. now, you have more than one.

read my previous message.
kglad
Community Expert
Community Expert
November 15, 2007
flash doesn't think mentalbut is an interactivedisplayobject.

what kind of object is mentalbut? do you use that name somewhere else in your code (eg, as a variable name or a function name)?