A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Urgent Help Please!

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    2

    Unhappy Urgent Help Please!

    Hi! I'm new in this forum because really i need your help please, the problem is this:

    On my movie, i have a 3 Buttons on the same frame and a text box i want that when people click on each button the text on the text box change, do you know how can i do this? please i really need this, please!

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    This is quite easy if you know the basics in Flash, and I am pretty sure there are dozens of flash tutorials on how to do this, code on Frame when assuming you have given the three buttons the instance names, my_btn1, my_btn2, my_btn3, and the textfield an Instance name of, my_txt:

    Actionscript Code:
    my_btn1.onPress = function(){
        my_txt.text = "You pressed button 1";
    }

    my_btn2.onPress = function(){
        my_txt.text = "You pressed button 2";
    }

    my_btn3.onPress = function(){
        my_txt.text = "You pressed button 3";
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Quote Originally Posted by Nig 13 View Post
    This is quite easy if you know the basics in Flash, and I am pretty sure there are dozens of flash tutorials on how to do this, code on Frame when assuming you have given the three buttons the instance names, my_btn1, my_btn2, my_btn3, and the textfield an Instance name of, my_txt:

    Actionscript Code:
    my_btn1.onPress = function(){
        my_txt.text = "You pressed button 1";
    }

    my_btn2.onPress = function(){
        my_txt.text = "You pressed button 2";
    }

    my_btn3.onPress = function(){
        my_txt.text = "You pressed button 3";
    }
    Thanks for your help but when i want to test my movie i'm getting an error saying this "Error 1119: Access of possibly undefined property enemyList through a reference with static type Flash.display:SimpleButton."

    I'm new using Flash i'm feeling sad because i think this is easy but just look i can't do it :S

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Maybe you should've stated that you're using Actionscript 3.0, and rather post the question over at AS3 forum ?

    Anyways, here's the code for AS3, what you're using:

    Actionscript Code:
    import flash.events.MouseEvent;

    my_btn1.addEventListener(MouseEvent.CLICK, btn_1);
    my_btn2.addEventListener(MouseEvent.CLICK, btn_2);
    my_btn3.addEventListener(MouseEvent.CLICK, btn_3);

    function btn_1(e:MouseEvent):void{
        my_txt.text = "You pressed button 1";
    }

    function btn_2(e:MouseEvent):void{
        my_txt.text = "You pressed button 2";
    }

    function btn_3(e:MouseEvent):void{
        my_txt.text = "You pressed button 3";
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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