A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: HELP! Hyperlinking pictures

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    7

    HELP! Hyperlinking pictures

    I have 4 seperate advertisments that will be scrolling in and out of a frame. The animation works well; however, the purpose of creating this flash is to direct traffic to different parts of my website.

    In order for someone to go to a different page on my website, via this flash advertisment, they will need to click on the picture. Unfortunately this is the problem, when trying to add a URL to the picture it doesn't work, the URL doesn't stick and I get an error message. It says, "A definition for this class could not be found in the class path, so one will be automatically generated in the SWF file upon export." I am pretty sure I need to convert the picture to a button, so before I get the error message I right click - convert to symbol - button - export for runtime sharing (because that was the only was to add content to the URL field when converting to symbol) - then I enter the destination URL - OK.

    Could anyone please help me with this problem? As i mentioned, I only need the picture to direct the user to another page on the website after being clicked.

    Thank you in advance

  2. #2
    Senior Member guardiankitty's Avatar
    Join Date
    Dec 2006
    Location
    Here
    Posts
    215
    So you are using as3 right?



    All you need to do, is import the picture, take the picture out of the library, and drag it to the stage. Select it and make it into a movieclip (or hit F8). Now give it an instance name: (you can do this by selecting the newly created movieclip, and going to the Properties Window (F3 if my memory serves me), then typing in the instance name box which says '<Instance Name>' in gray. For this explanation I will give it the instance name of 'button1'.


    OK... now with all of that done,... deselect the movieclip (so nothing is selected), and open up your actionscript menu (F9 key)

    Type something like the following...


    PHP Code:


    //Listen for when button1 is pressed, open up './NextPage.html' in the _same window

    button1.addEventListener(MouseEvent.CLICK, function (e:MouseEvent){
        
    navigateToURL(new URLRequest("./NextPage.html"), '_same');
    }) 

    This should help you get on the right track, let me know if this helps and good luck!

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    7

    Doesn't work

    Thank you for taking the time to reply to my post; however, the directions you gave me don't seem to work.

    When I convert the picture into a movie clip it asks me for a name... what do I put here. Does this name have to match the instance name?

    Now, once I go into the properties menu I rename the instance name into "button1." First, do I leave it as a movie clip or do I swap it into a button? After that, do I hit enter? The window stays open, what should I do at this point? Close the window?

    Finally, when I go to the action script where do I insert the URL? For instance the URL I want to enter is http://www.pinterec.ca/contact-us.

    Lastly, how do I test if this process worked? Should the link work when I Test Movie or do I need to publish to .swf to see if it worked.


    Thank you in advance

  4. #4
    Junior Member
    Join Date
    Apr 2010
    Posts
    7

    Update:

    Along with the other problems I have encountered, I have also received an 1120 error message. After trying your solutions again, I encountered an additional issue.

    I am receive an error message 1120: Access of undefined property ContactUs.

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    7
    ...
    The problem is located in Scene 1, Layer 'Contact Us', Frame 4, Line 3

    The code I am using is:
    //Listen for when ContactUs is pressed, open up './contact-us.php' in the _same window

    ContactUs.addEventListener(MouseEvent.CLICK, function (e:MouseEvent){
    navigateToURL(new URLRequest("./contact-us.php"), '_same');
    })


    Could please verify if this code will work? Also, what am I doing wrong?

  6. #6
    Senior Member guardiankitty's Avatar
    Join Date
    Dec 2006
    Location
    Here
    Posts
    215
    Quote Originally Posted by ashtonbyrne
    When I convert the picture into a movie clip it asks me for a name... what do I put here. Does this name have to match the instance name?
    Nope ... any name will do. Does not need to match the instance name.

    Quote Originally Posted by ashtonbyrne
    do I swap it into a button?
    Nope. Personally I hate 'buttons' in flash... but each to their own. Anything you can do with a button you can do better manually with a MovieClip.

    Quote Originally Posted by ashtonbyrne
    Finally, when I go to the action script where do I insert the URL? For instance the URL I want to enter is http://www.pinterec.ca/contact-us.
    Copy and paste the original code. Edit where it says,"./NextPage.html"



    Quote Originally Posted by ashtonbyrne
    Lastly, how do I test if this process worked? Should the link work when I Test Movie or do I need to publish to .swf to see if it worked.


    Thank you in advance

    Yep, you should be able to press it in the flash debug player inside of flash.


    Quote Originally Posted by ashtonbyrne
    Along with the other problems I have encountered, I have also received an 1120 error message. After trying your solutions again, I encountered an additional issue.

    I am receive an error message 1120: Access of undefined property ContactUs.
    This issue is independent of the code that I have submitted to help. If you link the project I would be happy to take a look and help!


    Please see the attached file, where I have followed my own instructions step by step, it is a working version of the above code.



    Hope this helps! and good luck!

    -GK>'.'<
    Attached Files Attached Files

  7. #7
    Junior Member
    Join Date
    Apr 2010
    Posts
    7

    Unhappy I don't get it

    Hi guardiankitty,

    Unfortunately, I am not getting the point here. I have attached my flash project for your evaluation.

    Thank you for taking the time to help me with my project.

  8. #8
    Junior Member
    Join Date
    Apr 2010
    Posts
    7

    Attachment is not working

    If it is not one thing it is another.

    Unfortunately, this site is not allowing me to attach my .fla file so you can evaluate it.

    Could I email you the file instead?

    To limit the visibility of your email address on this forum, if you want, you can go to www.pinterec.ca/contact-us and fill out a contact form with your email address.


    Thanks again for all your help with my project.
    Last edited by ashtonbyrne; 04-30-2010 at 04:51 PM. Reason: forgot to say something

  9. #9
    Senior Member guardiankitty's Avatar
    Join Date
    Dec 2006
    Location
    Here
    Posts
    215
    Quote Originally Posted by ashtonbyrne View Post
    If it is not one thing it is another.

    Unfortunately, this site is not allowing me to attach my .fla file so you can evaluate it.

    Could I email you the file instead?

    To limit the visibility of your email address on this forum, if you want, you can go to www.pinterec.ca/contact-us and fill out a contact form with your email address.


    Thanks again for all your help with my project.
    That happends to me too on this site from time to time,

    Just use www.rapidshare.com really quick and ill take a look.

  10. #10

  11. #11
    Junior Member
    Join Date
    Jul 2010
    Location
    Tampa, FL
    Posts
    1

    hyperlinking button/picture

    Hi guardiankitty,

    I followed the instruction above to the T, yet the link is still not functional, I noticed, my mouse switches to the hand at the last frame. yet clicking it does not yield any results.

    on the other hand, your file, the mouse does not switch to the hand yet the link works. any pointers?

    I have tried it as a button, and as a movie... last save (attached) is movie.

    ashtonbyrne, assuming your issue has been fixed, feel free to provide any pointers as well

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center