dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: dynamic button

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271

    dynamic button

    Greetings

    I have created a dynamic button which is a component.

    It has parameters for the button label and frame label.

    The button label works fine but not the goto frame label.

    this is the code that I use for the frame label:

    PHP Code:
    on (release) {

        
    //Movieclip GotoAndStop Behavior
        
    this.gotoAndStop(label);
        
    //End Behavior


    I have then set the component definition to have the var of label - but still not working.

    Thanks for any help

  2. #2
    Senior Member
    Join Date
    May 2004
    Location
    UK
    Posts
    200
    shouldnt it be:

    code:

    on (release) {

    //Movieclip GotoAndStop Behavior
    this.gotoAndStop("label");
    //End Behavior

    }



  3. #3
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271
    no that wont work because I am using the word 'label' as a variable not as an actual frame label.

    Thanks anyway

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,
    I have created a dynamic button which is a component.
    I don't undertand what this means...

    If your button is a button, this refers to the timeline the button is attached to. So, label would be the frame label of the timeline the button is attached to.
    If the button is a movie clip, this refers to the movie clip button. So, label would be a frame label of the movie clip.

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271
    the button is inside a movie clip.

    Its what used to be called a smart clip - now called a component.

    I am wanting to have the component except a variable value for a frame label.

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    Ok.
    The code will depend on the timeline you want to control, i.e., the timeline that has the frame label called label.

    And make sure that the variable label is available to that script.

    Both this issues should be a target paths matter.
    Read understanding target paths for more details.

    code:

    on (release) {
    trace(label); // to make sure the variable is correct
    // try
    this._parent.gotoAndStop(label);
    // or
    // this._parent._parent.gotoAndStop(label);
    // or...
    }


  7. #7
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271
    Thanks nunomira!

    That worked a treat mate!

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