SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple flash question?

    Hi All,

    Just after a bit of help with html links in flash.

    All i'm after is to add an html link to a graphic (does it have to be a button?) in flash. As I understand you first need to do an onclick action then get url?

    Could someone post the code as it would look.

    Also with the url link does it have to be the full http etc, only it's to link to the next page which reverts back to regular html. For example in dreamweaver it's just href="index.html" that you need to add. Don't want to have to keep uploading the pages each time.

    Many thanks,

    Keith

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by quiquiloko View Post
    Hi All,

    Just after a bit of help with html links in flash.

    All i'm after is to add an html link to a graphic (does it have to be a button?) in flash. As I understand you first need to do an onclick action then get url?
    A button is the easiest way to do it, yes

    Quote Originally Posted by quiquiloko View Post
    Could someone post the code as it would look.
    Are you using ActionScript 2.0 or 3.0?
    Quote Originally Posted by quiquiloko View Post
    Also with the url link does it have to be the full http etc, only it's to link to the next page which reverts back to regular html. For example in dreamweaver it's just href="index.html" that you need to add. Don't want to have to keep uploading the pages each time.
    For URLs in the same domain you can leave out the http://www.mydomain.com/ part, for external domains you have to include it.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using Flash 8, so don't know which version of ActionScript that uses?

    Thanks for the response. With the above details is it possible for an example code. I don't like using Flash, but the client whats some movement to the navigation.

    Just to confirm, I would like to add a button that works just like a link in dreamweaver.
    Last edited by quiquiloko; Oct 7, 2008 at 10:23. Reason: additions

  4. #4
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hello

    Use the rectangle tool to draw a shape over the top of the image, then convert this shape to a movieclip symbol (F8) select movieclip and give it a name, then in the properties inspector give it an instance name of "picBut" or whatever you want to call it, then set it's alpha to 0 again using the properties inspector.

    Then create a new layer and on the first frame of the movie add:
    Code Actionscript:
    picBut.onRelease = function() {
      getURL("http://domain.com/page.html")
    }
    Now if this button is not on the root timeline and is within another movieclip, you will have to address that at the start
    Code Actionscript:
    mc1.mc2.picBut.onRelease = function() {
      getURL("http://domain.com/page.html")
    }
    You do not need the entire (http://....) in there but I personally like working with absolute paths. Hope this helps. If not, post again and someone will be more than happy to assist.

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by BPartch View Post
    Code Actionscript:
    mc1.mc2.picBut.onRelease = function() {
      getURL("http://domain.com/page.html")
    }
    Please note that the mc1 and mc2 here are instance names, not movieclip names.
    Confusing those two has cost me several headaches in the past.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Enthusiast Web Design Perth's Avatar
    Join Date
    Sep 2008
    Location
    Perth, Western Australia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why the need for the extra rectangle - I'd just make the image into an mc and then:

    Code:
    image_mc.onPress = function() {
    	[do this or that]
    };

  7. #7
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    The extra rectangle is to define the "hit" area of the button.
    Suppose you create a button with only the character T in it. Now, the button only works when you're clicking exactly on a pixel that is within that character.
    If you add a transparent square, the complete "bounding box" (1) of the character is clickable.

    1) A bouding box of an object is the smallest square that encapsulates all of that object.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  8. #8
    SitePoint Enthusiast Web Design Perth's Avatar
    Join Date
    Sep 2008
    Location
    Perth, Western Australia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Indeed scallioXTX,

    Perhaps I assumed the OP's 'graphic' referred to an image.

  9. #9
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok,

    I'm starting to get a bit lost now. I've uploaded the .swf and flash file. Which is in the link attached below.

    http://www.oddsockdesign.co.uk/flash..._grid_temp.swf

    The first link is the .swf file which shows the animation. What i'm after is once all the images have loaded you click on a flower and it takes you to the corresponding html page.

    The link below is the folder which contains the flash file. I only know very basic flash actions and am not having much luck getting this to work. If it's not to much trouble could I get some one to download the file and show me a working version?

    http://www.oddsockdesign.co.uk/flash/

    Many many thanks,

    Keith

  10. #10
    SitePoint Enthusiast Web Design Perth's Avatar
    Join Date
    Sep 2008
    Location
    Perth, Western Australia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Keith,

    I've had a look at the fla.

    Make each image into a movieclip (mc).

    Give each mc a unique instance name (in the properties panel) - this is different to the mc's name.

    Then write your getURL scripts using the instance names.

  11. #11
    SitePoint Enthusiast Web Design Perth's Avatar
    Join Date
    Sep 2008
    Location
    Perth, Western Australia
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or give me an email address and I'll send you the fixed fla.

  12. #12
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Web Design Perth,

    I've sent you a private message with my email address.

    thanks for sorting this out so quickly.


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
  •