dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: API drawn duplicated button states....

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    118

    API drawn duplicated button states....

    Hi

    Anyone help with this code, what it does is draw a box dynamically and assign an onPress action to the box so when it is pressed the boxs alpha value is reduced from 100 to 50, however, the duplicated clips do not do this! Any reasons why? I thought that if you duplicate a movieClip it also has all the properties of the original and the onPress action would still work!
    //My code//

    stop();

    this.createEmptyMovieClip("heading", 1);
    heading.beginFill(0x9595FF, 100);
    heading.lineStyle(0.25, 0x666666, 100);
    heading.moveTo(0, 0);
    heading.lineTo(150, 0);
    heading.lineTo(150, 20);
    heading.lineTo(0, 20);
    heading.lineTo(0, 0);
    heading.endFill();
    heading.onPress = function() {
    heading._alpha = 50;
    };
    for (i=0; i<1; i++) {
    heading.duplicateMovieClip("heading"+i, i+10);
    this["heading"+i]._x = 150+i*0;

    }

  2. #2
    Senior Member FPChris's Avatar
    Join Date
    May 2003
    Location
    NJ
    Posts
    644
    You only set it up for the initial 'heading' not the dups.

    in your loop try...

    this["heading"+i].onPress = function(){ this._alpha = 50; }

    That might do it, i didn't test it but it looks right.

    Chris
    http://www.**********-dms.com

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    118
    You are a god, Thankyou very much indeed, i have been pulling my hair out over this for a few days!


  4. #4
    Senior Member FPChris's Avatar
    Join Date
    May 2003
    Location
    NJ
    Posts
    644
    Thank you, Thank you
    http://www.**********-dms.com

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