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

Participating Frequently
November 15, 2007
Hi Buntu, Thanks for the input. The frames appear to be correctly labeled. As to running the trace statement, as kglad has discovered, I am in WAY over my head, without the proper foundation (which is coming, I hope, by way of a class in a few weeks) and so, I would need to know "exactly" where to place that script to make it work. Being a newb is a real drag...
Participant
November 16, 2007
Hi eddiwil9

Put a trace statement like this

That way you will know that the button is being fired when you click it. If it's not fired then the instance name of the button is not right. Let me know if this works out for you. :)

Buntu.
November 16, 2007
Buntu,

I removed all other as from the file and cut and pasted yours in.

This is the resulting error:

1021: Duplicate function definition.
Participant
November 14, 2007
Hi,

Check the frame whether it has a label "mental" and also whether or not the button is being clicked. Put a trace statement in your onMentalClick function; something like trace("mentalbut clicked");

Participating Frequently
November 14, 2007
Here is the code for all 3 buttons playing the flvs:

stop();
var tl:MovieClip = this;
function onIntroClick(evt:MouseEvent):void {
tl.gotoAndStop("intro");
}
intro_butjpg.addEventListener(MouseEvent.CLICK, onIntroClick);


stop();
function onTeachingClick(evt:MouseEvent):void {
tl.gotoAndStop("teaching");
}
teachbut.addEventListener(MouseEvent.CLICK, onTeachingClick);


stop();
function onMentalClick(evt:MouseEvent):void {
tl.gotoAndStop("mental");
}
mentalbut.addEventListener(MouseEvent.CLICK, onMentalClick);
________

I don't understand why it works with 1, then with 2, but not with 3.
Participating Frequently
November 14, 2007
Testing this out, looks like a great solution!

I see the as for the _visible property, but it won't let me apply to a component.

The SkinAutoHide parameter works OK, unless the user mouses over the player area before they click the button. (I can fix that by setting it off stage in the beginning)

EDIT: I think I understand-- I should apply the as for the _visible property in the timeline. Is that right?

I just need to figure out how that is expressed. I realize I am in way over my head and that I MUST learn the structures of the as. Preferably, without someone breathing down my neck for thi sproject!
kglad
Community Expert
Community Expert
November 14, 2007
if you're using the flvplayback on your main timeline, from your library drag an flvplayback symbol to the first frame of your main timeline. give it an instance name. add a frame at the end of your main timeline so your flvplayback instance exists in all frame of your main timeline.

now, you can use its _visible property in any frames where you don't want it to be visible and you can use its start() and stop() methods to start and stop playback and you can use its contentPath property to specify the flv to play.
Participating Frequently
November 14, 2007
Thanks-- I'll try that now.
Participating Frequently
November 14, 2007
Great; I thought that might be the case.

Is there a way that's fairly easy for a beginner to accomplish this (other than using different flvplayback instances?).

Oh well, learning how NOT to do something is also pretty important! :)

kglad
Community Expert
Community Expert
November 14, 2007
then you have different flvplayback instances and you can't use actionscript to control them unless you reference their instance names whenever and whereever you want to stop the play of one instance and start the play of another.

Participating Frequently
November 14, 2007
That's the only code I have (duplicated per each button/flv), sending it to the labeled area on each button click. Then I just use the component parameters to select which flv should be playing for that particular instance of the flvplayback.
kglad
Community Expert
Community Expert
November 14, 2007
no, that's not going to work.

show the code you use to start your flvplayback instance playing a flv.
Participating Frequently
November 14, 2007
I have the stop()method starting each as for each button click, :
____________
stop();
function onTeachingClick(evt:MouseEvent):void {
tl.gotoAndStop("teaching");
}
teaching_nav.addEventListener(MouseEvent.CLICK, onTeachingClick);
__________
but no as at all on the actual component instance itself. If I placed a stop() there, will it play anything at all?

I just placed a stop() at the beginning of one of the instances-- it didn't do anything. My error, I 'm sure!