Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Using An Array With This Script

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using An Array With This Script

    Hi All,

    I have this script
    Code:
    onClipEvent (load) {
    	this.xGlowTo(0x2F0000, 1, 30, 1, 3, false, false, 0);
    which applies to a movie clip on my timeline, however I have set up an array var myButtons = [this.right_1, this.right_2, this.right_3, this.right_4]; is this correct? Now how do I make the first script apply to all?

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    put it here:

    Code:
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    	this.xGlowTo(0x2F0000, 1, 30, 1, 3, false, false, 0);
    remove it from where ever else it is.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    put it here:

    Code:
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    	this.xGlowTo(0x2F0000, 1, 30, 1, 3, false, false, 0);
    remove it from where ever else it is.
    Hmmm the glow didn't happen?

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Ack.. sorry, I am missing the glow. That is a version 8 thing.

    What is it doing now and what SHOULD it do?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It doesn't do anything... But what it should do is put a glow around each button...

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    The glow is already defined in the AS file, why would you need to duplicate the script on the buttons?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    The glow is already defined in the AS file, why would you need to duplicate the script on the buttons?
    Ok I removed it from all the buttons and then just added the code to the as
    for (var i=0; i<myButtons.length; i++) {
    // Sets its original X value. This will be used later for reference.
    myButtons[i].originalX = myButtons[i]._x;
    this.xGlowTo(0x2F0000, 1, 30, 1, 3, false, false, 0);
    but the code doesn't make the buttons glow... It should yea?

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    no. I mean it is already defined in the mc_tween.as file.

    It (theoretically) shouldn't be in the buttons anywhere. Remove it from that line and see what you get.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    no. I mean it is already defined in the mc_tween.as file.

    It (theoretically) shouldn't be in the buttons anywhere. Remove it from that line and see what you get.
    Oh... No that .as file is just set's up all the tween, including the glow tween... You still have to "activate" them in the flash movie. If I add this to each button/mc
    Code:
    onClipEvent (load) {
    	this.xGlowTo(0x3C0000, 1, 20, 1, 3, false, false, 1);
    }
    it works for the individual button... But I have so many buttons that I thought I could add it to the array area... But with the previous code you gave me it just didn't seem to work

  10. #10
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by tomyknoker
    Oh... No that .as file is just set's up all the tween, including the glow tween... You still have to "activate" them in the flash movie. If I add this to each button/mc
    Code:
    onClipEvent (load) {
    	this.xGlowTo(0x3C0000, 1, 20, 1, 3, false, false, 1);
    }
    it works for the individual button... But I have so many buttons that I thought I could add it to the array area... But with the previous code you gave me it just didn't seem to work
    AHHHHH I got it to work using this
    Code:
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    	myButtons[i].xGlowTo(0x2F0000, 1, 30, 1, 3, false, false, 0);
    Atleast something going right today! Any luck with my other post?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •