Discuss Anything: Linking A Url To A Button - Discuss Anything

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!
Page 1 of 1

Linking A Url To A Button How to Link a URL using getURL() Rate Topic: -----

#1 User is offline   andrewsmithy 

  • Newbie [Level 1]
  • Pip
  • Group: Kontributors
  • Posts: 19
  • Joined: 16-March 05
  • Location:United States
  • Current Mood: Current Mood:

Post icon  Posted 26 March 2005 - 06:04 AM

Linking a URL to a Button in Flash

This seems to be a problem for beginners to Flash, and I thought I'd address it. When building a Flash-navigated site, you need to link one page to another through the flash interface, just like you would a <a href="otherpage.html">my link</a> in HTML/XHTML.

Once you've created your button on the page, you can link the button very simply. Right-click it, and select "Actions" from the menu. This will open the ActionScript editor, in which you can right ActionScript code. Don't worry. It's not detailed to put this link in.
Make sure you are in Expert Mode, by clicking the arrow in the upper-right hand corner and selecting "Expert Mode". Now type the following code into the editor.

on (release) {
	getURL("the_linked_page.htm","_self","GET");
}


The button you created will now go to that link when the mouse clicks it. The getURL function has a prototype that is like this:

getURL(url [,window [, method]])

The window and the method are optional parameters. The url define the resource you want to access. This could be an absolute address, such as "http://www.somesite.com/" or relative to the page that contains the flash movie such as "myotherpage.htm". The window parameter defines the window that you want the url to load in. This could be one of the following:
"_self" - Targets the window that the movie is in.
"_new" - Opens url in a new window
"_top" - Only useful in a framset, targets the top frameset
"_parent" - Targets parent window in a framset
"myWindowName" - where "MyWindowName" refers to the name of a frame in a frameset

The last parameter is one in which the method in which the url is requested, and is either "GET" or "POST". For most of your projects, you will normally use "GET". "POST" is for posting form data, but you usually use the loadVariables function to to this.

That wraps up the tutorial on adding a link to a button in a Flash Movie. I hope this helps everyone. If you have any questions or comments, please reply to this post.
0


Page 1 of 1

Other Replies To This Topic

#2 User is offline   nickmealey 

  • Premium Member
  • PipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 156
  • Joined: 14-March 05
  • Location:Washington, USA
  • Interests:I like sports, baseball mostly. I like food and computers. And i'm not ashamed to be a Christian.
  • Current Mood: Current Mood: None Chosen

Posted 26 March 2005 - 06:08 AM

thanx, thats always nice to know. :)
0

#3 User is offline   hulunes 

  • .::UniCorN::.
  • PipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 973
  • Joined: 19-September 04
  • Location:Dalian CHN
  • Interests:basketball &amp;drawing,digital pro.
  • Current Mood: Current Mood: None Chosen

Posted 26 March 2005 - 06:46 AM

well,good post.this one must to be helpful to somebody who are new at making flash.using this kind of function at webpage ,could looks nice and professional.hope more and more grafics fans master this skill... :)
0

#4 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 27 September 2007 - 06:07 PM

I am very new at using flash and i tried all that i know and more but whenever i open my button in ma web page n click it using the code that you just gave i keep getting this notice that my settings do not allow the button to interact with that particular site..plzz tell me how i should change the settings??

-Prashanth
0

#5 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 19 August 2008 - 09:18 PM

The actionscript
Linking A Url To A Button

Thanks, the script was straight to the point

-reply by Emmanuel Mtimba
0

#6 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 15 July 2009 - 01:35 AM

URL Link button at the end of a movie clipLinking A Url To A Button

Hi all, I’m new to flash so hopefully someone can please help me out.. Using Flash CS4 with Actionscript 3.0 and it seems to me that many people are having issues with it?

I’ve created a movie clip and added a button on the last keyframe (so that the button doesn’t appear until the end).

I have added the following code to the last keyframe (when the button appears)

