FORUMS: list search recent posts

Bouncing Ball Movie Clip Link to a URL [AS3]

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Emily Hunt
Bouncing Ball Movie Clip Link to a URL [AS3]
on May 18, 2009 at 11:11:27 am

Hi,

I am a total beginner to Flash, but on my website (mainly HTML/CSS} I have a bouncing ball graphic which I made in Flash using a photo of a dog's ball and the Flash CS4 default Motion preset 'bounce-in-3D'.

I have received the feedback that visitors to my site would like the bouncing ball to link to something. This seems like a great idea, but I can't work out how to do this with AS3. I've bought a few books on AS3, but am finding them too confusing at the moment.

If anyone could let me know the simplest way to link the bouncing ball in my SWF to a URL, I'd be thrilled!


Return to posts index

cowcowcowcowcow
demetri tashie
Re: Bouncing Ball Movie Clip Link to a URL [AS3]
on May 18, 2009 at 12:41:12 pm

as long as you have your bouncing ball movieclip given an instance name, you can attach this code.
change 'ball1' to the name of your movieclip instance name, and change the google reference to whatever URL you want. i have it opening in a new browser window ( '_blank')



ball1.buttonMode=true;//use this if you want the cursor to change to a hand

ball1.addEventListener(MouseEvent.CLICK, navFUNCT );

function navFUNCT(evt:MouseEvent):void {
var uRequest:URLRequest = new URLRequest("http://www.google.com");
navigateToURL(uRequest, '_blank');
}






Return to posts index

Emily Hunt
Re: Bouncing Ball Movie Clip Link to a URL [AS3]
on May 18, 2009 at 12:58:37 pm

Thank you so much. This works perfectly and creates exactly the effect I was aiming for!

I hadn't even thought of changing the cursor to a hand, but it makes the effect much better.

Thanks again.


Return to posts index


Diego Ramiro Papiz
Re: Bouncing Ball Movie Clip Link to a URL [AS3]
on Nov 26, 2013 at 8:49:55 pm

Hi, thank's for make the right cuestion and for answer it. But I just whant to ask you about this
ball1.buttonMode=true;//use this if you want the cursor to change to a hand

ball1.addEventListener(MouseEvent.CLICK, navFUNCT );

function navFUNCT(evt:MouseEvent):void {
var uRequest:URLRequest = new URLRequest("http://www.google.com");
navigateToURL(uRequest, '_blank');
}

I did the same and it works fine, but when I use this button on my own web (builded with wordpress) it links to an external window. I mean, if you enter my web page and hit the button it opens the right url but in a different window. Do you know how can I do to make it open that url in the same window? Please help me


Return to posts index

demetri tashie
Re: Bouncing Ball Movie Clip Link to a URL [AS3]
on Nov 27, 2013 at 3:23:45 am

you can either remove " _blank " altogether, as it is stating to open a new window, or you can try to substitute " _self " for " _blank " which should tell it to open in the same browser window.

PS: - this thread is over 4 years old!


Return to posts index

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