garion1
01-04-2008, 02:51 PM
Hi. I have the following code:
proceedBut.addEventListener(MouseEvent.CLICK, myLink);
function myLink(event: MouseEvent) {
var linkMain:URLRequest = new URLRequest("http://www.myURL/home.html");
navigateToURL(linkMain,"_self");
}
If I place a Movie Clip on my stage, give it the instance name "proceedBut" and place the above code on the same frame of my timeline, it works perfectly.
If I am using the document class 'Main.as', where does this code appear in the package?
When I do this:
package {
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
public class Main extends Sprite {
public function Main() {
proceedBut.addEventListener(MouseEvent.CLICK, myLink);
function myLink(event: MouseEvent) {
var linkMain:URLRequest = new URLRequest("http://www.myURL/home.html");
navigateToURL(linkMain,"_self");
}
}
}
}
I get the error:
1046: Type was not found or was not a compile-time constant: MouseEvent.
Please help
proceedBut.addEventListener(MouseEvent.CLICK, myLink);
function myLink(event: MouseEvent) {
var linkMain:URLRequest = new URLRequest("http://www.myURL/home.html");
navigateToURL(linkMain,"_self");
}
If I place a Movie Clip on my stage, give it the instance name "proceedBut" and place the above code on the same frame of my timeline, it works perfectly.
If I am using the document class 'Main.as', where does this code appear in the package?
When I do this:
package {
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
public class Main extends Sprite {
public function Main() {
proceedBut.addEventListener(MouseEvent.CLICK, myLink);
function myLink(event: MouseEvent) {
var linkMain:URLRequest = new URLRequest("http://www.myURL/home.html");
navigateToURL(linkMain,"_self");
}
}
}
}
I get the error:
1046: Type was not found or was not a compile-time constant: MouseEvent.
Please help