FORUMS: list search recent posts

Button to URL Action Error

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Charlie Meadows
Button to URL Action Error
on Dec 2, 2009 at 4:38:44 pm

I'm trying to code a simple Flash CS3 button to nav to a URL -- and I seem to have all the bugs worked out but one. Here's the code I'm using (there are 5 buttons on the Flash site page I'm building, but I'm only as far as perfecting the code for the first one):


my_button.addEventListener(MouseEvent.CLICK,clickHandler1);
function clickHandler1(event:MouseEvent):void{
navigateToURL(new URLRequest("http://www.outside_URL.com"),"_self");
}


The error I'm getting when I publish the page is:


Line 2 > The class or interface 'MouseEvent' could not be loaded.


Return to posts index

Marcus Geduld
Re: Button to URL Action Error
on Dec 2, 2009 at 5:41:17 pm

Unless your code is on the Timeline, you have to import the MouseEvent class:

import flash.events.MouseEvent;

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index

Charlie Meadows
Re: Button to URL Action Error
on Dec 2, 2009 at 5:54:15 pm

Sorry to be thick about this -- obviously, I'm not very experienced at AS.

The Action is assigned its own line in the Timeline -- unless I'm misunderstanding what you mean, there. Also -- where/how do I implement the "import" command in the code, if I need to? What would that look like in the AS stream?

Thanks again for your help.


Return to posts index


Marcus Geduld
Re: Button to URL Action Error
on Dec 3, 2009 at 6:10:58 pm

I'm not sure why you're getting an error. You don't need to import if your code is on the Timeline.

I just tried your code and it worked for me, so maybe it's something to do with the way you've set up the file.

Here's my version: http://www.grumblebee.com/stuff/cow/oneButton.fla

Maybe if you compare it to yours, you'll be able to figure out the problem.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]