dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: how can i fill input text by created keybord buttons

  1. #1
    Senior Member
    Join Date
    May 2016
    Posts
    105

    how can i fill input text by created keybord buttons

    hello

    i created keyboard buttons
    how can i fill input text by created keybord buttons

    Attached Files Attached Files

  2. #2
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    Is that flash? looks different

  3. #3
    Senior Member
    Join Date
    May 2016
    Posts
    105
    swishmax4

  4. #4
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    Is it actionscript? if yeah 2 or 3

  5. #5
    Senior Member
    Join Date
    May 2016
    Posts
    105
    actionscript 3

  6. #6
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    I made a fla for you here with a keyboard: https://rpguy.weebly.com/

  7. #7
    Senior Member
    Join Date
    May 2016
    Posts
    105
    can you send script

  8. #8
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    PHP Code:
    var screenBounds={width:600,height:600}
    stage.scaleMode StageScaleMode.NO_SCALE;
    stage.align StageAlign.TOP_LEFT;



    build_login()
    function 
    build_login(){
    var 
    bg:bg_pl=new bg_pl();
    addChild(bg);
    bg.name="bg";
    bg.width=screenBounds.width;
    bg.height=screenBounds.height;
    var 
    bar_container:MovieClip=new MovieClip();
    addChild(bar_container);
    bar_container.name="bar_container";
    var 
    user_input:text_input=new text_input();
    bar_container.addChild(user_input);
    user_input.name="user_input";
    user_input.width=int(screenBounds.width/2.3);
    user_input.scaleY=user_input.scaleX;
    user_input.default_y=user_input.y;
    user_input.bar_title.text="username,";
    user_input.bar_title.selectable=false;
    user_input.bar_title.mouseEnabled=false;
    user_input.bar_fill_in.selectable=false;
    user_input.bar_fill_in.mouseEnabled=false;
    user_input.limit=12;

    var 
    pass_input:text_input=new text_input();
    bar_container.addChild(pass_input);
    pass_input.name="pass_input";
    pass_input.width=int(screenBounds.width/2.3);
    pass_input.scaleY=pass_input.scaleX;
    pass_input.y+=int(bar_container.height*1.5)
    pass_input.default_y=pass_input.y;
    pass_input.bar_title.text="password,";
    pass_input.bar_title.selectable=false;
    pass_input.bar_title.mouseEnabled=false;
    pass_input.bar_fill_in.selectable=false;
    pass_input.bar_fill_in.mouseEnabled=false;
    pass_input.limit=12;

    bar_container.x=int(screenBounds.width/2-bar_container.width/2);
    bar_container.y=int(screenBounds.height/2-bar_container.height/1.8);
    bar_container.default_y=bar_container.y;
    }


    addEventListener(MouseEvent.MOUSE_UP,mu);
    addEventListener(MouseEvent.MOUSE_DOWN,md);
    var 
    backSpaceHoldTimer;
    function 
    backSpaceRelay(){
    if(
    focused_text_field!=null&& md_target!=null &&stage.mouseX>md_target.x&&stage.mouseX<md_target.x+md_target.width&& int(-(screenBounds.height-getChildByName("keyboardContainer").height-stage.mouseY))>md_target.y&&int(-(screenBounds.height-getChildByName("keyboardContainer").height-stage.mouseY))<md_target.y+md_target.height){
    focused_text_field.text=focused_text_field.text.substr(0,focused_text_field.text.length-1);
    clearTimeout(backSpaceHoldTimer);
    backSpaceHoldTimer=setTimeout(backSpaceRelay,100);
    }
    }
    var 
    md_target=null
    function md(e:*){
    md_target=e.target
    if(e.target.name.charAt(0)=="$"&&e.target.name.split("y")[1]=="37"){
    focused_text_field.text=focused_text_field.text.substr(0,focused_text_field.text.length-1);
    clearTimeout(backSpaceHoldTimer);
    backSpaceHoldTimer=setTimeout(backSpaceRelay,500);
    }
    }

    function 
    mu(e:*){
    md_target=null;
    trace(e.target.name);
    if(
    keyboardUp&&stage.mouseY<getChildByName("keyboardContainer").y){
    if(
    keyboard_focus_names.indexOf(e.target.name)==-1){
    keyboard_pack("destroy",null,null);
    }
    }
    if(
    e.target.name=="user_input"){
    keyboard_pack("build",e.target.parent.name,e.target.bar_fill_in);
    MovieClip(MovieClip(getChildByName("bar_container")).getChildByName("pass_input")).visible=false;
    getChildByName("bar_container").y=int(getChildByName("keyboardContainer").y-MovieClip(MovieClip(getChildByName("bar_container")).getChildByName("user_input")).height);
    }
    if(
    e.target.name=="pass_input"){
    keyboard_pack("build",e.target.parent.name,e.target.bar_fill_in);
    MovieClip(MovieClip(getChildByName("bar_container")).getChildByName("user_input")).visible=false;
    getChildByName("bar_container").y=int(getChildByName("keyboardContainer").y-getChildByName("bar_container").height);
    }
    if(
    e.target.name.charAt(0)=="$"&&e.target.name.split("y")[1]!="44"&&e.target.name.split("y")[1]!="37"&&e.target.name.split("y")[1]!="42"&&e.target.name.split("y")[1]!="29"){
    if(
    focused_text_field.length<focused_text_field.parent.limit){
    focused_text_field.text+= keyboard_field[int(e.target.name.split("y")[1])]
    }
    }
    if(
    e.target.name.charAt(0)=="$"&&e.target.name.split("y")[1]=="42"&&focused_text_field.length<focused_text_field.parent.limit){
    focused_text_field.text+=" ";
    }
    }

    var 
    ky;
    var 
    keyboardUp:Boolean=false;
    var 
    keyboard_field = ["1","2","3","4","5","6","7","8","9","0","q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","^","z","x","c","v","b","n","m","<x]","","","?",",","__",".","ok","","","","",""]
    var 
    keyboard_focus_names=["user_input","pass_input"];
    var 
    keyboard_focus_parent=null
    var focused_text_field=null
    function keyboard_pack(a,b,c){
    if(
    a=="build"){
    if(
    getChildByName("keyboardContainer")==null){
    focused_text_field=c
    keyboard_focus_parent
    =b;
    var 
    keyboardContainer:MovieClip = new MovieClip();
    addChild(keyboardContainer);
    keyboardContainer.name="keyboardContainer";
    keyboardContainer.x=0;
    var 
    keyboard_var:keyboard=new keyboard();
    keyboardContainer.addChild(keyboard_var);
    keyboard_var.width=screenBounds.width
    keyboard_var
    .height=int(screenBounds.height/2.7);
    keyboard_var.name="keyboard_var";
    var 
    x_spot:Number=0;
    var 
    y_spot:Number=0;
    for(
    ky=0;ky<50;ky++){
    var 
    key_var:keyboard_key = new keyboard_key();
    keyboardContainer.addChild(key_var);
    key_var.data_field.text=keyboard_field[ky];
    key_var.data_field.mouseEnabled=false;
    key_var.width=int(screenBounds.width/10);
    key_var.height=int(keyboardContainer.height/5);
    key_var.name="$key"+ky;
    if(
    ky>0){
    key_var.x+=x_spot;
    key_var.y+=y_spot;
    }
    x_spot+=key_var.width;
    if(
    ky==9){
    x_spot=0;
    y_spot+=key_var.height;
    }
    if(
    ky==19){
    x_spot=int(key_var.width/2);
    y_spot+=key_var.height;
    }
    if(
    ky==28){
    x_spot=int(key_var.width/2);
    y_spot+=key_var.height;
    }
    if(
    ky==39){
    x_spot=int(key_var.width/2);
    y_spot+=key_var.height;
    }
    if(
    ky==42){
    x_spot+=key_var.width*4
    key_var
    .width*=5
    }
    if(
    keyboard_field[ky]==""){
    keyboardContainer.removeChild(key_var);
    }
    }
    keyboardUp=true;
    getChildByName("keyboardContainer").y=screenBounds.height-getChildByName("keyboardContainer").height
    }
    }else{
    if(
    getChildByName("keyboardContainer")!=null){
    keyboardUp=false;
    focused_text_field=null;
    removeChild(getChildByName("keyboardContainer"));
    if(
    keyboard_focus_parent!=null){
    getChildByName(keyboard_focus_parent).y=MovieClip(getChildByName(keyboard_focus_parent)).default_y;
    if(
    keyboard_focus_parent=="bar_container"){
    MovieClip(getChildByName(keyboard_focus_parent)).getChildAt(0).visible=true;
    MovieClip(getChildByName(keyboard_focus_parent)).getChildAt(1).visible=true;
    }
    }
    }
    }


  9. #9
    Senior Member
    Join Date
    May 2016
    Posts
    105
    thank you , but not working

  10. #10
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    post fla

  11. #11
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,776
    Hi,

    He uses swishmax

  12. #12
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    post fli

  13. #13
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    or maybe it'd be called .flo

  14. #14
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,776
    Hi

    He did on the first or second post.
    It's called *.swi

  15. #15
    Senior Member
    Join Date
    May 2016
    Posts
    105
    hi
    swishmax file called *.swi
    Attached Files Attached Files

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