Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Linking A Url To A Button


15 replies to this topic

#11 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 18 December 2009 - 11:32 PM

Link issuesLinking A Url To A Button

Today I have been creating a flash animation.  As I am still new at the scripting part, I made my first button links today.  All of the links work, yet when the button disappears and a new button appears, both the first and second link are still active, depending on where you click on the animation.

Is there a way to turn off the link after the button has left the stage?

Is this a common problem?

Thanks for your help in advance.

-reply by global_g

#12 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 19 January 2010 - 12:55 AM

pop-up styleLinking A Url To A Button

tnxs guys my prob is  how can I open a video file not in IE but like a "pop up".

 I don't want to use IE to see video. Is there a solution?

-reply by kolpaz

#13 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 15 February 2010 - 08:09 PM

actionscript 2 and 3Linking A Url To A Button

Hi, I am a newbie with flash and are trying to piece together actionscript, but unfortually everything I try doesn't work. You know, try the "hello world" and work my way up to clicking buttons...:-) but it don't work! :-) 

I have the following code (using adobe flash-cs3- set to action script 1 and 2 on windows)

button1.OnPress = function() {   getURL("http:www.Google.Com","_self","GET");}

now this is almost the same as the code at the beginning of  topic which doesn't work either.

nothing happens. What I put in the function doesn't matter. I just can't seem to get the button to do anything. If somebody has some code the I can copy and paste and test...

I have a movie clip that plays and stops where the buttons appear and then you can click them.

where am I going wrong... Is there something wrong with my system or me...

thank you,

-reply by gazy

#14 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 22 February 2010 - 05:34 AM

how can i link my button to an image but using a action scriptLinking A Url To A ButtonHi there,I would like to link image to on of my buttons that I've created in flash. Does anyone know what action script I need to write. This is a first for me & I've gone through a lot of tutorial, but I haven't found a tutorial that shows me how to link a button to an image.Any advise would really be helpful.Thank,Sunel-reply by Sunel Drowley

#15 Guest_Alto Banor_*

  • Guests

Posted 08 August 2010 - 01:10 PM

Using ActionScript 2.0, in order to get through the security sandbox crap, you need to use ExternalInterface. Add these lines of code to the main timeline:

[color=#800080]import flash.external.*;

function gotoHTMLPage(url) {
//------------------------------------
// The name of a JavaScript function to call.
	var goPage:String = "gotothePage";
//------------------------------------
// Calling JS function
ExternalInterface.call(goPage,url)
//------------------------------------
}[/color]

These lines of code are in the button or in the frame where the button is located in the timeline:



[color=#800080]// Where [i]btn_Name[/i] is the name of your button and the use of [i]_root[/i] calls the [i]gotoHTMLPage[/i] from anywhere in the Flash file.

btn_Name.onPress = function() {
	_root.gotoHTMLPage("http://www.yahoo.com");
};[/color]

The last piece of code needs to be in a .js file or in a script tag in the HTML page that contains the swf file:

[color=#800080]<script language="javascript">
	function gotothePage(url){
		window.open(url);
	}
</script>[/color]
There are more elegant ways to do this using ActionScript 3, but this should get rid of any sandbox problem you might have when accessing Javascript code from your swf file.

One last thing, one of the settings in the swf file tag, allowScriptAccess needs to be set to always when testing from a local machine. I believe you leave it at the default setting when its hosted on a server.

<param name="allowScriptAccess" value="sameDomain" />	 Default setting
<param name="allowScriptAccess" value="always" />				Avoid Security Sandbox problems for local testing

Hope this helps some people out there. Posted Image

Alto Banor

Edited by moderator, 29 March 2012 - 05:27 AM.


#16 Guest_Rich_*

  • Guests

Posted 17 February 2012 - 11:28 PM

hi,

I am using the code like so and the page opens but on a new tab all the time anyideas why its not opening on the same tab?
onClipEvent (load) {
	numb = 8;
	this.hitArea = this.area;
}
on (rollOver) {
	this.gotoAndPlay("s1");
}
on (releaseOutside, rollOut) {
	this.gotoAndPlay("s2");
}
on (release) {
		getURL("http://www.youtube.com/index","_self","GET");
}

Thanks

Edited by moderator, 29 March 2012 - 05:28 AM.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users