?
Solved

Hyperlink problem

Posted on 2003-02-26
28
Medium Priority
?
413 Views
Last Modified: 2013-12-24
Ive set up a hyperlink in director 8.5 as follows. I created a text box and highlighted the data, then went to Window - Inspectors - Text and entered in the website i wanted to go to. I then added the following behavior to my movie so that whenever I clicked on a hyperlink the proper page would open up.

on hyperlinkClicked  me, data, range
 
  case true  of
    (data starts "www."): gotoNetPage(data, "new")
    (data starts "event"): alert "The hyperlink "& data & " was just clicked."
  end case
end  

The hyperlinks worked fine whenever I played them in director but when I published the movie as a shockwave, the hyperlinks would no longer work. Instead when I clicked on them they would be added to the end of the existing web-address. This is an example of what would happen

ORIGIONAL MOVIE
http://ijsr32.infj.ulst.ac.uk/~99419971.e410uj4.students/

WHEN I CLICK ON A HYPERLINK
http://ijsr32.infj.ulst.ac.uk/~99419971.e410uj4.students/www.technologyreview.com

(Please note you will not be able to access the above website)

I was wondering if there was a way so that when a user clicked on a hyperlink this would open the link in a new web-page. Please note there are 9 possible hyperlinks that could be clicked. If anyone could tell me how to do this I would appreciate it very much.

Thanks Paul
0
Comment
Question by:oneillpaul70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 12
28 Comments
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8029077
(data starts "www."): gotoNetPage( "http:///" & data, "new")
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8029081
oops, extra slash

(data starts "www."): gotoNetPage( "http://" & data, "new")
0
 

Author Comment

by:oneillpaul70
ID: 8035757
Is there anyway I can have it so that a different browser window is opened each time or that when 1 user clicks on a link the same web-page opens on the other users screen.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 20

Expert Comment

by:MediaMacros
ID: 8035929
Yes.. Instead of "new" use "_blank"

As for the second option, I am not sure I follow.  If you are trying to make one PC open files on another you will need to send messages via multiuser server or Flash Comm server.
0
 

Author Comment

by:oneillpaul70
ID: 8035952
I am using the multiuser for i have set up a text based chatroom using it and the hyperlinks are one of the features of it so I was wondering if a user clicked a hyperlink in 1 computer could the same hyperlink be opened up on a different computer without having to press anything
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8036016
Yes...

The hyperlink would execute a send message to the other user.  Then that user's program would pick up the event and issue a goToNetPage.
0
 

Author Comment

by:oneillpaul70
ID: 8040864
I was also wondering is there anyway I can change the hyperlink color once I have clicked on a hyperlink and when I tried the "_blank" instead of "new" the link was still opened up in the same window
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8042084
Not be default in Director but I have a behavior at www.mediamacros.com that will do this.  THe direct url to it is...
http://www.mediamacros.com/item/item-1006687110/
0
 

Author Comment

by:oneillpaul70
ID: 8089905
Ive also been trying to set up a button whereby if a user enters an address of a website into a text button and then presses a button that a hyperlink to that site will be opened if it exists but ive been having no luck with this. Would you now if this is possible and is so could you please show me how to do it.

Thanks
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8089950
Sure.  LEts say your text field is named "myURL"  Place this on your button...

on mouseUP me
  url = memeber("myURL").text
  if not(url contains "http://") then
    url = "http://" & url
  end if
  goToNetPage(url)
end

Instead of the goToNetPage you coudl also send it across MUS the same way as I outlined above.
0
 

Author Comment

by:oneillpaul70
ID: 8160645
I added the above code for the changing colour of the hyperlinks to the property of the text buttons. Was this the correct place to add it to? As when I clicked on a link the text would change colour but the hyperlink that I had setup would not work.
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8161128
Place my code above in a separate behavior and drop it on the sprite.
0
 

Author Comment

by:oneillpaul70
ID: 8161568
Im not to sure what you mean by this. Could you please explain a bit better please.

Thanks
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8176310
Open a new script member.  Paste the code into it.  Select the member and in the property inspector click the "script" tab and set it to behavior.  Then drag the behavior onto your sprite on the stage.
0
 

Author Comment

by:oneillpaul70
ID: 8176642
I put the code into a script member and set the property of it to behavior as you said. I then dragged this over the text that i had set up as the hyperlink and it changed the color of the links fine but it wouldnt open the webpage
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8176995
Try this..

on hyperLinkCLicked me, data, range
 url = data if not(url contains "http://") then
   url = "http://" & url
 end if
 goToNetPage(url)
end
0
 

Author Comment

