dcsimg
A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 43

Thread: external text with link to current site

  1. #1
    Junior Member
    Join Date
    Mar 2004
    Location
    home
    Posts
    7

    external text with link to current site

    I have a problem:
    I am working in Flash MX, and on my website in the 'news' section I would like to make a link in a external loaded text, but not a html: www.xxxxx.com but to the 'concerts' section on my own page.
    I have created a dynamic textbox where the external text will appear, and the famous link.

    How do I do this, can anyone help me please

    Thanks
    walterbob

  2. #2
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    <a href...

    In the ext. text file place an <a href> tag around the text you want to link.... OR you can make the entire text box a link by placing a link in the "link" feild in the properties window for the text feild. ex:

    in the text file:

    &myText=I saw <a href='http://www.britneyspears.com'>Britney Spears</a> at a restaurant and realized she is horrible.

    Hope this helps,
    1M.

  3. #3
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    as far as I know..this is NOT possible..

    you may be able to "trick" it though...maybe using the on textSelect... or maybe if the mouse coords & on MouseDown you can check for?...

  4. #4
    Junior Member
    Join Date
    Mar 2004
    Location
    home
    Posts
    7
    Thank you for your help, but yeah it seems like it is not that easy

    -waltertrailer
    walterbob

  5. #5
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    The concerts section is part of the flash content, not a separate HTML page? If so you can use asfunction to call a function defined in actionscript from an html link in a textfield.

    For example if your textfield contained the following html,

    <a href="asfunction:_root.myFunction">click me</a>

    clicking the link would call the function _root.myFunction - which could then handle displaying the concerts section (by going to another frame, calling loadMovie or whatever)

  6. #6
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    nice! I never knew about the "asfunction"

    is there a read up on it? Can it ONLY call a pre-determined function from the flahs movie? or can it actually handleactions/methods in the "link"?

    (such as not calling _root.myFunction...but say _root.gotoAndPlay(); ) for example?

    thanks.. this is the second time I have seen this question in the past 6 months or so... nice to have a different answer to give.

  7. #7
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    I think you can use built in functions such as gotoAndPlay - however asfunction is limited to only being able to pass a single argument to the function being called,

    asfunction:functionName,arg

    so something like this should work,

    asfunction:_root.gotoAndStop,2

    which is equilivent to _root.gotoAndStop(2)

    But if you want to use a function like loadMovieNum that requires more than 1 argument it takes a little more work (not too much more though )

    when you call a function via asfunction you can do something like this,

    asfunction:myFunction,arg1|arg2|arg3

    now here you still only pass 1 argument to myFunction, however myFunction can split the string using | as a separator to extract the 3 values arg1, arg2 and arg3 into an array - these can then be used as needed.

    So if were wanting to use loadMovieNum, we could create a new function (called doLoadMovie) like this,

    Code:
    function doLoadMovie(arg) {
        var args = arg.split("|"); // create an array from the argument supplied by asfunction
        loadMovieNum(args[0], args[1]); // use the values in this array with loadMovieNum
    }
    this might be called from asfunction using,

    <a href="asfunction:doLoadMovie,filename.swf|1">click to load filename.swf into level 1</a>

  8. #8
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    or alternately:
    Code:
    <a href="asfunction:doLoadMovie,filename.swf|targetName">click to load filename.swf into a containerClip</a>
    correct?

    nice to know..thanks for that little tidBit.. be nice to add some functionality and interaction from links in the text file...(however the functions still need to be in the movie somewhere.)

    (asfunction)....stashes away this little secret! LOL

  9. #9
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Quote Originally Posted by whispers
    or alternately:
    Code:
    <a href="asfunction:doLoadMovie,filename.swf|targetName">click to load filename.swf into a containerClip</a>
    correct?
    Yes, as long as the function doLoadMovie was written to use the appropriate version of loadMovie that should work fine.

  10. #10
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    not working

    Hey guys/ gals,
    I am attempting to use this functionality in a piece... to no avail. I have built a test file, real simple. In frame 5 I have:

    stop();
    testText = "<a href='asfunction:gotoAndStop(1)'>click here</a>";

    Now the "click here" text shows up in the text feild and the mouse recognizes there is a link, but no action follows. It remains in frame 5. I am setting various text feilds from within Flash, not an external var source. Any thoughts of how to call the AS functions from within the html text? THe feild is set as <>, btw.

    Thanks,
    1M.

  11. #11
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    a function call in asfunction works slightly differently to a regular function call. the function can only be passed one value and it is written in the form

    asfunction:functionname,value

    so for gotoAndStop(1) you would write,

    testText = "<a href='asfunction:gotoAndStop,1'>click here</a>";

  12. #12
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    that's it

    Thanks! Nice simple fix. Thanks,

    1M.

  13. #13
    Junior Member
    Join Date
    Aug 2004
    Posts
    16
    So how would I transform this

    showMitgl("airb");

    into an asfunction? Can an asfunction transport variables?

    I have my asfunction in an xml-file, that's what I tried so far, but it isn't working, the problem is not in the showMitgl function though.

    Code:
    <a href="asfunction:showMitgl,'airb'">text</a>
    What am I missing?
    Last edited by noiseburst; 06-23-2006 at 08:41 AM.

  14. #14

  15. #15
    Junior Member
    Join Date
    Aug 2004
    Posts
    16
    Quote Originally Posted by whispers
    try:
    <a href="asfunction:showMitgl,airb">text</a>
    instead..
    I tried, but it does't work either... but I keep thinking that there's sth. wrong with the " ' ' " quotes.

  16. #16
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    testText = "<a href='asfunction:showMitgl,airb'>text</a>";

    maybe like this then?? (if its already inside the " " of the textFile Var)

  17. #17
    Junior Member
    Join Date
    Aug 2004
    Posts
    16
    Thanks! I think we're getting closer!
    It works from a txt-File(even in the first version I posted), but not from my xml-File.
    So the quotes probably are part of the problem, I think the XML is not interpreting the quotes properly. Neither in my " ' ' "-version, nor in yours.

    Mh. I'm using UTF-8 encoding.
    And normal links work properly, when formatted like this:

    Code:
    <a href="http://www.somewebsite.com">text</a>
    and other asfunctions, like:
    Code:
    <a href="asfunction:gotoAndPlay,4">text</a>
    are working too…

  18. #18
    Junior Member
    Join Date
    Aug 2004
    Posts
    16
    I still haven't figured out what exactly I'm doing wrong. Does anybody else have an idea?

  19. #19
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    where is the function showMitgl defined? If it's on _root and your textfield isn't you could try using,

    <a href="asfunction:_root.showMitgl,airb">text</a>

  20. #20
    Junior Member
    Join Date
    Aug 2004
    Posts
    16
    Quote Originally Posted by catbert303
    where is the function showMitgl defined? If it's on _root and your textfield isn't you could try using,

    <a href="asfunction:_root.showMitgl,airb">text</a>
    Thanks. It's both on root though. I'm pretty sure it's an XML problem... The quotes don't get interpreted properly and without the quotes it doesn't work either... I guess I'll have to transfer it to a txt-file.

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