Skip to main content
Participating Frequently
September 13, 2011
Question

Problems adding url link to buttons in action Script 3

  • September 13, 2011
  • 3 replies
  • 1751 views

each time I added it link 1 to the button on file i get these error messages-  

1046: Type was not found or was not a compile-time constant: link1.

1180: Call to a possibly undefined method link1.

Warning: 3594: exec is not a recognized method of the dynamic class RegExp. var r:Object = p.exec(s);  

This is the code I am using:   import flash.net.navigateToURL; import flash.net.URLRequest;  var link_one:link1;  link_one = new link1(); stage.addChild(link_one);  link_one.addEventListener(MouseEvent.CLICK, buttonClickHandler);  function buttonClickHandler(event:MouseEvent):void { var url:String = "http://www.masterpiececorp.com/ARMREF.htm"; var request:URLRequest = new URLRequest(url); navigateToURL(request); }    I have no other problems with link 3 or 4, just link 1  I still cannot get my urls link to movie clips on the flash  

Can you upload flash here? if not I have a image capture I can use to have you look at my buttons  and action script code. i have been to every forum I know and not any have been helpful at all. This is my last hope.

Very frustrated newbie  Gina T

Message was edited by: gtaylor0406

This topic has been closed for replies.

3 replies

Participating Frequently
September 14, 2011

Hello I am still getting these error codes-

Call to a possibly undefined method addEventListener through a reference with static type Class.

http://depositfiles.com/files/bhv9egije Warning: 3594: exec is not a recognized method of the dynamic class RegExp.

I am getting these error codes  I inserted the link where my flash file is. Maybe  I  can show what errors are there.

Thanks   Gina Taylor

Participating Frequently
September 14, 2011

http://depositfiles.com/files/2mr88v1h8

I am sorry here is the limk to the flash- I just signed up for this account.

Participating Frequently
September 13, 2011

Nope still getting error messages   Here is the screen shots-

is there anyway to upload flash?

Thanks

Gina Taylor

Ned Murphy
Legend
September 13, 2011

The way you had your code originally would be correct...

var link_one:link1;

link_one = new link1();

addChild(link_one);

The 1046 error is indicating it doesn't recognize the link1 class.  So the first thing you need to make sure of is that you have assigned the link1 class designation to whatever symbol that is in the library.

Participating Frequently
September 13, 2011

How can I do that?

Thanks

Gina Taylor

Inspiring
September 13, 2011

I changed very little of the code you had, but try this:

//This is the code I am using:  
import flash.net.navigateToURL;
import flash.net.URLRequest;

var link_one:MovieClip = new(link1); 
//link_one = new link1();
stage.addChild(link_one); 
link_one.addEventListener(MouseEvent.CLICK, buttonClickHandler);

function buttonClickHandler(event:MouseEvent):void {
    var url:String = "http://www.masterpiececorp.com/ARMREF.htm";
    var request:URLRequest = new URLRequest(url);
    navigateToURL(request);
}

Participating Frequently
September 13, 2011

I am trying now thanks.

Gina T