ART GALLERY 2 - CLICKING TO PAGE LINK

OK. I know that Half-Life is great and Warcraft is a nice tool to create new maps to play in the Internet.

If you are only a teenager trying to have fun playing games using the Internet, Director looks like a poor tool to create games.

For this teenager doesn't matter that, to play his new Half-Life map, the player needs to have a CD-ROM drive and the basic CD of the game. The game will not work in the future wireless web devices without CD-ROM players .

This teenager doesn't know that Internet is not Web!. Internet uses the TCP/IP protocol and Web uses the HTTP protocol (over TCP/IP). This means: browser, web pages, links, e-commerce etc.

The Half-Life map can't be embedded in a Web page. The player can't click in a gun and go to a page where he can buy a gun like that :-)

There are some methods in the Lingo language to make this interaction between a Director movie and the Web. We will use:

            goToNetPage 
to go to a new web page if the internaut clicks "the painting in 3D gallery". This page can have details about the painting, a better image, how to buy it etc. etc.

We have seen in previous lesson how to capture the click in a 3D object using the method:modelsUnderLoc. We will not re-explain the details. We will have a sprite-script trigger that sets a flag:

global avatarobj

on mouseUp me
 set=point(sprite(1).left,sprite(1).top)
 pt = the mouseLoc - set
 m = sprite(1).camera.modelsUnderLoc(pt, 3, #detailed)
 if m.count>1 then
  if  m[1].model.name ="pic"  OR  m[2].model.name ="pic" then
  avatarobj.link=1 
  end if
 end if

end

The flag link is created in the avatarobj script but the action is in new lines of the timestep script:

on exitFrame me
  if(avatarobj.link=1)   then
    goToNetPage "http://www.moma.org", "_new"
   avatarobj.link= 0  
   end if 
  
  go the frame
  
end

The targetName argument - new in our case - is an optional HTML parameter that identifies the frame or window in which the page is loaded.

If targetName is a window or frame in the browser, gotoNetPage replaces the contents of that window or frame.

If targetName isn't a frame or window that is currently open, goToNetPage opens a new window.

If targetName is not included, gotoNetPage replaces the current page, wherever it is located.

Play the demo (again) going inside the building (the gallery), looking the "painting" and clicking on it. We will learn how to change of the pointer image in next lesson.




PREVIOUS LESSON NEXT LESSON
T. CONTENTS HOMEPAGE