A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [MX] click button, image appears/disappears

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Posts
    4

    [MX] click button, image appears/disappears

    It's been years since I last coded in Flash so even if I remember some stuff, the mundane things escaped me...

    so please bear with me...

    several buttons
    several images

    upon loading. one image is visible, rest is not.
    when one button is clicked, the visible image goes off and another image, then invisible should now be visible.

    now, I realize that the code for the button should be
    Code:
    Button1.onRelease=function(){
    	image1._visible=true;
    	image2._visible=false;
    }
    where button1 is the instance name I put via the properties at the bottom of the window
    image1 and image2 is the instance name for the images.

    now, how do I set the images to be _visible=false when the movie loads?
    I set it in a frame right? but what exactly is the code?

    also, for the button codes, should the above code be OK?

    I realize I'm going to look like a noob but can you give me an example code?

    thanks

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    images to be _visible=false when the movie loads

    image1._visible = image2._visible = false;

    your button code is fine

  3. #3
    Junior Member
    Join Date
    Sep 2007
    Posts
    4
    the code for the images works, but my button idea flopped.

    I get this message on output

    Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on handler
    btn1.onRelease=function(){
    i attached a sample thingy for you all to tinker...
    Attached Files Attached Files

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on handler
    btn1.onRelease=function(){


    select the button
    give it an instance name - btn1
    cut the code from the actionscript editor
    select the main timeline (same frame as button)
    paste the code to the main timeline frame
    test

  5. #5
    Junior Member
    Join Date
    Sep 2007
    Posts
    4
    man... the simplest things are the things I forget... good thing there's this sticker with the words "diesel" at my fuel tank cap else I've blown it up a long time ago.


    thanks! worked like a charm.

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you're welcome

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