A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Dynamic HTML code with AS commands?

  1. #1
    Hairy Member robbmcaulay's Avatar
    Join Date
    Dec 2001
    Location
    Edinboro, yo!
    Posts
    1,596

    Dynamic HTML code with AS commands?

    Hey, I have a dynamic news system (www.robbmc.com) and it allows me to add HTML hyperlinks which launch new pages.

    All I want to do is be able to add a simple...
    Code:
    on(release){
        _root.mc_news.gotoAndstop("news item 1");
    }
    Is this possible?

    And also... why when I embed the font then add html tags like <b> and <i> the text fails to show up?

    Thanks, Robb
    "Wah wah wah Dorothy Parker wah wah wah" - hanratty21

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Yes it is possible

    All you neeed to do is add a function into the ketframe of the dynamic text that the html code is being loaded into.

    html:
    <a href="asfunction:loadf1"><u>F1 crash user poll</u></a>

    Flash on a keyframe:

    function loadf1() {
    _root.win5stat = true;
    _root.win5.loadMovie("someswf.swf");
    _root.win5._x = (Math.ceil(150));
    _root.win5._y = (Math.ceil(100));
    _root.frontMe(_root.win5);
    _root.menu1.nav.menpt1.nbut5.enabled = false;
    _root.menu1.nav.menpt1.bt_id5.gotoAndStop(3);
    _root.menu1.nav.menpt1.col_clip5._alpha = 40;
    }
    This is taking straight from my site so i know it does work

    _paul
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Hairy Member robbmcaulay's Avatar
    Join Date
    Dec 2001
    Location
    Edinboro, yo!
    Posts
    1,596
    Hey, thanks, that helps alot but i'm still having problems...

    Here is the content of my text file...
    Code:
    content=
    <a href="asfunction:newsa"><p align="center">Link 1</P></a>
    |<a href="asfunction:newsb"><p align="center">Link 2</p></a>
    |<a href="asfunction:newsc"><p align="center">Link 3</p></a>
    |<a href="asfunction:newsd"><p align="center">Link 4</p></a>
    |<a href="asfunction:newse"><p align="center">Link 5</p></a>
    That looks okay? The text scrolls and changes acordingly, so that's okay... it even shows the little hand to show it's a link...

    Here is the actionscript placed in the very same frame that the dynamic text box is on...
    code:

    // Sets up news functions for the 'news' txt to call :
    function newsa() {
    _root.mc_news.gotoAndstop("news1");
    }
    //--------------------------------------
    function newsb() {
    _root.mc_news.gotoAndstop("news2");
    }
    //--------------------------------------
    function newsc() {
    _root.mc_news.gotoAndstop("news3");
    }
    //--------------------------------------
    function newsd() {
    _root.mc_news.gotoAndstop("news4");
    }
    //--------------------------------------
    function newse() {
    _root.mc_news.gotoAndstop("news5");
    }
    //-----------------------------------END


    I have an MC named mc_news on the main timeline with the correct frame labels etc. (as in... i'm not a total newbie).

    What is going on? Got any ideas?

    When I click the link... nothing happens...
    "Wah wah wah Dorothy Parker wah wah wah" - hanratty21

  4. #4
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Very strange. it should work

    Will build an fla in the morning testing it and will send you this file.

    _paul
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    give this a try:
    in the textfile
    <a href="asfunction:news,news1">

    with a script
    function news(where)
    { _root.mc_news.gotoAndstop(where);
    }

    Note: some players (definitely FP5 for netscape) do not like it at all if you remove the currently clicked text with a goto action

    Musicman

  6. #6
    Hairy Member robbmcaulay's Avatar
    Join Date
    Dec 2001
    Location
    Edinboro, yo!
    Posts
    1,596
    K, Thanks Musicman, will try that when I get home... Looks promising...

    Webdreamer... will look forward to that FLA.

    Thanks folks, Robb
    "Wah wah wah Dorothy Parker wah wah wah" - hanratty21

  7. #7
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    I would try what the musicman has put here first. Far better coder than myself
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  8. #8
    Hairy Member robbmcaulay's Avatar
    Join Date
    Dec 2001
    Location
    Edinboro, yo!
    Posts
    1,596
    Ok, tried your suggestion musicman but it ain't workin, I am using a component thingy so i'll try it normally and see...

    Webdreamer, a FLA would be really helpful at this stage...

    Cheers, Robb
    "Wah wah wah Dorothy Parker wah wah wah" - hanratty21

  9. #9
    Hairy Member robbmcaulay's Avatar
    Join Date
    Dec 2001
    Location
    Edinboro, yo!
    Posts
    1,596
    After a two-month break, i've come back to this problem and could really do with some help...

    Anyone willing to knock up a working FLA so I can get the basics?

    It would help alot, thanks...

    Robb
    "Wah wah wah Dorothy Parker wah wah wah" - hanratty21

  10. #10
    flash fiend
    Join Date
    Dec 2000
    Location
    Bellingham, WA
    Posts
    63

    working fla...

    got a working example, run it in test mode so you can see the trace...
    Attached Files Attached Files
    My flash never has bugs, it just develops random features.

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