enterbutton.AddEventListener(MouseEvent.CLICK, onMouseClick);Function onMouseClick(event:MouseEvent):void{Var request:URLRequest = new URLRequest (”http://www.Adobe.Com”);NavigateToURL(new URLRequest(”http://www.Adobe.Com”), “_blank”);}

Problem is, the little hand icon appears when I hover it over the button, but nothing happens when I click.. Been trying out all different codes but nothing works and I’m getting pretty frustrated now..

I’m sure there’s a Flash Guru who can help me out! =) Thanks in advance! 

-question by vestige
0

#7 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 07 August 2009 - 06:43 PM

how can I get a working url buttonLinking A Url To A Button

1087: Syntax error: extra characters found after end of program.

this is the complier error I was given after I imputted your code to my button as a test how can I fix this problem

-reply by max


0

#8 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 12 August 2009 - 10:54 AM

Why is it not linkingLinking A Url To A Button

Hi

I have a flash menu bar with fly out sub menus. The fly out sub menus should link to the other pages created in html. Obviously they are buttons embedded in movie clips at the moment. I tried the above ActionScript by applying it to the buttons, yet they do not link anywhere. The hand shows when you hover over them, yet nothing happens when you click on them, not even an error comes up. Please help? 

-question by andre
0

#9 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 22 August 2009 - 01:48 AM

Linking in CS4 is a pain in the neck sometimes. Why not have the option to link in the Property Inspector as you can with text?Anyways, your problem might be the AllowScriptAccess parameter in the HTML document. It should be set to "always".It's got something to do with security.-reply by Trond
0

#10 User is offline   barron1 

  • Newbie
  • Pip
  • Group: Kontributors
  • Posts: 1
  • Joined: 30-August 09
  • Current Mood: Current Mood:

Posted 30 August 2009 - 07:35 PM

View Post(G)max, on Aug 7 2009, 01:43 PM, said:

how can I get a working url button

Linking A Url To A Button



<p>1087: Syntax error: extra characters found after end of program.</p>
<p>this is the complier error I was given after I imputted your code to my button as a test how can I fix this problem </p>
<p>

-reply by max </p>


So how do I view the answer to this question?
MB
0

#11 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 28 November 2009 - 08:10 PM

flash linking to url buttonLinking A Url To A Button

thank you so much I've been looking on how to link my fricken button for like the past week, because I never worked on flash before, and all these stupid youtube videos ****, thank you for making it so easy and directional. If you could do this with words you would make some awesome tutorials on video. Thanks again keep up the good work.

-feedback by gabriel

 


0

#12 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

Posted 11 December 2009 - 09:31 AM

Possible Security IssueLinking A Url To A Button

Answering (G)vestige  I think this maybe a security issue.

 PublishYou're swf, embed it in a HTML file, and open the HTML file.Check ifThe link does not work, perhaps place trace() statements around it toCheck what's happening.

 Now navigate yourself to http://www.Macromedi...manager04.Html 

This is the Global Security Settings panel for Flash. I recon that you havn't given permissions to the swf on your local machine to access outside content.

In the Global Security Settings add the folder you're SWF is in and try again. This should hopefully work.

Many thanks,

-reply by How-To-Code.Com
0

#13 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

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
0

#14 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

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
0

#15 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

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
0

#16 User is offline   iGuest 

  • Hail Caesar!
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Kontributors
  • Posts: 5,876
  • Joined: 21-September 07
  • Interests:Trap17 Free Web Hosting, No Ads
  • Current Mood: Current Mood: None Chosen

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
0

#17 Guest_Alto Banor_*

  • Group: 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:

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)
//------------------------------------
}


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



// Where btn_Name is the name of your button and the use of _root calls the gotoHTMLPage from anywhere in the Flash file.

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


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:

<script language="javascript">
function gotothePage(url){
window.open(url);
}
</script>


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. :)

Alto Banor
0

Share this topic:


Page 1 of 1


Similar Topics Collapse

  Topic Forum Started By Stats Last Post Info
Locked Topic Icon Hosting And Hotlinking Mp3...
???
your Secret HideOut abazzams 
  • 5 Replies
  • 8,212 Views
New Replies Icon Blogger Link Exchange
want exchange links?
Blogger nummell 
  • 1 Reply
  • 1,669 Views
New Replies Icon Adding ?phpsessid= To My Site
How can i add the PHPSESSID to my links on my site
Website Discussion rldowling03 
  • 1 Reply
  • 536 Views
New Replies Icon Pages Url Set Up Problem your Secret HideOut gisellebebegirl 
  • 5 Replies
  • 614 Views
New Replies Icon How Do You Tell Others The Url Like That.
about the expression
General Talk guangdian 
  • 6 Replies
  • 637 Views
Hot Topic (New) Icon Money Making...emails
Just click on links in emails
Freebie Stuff melkonianarg 
  • 16 Replies
  • 3,968 Views
Hot Topic (New) Icon How Many Of You Click On Google's Sponsered Links? General Talk The Simpleton 
  • 22 Replies
  • 886 Views
Hot Topic (New) Icon Sendearnings.com
Get paid to read emails and click on links
Make Money Online Phyre 
  • 20 Replies
  • 12,557 Views
New Replies Icon Text Link Ads Make Money Online pixieloo 
  • 8 Replies
  • 746 Views
*Poll (No New) Poll   Icon linkin park: in or out? General Talk Guest_dorm1232_* 
  • 16 Replies
  • 2,558 Views
Locked Topic Icon Site Improvements - Home Button
improve trap 17 site
Suggestions OCAC 
  • 4 Replies
  • 1,121 Views
New Replies Icon Bollywood Movies Links * * * - - Movies mabhishekjhawar 
  • 3 Replies
  • 2,987 Views
*New Replies Icon ClickHereFree Review Links Screwed General Talk Guest_drumbytes_* 
  • 1 Reply
  • 1,308 Views
New Replies Icon Report Button On Shout Box Suggestions Albus Dumbledore 
  • 4 Replies
  • 1,090 Views
New Replies Icon A "save As Draft" Button
saving your topics or posts for later editing
Suggestions master_bacarra 
  • 13 Replies
  • 2,020 Views
Hot Topic (New) Icon Can You Link Two Or More Free Domain Providers To The Same Site?
Just wondering... it'd be so cool if you can.
Questions & Queries Nameless_ 
  • 34 Replies
  • 1,221 Views
New Replies Icon Any Of You Guys Listen To Linkin Park?
crap MTV
Music kvarnerexpress 
  • 9 Replies
  • 4,737 Views
New Replies Icon Help To Setup Webserver With Prolink H9000 And Netgear Wgr614v5
WEBSERVER HELP
Hardware orlydonx 
  • 4 Replies
  • 3,000 Views
Poll (No New) Poll   Icon Pay To Play Websites
Should I link to them?
General Talk Fun4TheMoney 
  • 4 Replies
  • 1,518 Views
New Replies Icon Sef Links In Mambo
Some quick info
SEO - Search Engine Optimization michaelper22 
  • 1 Reply
  • 851 Views

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Google Fan :-) We Recommend Firefox.     Customize / Settings Connect Us on facebook