Setting the state of a button using actionscript

This is a discussion on "Setting the state of a button using actionscript" within the Flash & Multimedia Forum section. This forum, and the thread "Setting the state of a button using actionscript are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 27th, 2006, 09:22
Junior Member
Join Date: Feb 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Setting the state of a button using actionscript

I would like to set the state of a button to its down state onrelease.

I have tried the following:
on (release) {this.
gotoAndPlay("down");
}


I even tried putting a frame label of down on the down frame in the button but that doesn't work either. There must be a way to do this with actionscript but how?
Reply With Quote

  #2 (permalink)  
Old Sep 27th, 2006, 19:02
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Smile Re: Setting the state of a button using actionscript

I will make one suggestion, if this does not work, I need to see a sample fla file. Here is my only suggestion.

Code: Select all
on(release){
    with(_root){
    this.gotoAndPlay("down");
    }
Reply With Quote
  #3 (permalink)  
Old Sep 28th, 2006, 15:37
Junior Member
Join Date: Feb 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Setting the state of a button using actionscript

Hmm. Ok. I got a syntax error until I took out one bracket. Now I have this

Code: Select all
on(release){
    with(_root)
    this.gotoAndPlay("down");
    }
Doesn't work though. I am not sure why you need a sample fla but I have attached one. Its just an fla with one button in it. I just want to lock that button to the down state after it is clicked and be able to set it back to the up state when another button is clicked. Like a navbar system.

I have been told it is not possible unless I convert the button to a movie clip but then the actionscripting gets quite complicated.
Attached Files
File Type: zip test.zip (4.5 KB, 48 views)
Reply With Quote
  #4 (permalink)  
Old Sep 28th, 2006, 15:58
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: Setting the state of a button using actionscript

OK I needed the flash fla file to better trouble shoot your problem, it is easier if you can look at a sample file and fix it then just look at the code. As for your problem. I have never heard of doing this with a button in action script 1, or 2. But I think this is possible in the new version of action script 3.0. Here is a link. Sorry I could not help you any further.

http://livedocs.macromedia.com/flex/...html#downState
Reply With Quote
  #5 (permalink)  
Old Oct 13th, 2006, 10:58
New Member
Join Date: Oct 2006
Location: Surrey
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Setting the state of a button using actionscript

Hi,

Did you ever find a solution for this?

I have a related sort of a problem. I just want my buttons to appear in their "over" or "down" state (it doesn't really matter which) when they have been pressed. For example, I want the "portfolio" page button to appear in it's "down" state when the portfolio page is displayed. I have tried to do this by setting variables, but without any luck.

Any suggestions?

Cat..
Reply With Quote
  #6 (permalink)  
Old Oct 13th, 2006, 11:27
Junior Member
Join Date: Feb 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Setting the state of a button using actionscript

No I didn't find a solution to it other than making the button into a movie clip and then having to script the whole roll over functionality first.
Reply With Quote
  #7 (permalink)  
Old Oct 18th, 2006, 14:45
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: Setting the state of a button using actionscript

true shame...lol

I think that is what you will have to do, make it a movie clip. Besides that is not that hard.
Reply With Quote
Reply

Tags
flash, button states, button, onrelease function

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Movieclip button active state problem !! Help Please !! alladeen Flash & Multimedia Forum 6 Oct 25th, 2007 14:40
How to retain the disable state of the button after page refreshing srinivasyadav JavaScript Forum 1 Sep 9th, 2007 14:17
Radio Button Problems in ActionScript 3.0 dgstarr Flash & Multimedia Forum 1 Sep 6th, 2007 17:11
Button triggering movie state WakeoftheBunT Flash & Multimedia Forum 3 Nov 6th, 2006 13:15


All times are GMT. The time now is 20:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43