by:oneillpaul70
ID: 8177795
I added this code onto the existing code above but I got an error saying "Script error: name already used on hyperLinkCLicked me, data, range". Was this the correct place to add it?
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8181093
Looks like you already had a hyperlinkclicked handler.  Cna you post your full code?
0
 

Author Comment

by:oneillpaul70
ID: 8181967
I created a text box and highlighted the data, then went to Window - Inspectors - Text and entered in the website i wanted to go to. I then added the following behavior to my movie so that whenever I clicked on a hyperlink the proper page would open up.

on mouseUP me
 url = member("myURL(website)").text
 if not(url contains "http://") then
   url = "http://" & url
 end if
 goToNetPage(url)
end

I then added the following code that you sugguested to another behavior to set the color of the weblinks but when i attached this to the text boxes i created above the hyperlinks would no longer work but the color could be set:


property spriteNum
property pDefColor
property pVisitedColor
property pMember
global gClickedList

on getPropertyDescriptionList me
  p = [:]
  p.addProp(#pDefColor, [#format : #color, #default : rgb(255, 0, 0), #comment : "Base Color"])
  p.addProp(#pVisitedColor, [#format : #color, #default : rgb(0, 255, 0), #comment : "Visited Color"])
  return p
end

on beginSprite me
  if gClickedList = void then gClickedList = []
  pMember= sprite(spriteNum).member
  pMember.usehypertextstyles = 0
  pMember.color = rgb(0,0,0)
  iHyperlinks = pMember.hyperlinks
  repeat with link in iHyperlinks
    linkName = pMember.name & "-" & link[1] & "-" & link[2]
    me.colorize(link, linkName)
  end repeat
  sprite(spriteNum).cursor = 0
end

on endSprite me
  sprite(spritenum).cursor = 0
end

on mouseWithin me
  if sprite(spriteNUm).pointInHyperlink(the mouseLoc) then
    if sprite(spriteNum).cursor <> 280 then
      sprite(spriteNum).cursor = 280
    end if
  else
    if sprite(spriteNum).cursor <> 0 then
      sprite(spriteNum).cursor = 0
    end if
  end if
end

on colorize me, link, linkName
  if gClickedList.getOne(linkName) then
    pMember.char[link[1]..link[2]].color = pVisitedCOlor
  else
    pMember.char[link[1]..link[2]].color = pDefColor
  end if
end

on hyperLinkCLicked me, d, link
  linkName = pMember.name & "-" & link[1] & "-" &  link[2]
  if gClickedList.getOne(linkName) = 0 then gClickedList.add(linkName)
  me.colorize(link, linkName)
end

on getBehaviorDescription me
  return "Place on a text member and set the colors for custom hyperlink colors."
end  
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8182251
Change
on hyperLinkCLicked me, d, link
 linkName = pMember.name & "-" & link[1] & "-" &  link[2]
 if gClickedList.getOne(linkName) = 0 then gClickedList.add(linkName)
 me.colorize(link, linkName)
end

to ...

on hyperLinkCLicked me, d, link
 linkName = pMember.name & "-" & link[1] & "-" &  link[2]
 if gClickedList.getOne(linkName) = 0 then gClickedList.add(linkName)
 me.colorize(link, linkName)
 url = data
 if not(url contains "http://") then
  url = "http://" & url
 end if
 goToNetPage(url)
end
0
 

Author Comment

by:oneillpaul70
ID: 8182390
I made the changes you said and i got the following script error: "Variable used before assigned a value url = data ?"
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8182450
Change to
url = d
0
 

Author Comment

by:oneillpaul70
ID: 8210049
As I said above I set up a button so that when a user enters a web address and clicks the button the user goes to it, if it exists. But if I have only 1 browser window open (The one the program is currently running on this is the one that displays the page therefore exiting the program). Is there anyway around this to ensure that a new web page would be opened therefore not exiting the program.
The original code is:

on mouseUP me
 url = memeber("myURL").text
 if not(url contains "http://") then
   url = "http://" & url
 end if
 goToNetPage(url)
end
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 8211011
goToNetPage(url, "_blank")

That will open a new window.
0
 

Author Comment

by:oneillpaul70
ID: 8279943
Is there any way that you can make the above code work so that when the return key is pressed it goes to the website as well?
0
 
LVL 20

Accepted Solution

by:
MediaMacros earned 400 total points
ID: 8284091
With a keyup script....

on keyUp me
  if the key = return then
   url = memeber("myURL").text
   if not(url contains "http://") then
     url = "http://" & url
   end if
   goToNetPage(url)
  end if
end

Place that in the behavior on the field.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question