4 Replies Latest reply on Oct 24, 2006 2:12 PM by zcx000

    Help on

    zcx000
      I want to represent many URLs (for example 100 URLs) with some geometry shapes (for example, small circles) and define some similar actions for them. The expected actions are: when we put mouse over each circle, the corresponding URL address is displayed. When we click each circle with mouse, we can go to that URL directly by opening a new window.

      I played with a simple example of 3 URLs manually, and I can achieve the above actionsby defining each geometry element (that is, each URL) as a movie clip and defining two actions (mouse over and mouse press) for each movie clip. Now the question is: if I have many URLs, how to automate the repetitive taks (generate a movie clip for each URL, and define the actions for each of them)?

      I tried to use loop those URLs. But I don't know how to pass the action function with parameters to each movie clip.

      Could you give me some suggestions on how to deal with these repetitive tasks, or forward me to the related Flash documents? You help would be greatly appreciated.


      Here I attach my sample action acript code for your reference. Thanks for your help,

      - zcx000

      ***************************************************************

      var url0address:String = " http://www.google.com";
      var url1address:String = " http://www.yahoo.com";
      var url2address:String = " http://www.msn.com";

      url_text.text = "please put mouse on the circles";

      function displayUrl0Address() {
      url_text.text = this._parent["url"+0+"address"];
      //url_text.text = " http://www.google.com";
      }

      function goToUrl0Page() {
      //element0.getURL(" http://www.google.com ", "_blank");
      element0.getURL(this._parent["url"+0+"address"], "_blank");
      }

      function displayUrl1Address() {
      url_text.text = this._parent["url"+1+"address"];
      }

      function goToUrl1Page() {
      element1.getURL(this._parent["url"+1+"address"], "_blank");
      }

      function displayUrl2Address() {
      url_text.text = this._parent["url"+2+"address"];
      }

      function goToUrl2Page() {
      element2.getURL(this._parent["url"+2+"address"], "_blank");
      }

      element0.onRollOver = displayUrl0Address;
      element0.onPress = goToUrl0Page;
      element1.onRollOver = displayUrl1Address;
      element1.onPress = goToUrl1Page;
      element2.onRollOver = displayUrl2Address;
      element2.onPress = goToUrl2Page;