A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: most basic button question ever...

  1. #1
    Junior Member
    Join Date
    Sep 2004
    Posts
    5

    most basic button question ever...

    So I've written some action script:

    code:

    stop();
    instanceName.onPress = function() {
    gotoAndPlay(2);
    };



    And I can't figure out how to get it to work as I am unsure of how to name the button... the
    code:
    instanceName

    bit - I thought it was the name you give the button when you create the symbol itself, but not it seems.

    Can anyone help?

    Cheers.
    http://www.plugincinema.com

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    Click on the button on the stage, and then look at the properties panel - you'll see a spot there where you are supposed to type in the name.

    There are three 'names' an object has.

    When you create/insert a symbol you are asked to name it in the dialog box. This name is not used in actionscript, but is just used to identify objects while authoring.

    You can name instances of movieclips, as I described above - this enables different copies of the same symbol to have different names. These names are referred to in actionscript.

    You can export a symbol in the library, using the linkage... command, this is the name used in the attachMovie() command.

    - Jim

  3. #3
    Junior Member
    Join Date
    Sep 2004
    Posts
    5

    thanks...and...

    Thanks for that. Got me on my way.

    However now I have a new question!

    I have a symbol, which has lots of animations going on. Problem is when I place that symbol into the main scene, the anims of the symbol loop over and over - even though I have placed a stop action script commant at the end of the time line in the symbol in question!

    How I make a symbol that has tweened anims - but that only does 1 cycle of these anims?

    Cheers.
    http://www.plugincinema.com

  4. #4
    Junior Member
    Join Date
    Oct 2001
    Posts
    5
    OK reckon this is what you want...
    Click on the button you want to name, in the properties panel at the bottom under the dropdown where you choose what it is you'll see <Instance Name>. Go ahead, type in something relevant like "Butt" and replace the ActionScript suitably.
    http://bored.2itb.com/images/logo.gif

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