SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast MSWD's Avatar
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do you hard code flash banner with link to url

    Can some one post simple instructions for making a flash banner link to a url when clicked. Better yet could someone post an actual working (simple ) banner that has the action script in it? I'm sure this is simple but I'm pulling my hair out getting it to work.

    Thanks

    I'm using Flash CS3 -action script 3

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Toronto, ON
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would also be interested this.

  3. #3
    SitePoint Evangelist pedrodonkey's Avatar
    Join Date
    Nov 2005
    Location
    Cyprus
    Posts
    549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm not 100% familiar with AS3 but this seems to work. See attached zip file.

    There's 2 movie clips in the example, one holds your banner animation and the other, top most layer, acts as an invisible button which triggers the navigateToUrl function.

    Hope it helps.

    Cheers
    Attached Files Attached Files

  4. #4
    SitePoint Enthusiast MSWD's Avatar
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming you have made a transparent button symbol. Save it as a movie clip type and name it button_mc

    In the main time line-I placed the movie clip "button" on the bottom layer. I also have an action layer as my top layer. In the action layer I added the following action:

    var link:URLRequest = new URLRequest("http://www.horseflicks.com");

    button_mc.addEventListener(MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void
    {
    navigateToURL(link);
    }
    button_mc.buttonMode = true;

    Just substitute any URL for the horseflicks url.

    I hope this helps someone else out there!

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    London UK
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I have the same problem and cannot figure out the solution.

    I downloaded the zip and copied hitSpot_mc. but it's not showing alpha 0. Please tell me how to do that?

    I also followed Kathy's instructions and still can't make it to work. Is there a way to explain it very simple (gide for dummies) PLEASE!

    Thanks
    Brigita
    brigita

  6. #6
    SitePoint Evangelist pedrodonkey's Avatar
    Join Date
    Nov 2005
    Location
    Cyprus
    Posts
    549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but it's not showing alpha 0. Please tell me how to do that?
    What exactly do you mean when you say it's not showing alpha 0? The layer that is named "hitSpot with 0 alpha" has an instance name of "hitSpot_mc" which you can see if you click once on the invisible button and look at the properties panel in the lower left of the flash IDE.

    This code then tells that button to open a specified website when it is clicked:

    Code Actionscript:
    hitSpot_mc.addEventListener(MouseEvent.CLICK, callLink);
    function callLink(event:MouseEvent):void { 
      var url:String = "http://www.google.com";
      var request:URLRequest = new URLRequest(url);
      try {
        navigateToURL(request, '_blank');
      } catch (e:Error) {
        trace("Error occurred!"); 
      }
    }

    The bottom most layer which is called "banner movieClip" is a movie clip in which you will create your looping animation.

    Cheers


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •