Dont ask me why BUT when I test this code in my adobe flash CS3 it works fine and the link opens fine now when I test this on my server it does not open the link...

Any Ideas?

Thanks, Regards X

Below is my code:

button_N.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

function mouseDownHandler(event:MouseEvent):void {
      navigateToURL(new URLRequest("http://www.google.com/"));
}

Recommended Answers

All 6 Replies

I would try renaming the instance of your button to google_btn. Actionscript 3.0 works best with buttons and movie clips when instance names use the suffix _btn or _mc respectively.

It sounds like a minor change but it might help. Also, are you using mouse down over CLick for a special reason?

Example change:

function nav(event:MouseEvent):void {
      navigateToURL(new URLRequest("http://www.google.com/"));
}

goggle_btn.addEventListener(MouseEvent.CLICK, nav);

My last piece of advice is to make sure you created a separate layer in flash for the actions

Sorry if I am stating the obvious. Since I do not have the .fla file I want to cover all bases.

let me know if that helps.
-S

you also might need to create a variable to load the URL request. I will look for a past project and will post it tomorrow. But someone else reading this post might be able to give you that piece of code before then

Same thing no luck...

If it makes a difference the fla filed is published as n swf and then loaded by another bigger fla to play it but this should matter...

Like with the things all above, they are more correct programming then actually being right and wrong.

Tried everything above still same thing worked off server didnt work on server.

Note: MouseDown and Click both worked.

Thanks, keep the help coming.

Regards, X

Here is the variable declaration I spoke of in my last post. Written for Actionscript 3.0. Also if you are working in CS3, be mindful that you have selected actionscript 3.0 in the drop down menu within the actionscript window and script assist is turned off.

I hope that helps. Let me know.

Example change:

var nav_req:URLRequest = new:URLRequest(http://google.com/");

function nav(event:MouseEvent):void {
      navigateToURL(nav_req, "_blank");
}

goggle_btn.addEventListener(MouseEvent.CLICK, nav);

-S

just a thought, AS3.0 does not handle scenes the same way as past versions of AS. i tried it on one project and could not get it to work so i gave up. So there may be something else we are missing as well with a .swf inside a .swf.

hang in there. there has to be an actionscript wiz out there that will be able to help you.

I had a similar problem integrating paypal. It was a security feature problem. I changed my allowScriptAccess and allowNetworking param values and it fixed things. Here's what I set the values at:
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowNetworking" value="all" />

I made my own solution.

I went to publishing settings and change the version from Flash Player 9 to Flash Player 8.

Ive seen similar code like above to declare a button being selected.

Im thinking for long ass flash movies the new AS3 is alot better but for short sharp stuff like this "on release" is a whole lot easier.

Anyways it works now, GG Flash Player 8!

Might give flash player 9 a try some time in the near future.

Thanks, Regards X

PS: Thanks for all the help im sure ill use it in the future

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.