A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: text question: proove your guruness if u can

Hybrid View

  1. #1

    text question: proove your guruness if u can

    Is there a way to give text boxes hit detection functionality w/o using buttons?

    Flash does this to a certin extent when u place -A- tags around some html text. It automaticly allows that peice of text to detect on click events. (even if it is a single word in a paragraph) Is there some way to replicated this functionality in a normal textbox so that you can execute callBack functions onClick? Or, alternativly, is there some way for Flash to detect when a user clicks a flash-HTML link and execute a flash function?

    http://sites.slicker.com/charlestonr...te/cssnav.html

    the sub nav (visible after XML loads) is a single dynamic text box with HTML -a- tags to provide link functionality. I also need to detect what link they hit and set another text box to the associated title, however. If flash is in a framed window, how would I know what link the user clicked on so i can set the text?

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The asfunction makes it possible to execute internal actions with html links in textfields.
    Make a search for asfunction, theres a lot of threads on this forum about it. I have no expertice myself on the subject though.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    thanks man, ill look into it.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    218
    I pump text boxes full of HTML-encoded asfunction calls on a daily basis:

    PHP Code:
    for (i=0i<=yourArray.lengthi++) {
        
    textBox_txt += "<a href=\"asfunction:fbx_switch," link "\">" linkText "</a><br>";

    And I like it!


    hth,

    Mike

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    it is possible to give text boxes hit detection functionality w/o using buttons, try this -

    TextField.prototype.hitTest = hitTest;
    _root.createTextField("field1",1,100,100,100,20);
    field1.selectable = false;
    field1.border = true;
    field1.borderColor = 0xFF0000;
    field1.text = " field1 ";
    _root.createTextField("field2",2,300,100,100,20);
    field2.selectable = false;
    field2.border = true;
    field2.borderColor = 0xFF0000;

    _root.onMouseMove = function(){
    if(field1.hitTest(_level0._xmouse, _level0._ymouse)){
    field2.text ="field1 hit";
    field2.borderColor = 0x0000FF;
    field1.borderColor = 0x00FF00;
    }else{
    field2.text ="";
    field1.borderColor = field2.borderColor = 0xFF0000;
    }
    };
    _root.onMouseDown = function(){
    if(field1.hitTest(_level0._xmouse, _level0._ymouse)){
    field2.text ="ouch";
    field2.borderColor = 0xFF00FF;
    field1.borderColor = 0x00FF00;
    }
    };

  6. #6
    yes indeed. Now that I know this, my dynamic flashing will be changed forever. This is some seriously great info, they should print it on the front of the box ..... sweet


  7. #7
    thanks for code, but I never know how big my text is and I want to just spit it into a slingle box and get flash interactivity. Being able to call functions from A tags is the best damn thing ive ever heard of!

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