Hyperlink problem

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
oneillpaul70Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MediaMacrosCommented:
(data starts "www."): gotoNetPage( "http:///" & data, "new")
0
MediaMacrosCommented:
oops, extra slash

(data starts "www."): gotoNetPage( "http://" & data, "new")
0
oneillpaul70Author Commented:
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 problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

MediaMacrosCommented:
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
oneillpaul70Author Commented:
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
MediaMacrosCommented:
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
oneillpaul70Author Commented:
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
MediaMacrosCommented:
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
oneillpaul70Author Commented:
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
MediaMacrosCommented:
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
oneillpaul70Author Commented:
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
MediaMacrosCommented:
Place my code above in a separate behavior and drop it on the sprite.
0
oneillpaul70Author Commented:
Im not to sure what you mean by this. Could you please explain a bit better please.

Thanks
0
MediaMacrosCommented:
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
oneillpaul70Author Commented:
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
MediaMacrosCommented:
Try this..

on hyperLinkCLicked me, data, range
 url = data if not(url contains "http://") then
   url = "http://" & url
 end if
 goToNetPage(url)
end
0
oneillpaul70Author Commented:
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
MediaMacrosCommented:
Looks like you already had a hyperlinkclicked handler.  Cna you post your full code?
0
oneillpaul70Author Commented:
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
MediaMacrosCommented:
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
oneillpaul70Author Commented:
I made the changes you said and i got the following script error: "Variable used before assigned a value url = data ?"
0
MediaMacrosCommented:
Change to
url = d
0
oneillpaul70Author Commented:
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
MediaMacrosCommented:
goToNetPage(url, "_blank")

That will open a new window.
0
oneillpaul70Author Commented:
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
MediaMacrosCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.