We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Adding visited and selected states to SimpleButton (Flash AS3)

Medium Priority
1,470 Views
Last Modified: 2013-11-11
How can I add visited and selected states, and a numerical ID to SimpleButton?
Comment
Watch Question

H01

Commented:
Hi dlearman1,

Do you mean you wanna dynamically change a text box text a object state in a button?

Author

Commented:
Out of the box, SimpleButton has four state properties: upState, overState, downState and hitTestState. What I have in mind is adding two new properties  selectedState (indicating the button is currently selected) & visitedState (indicating the button has been previously selected).  In addition I would like to add a unique identifier, so the button can be part of a selection system like a dropdown menu, for example.

It seems that I might need to create a dynamic class like public dynamic class CustomButton extends SimpleButton.  But I would like to avoid the dynamic declaration if possible.  But I'm jsut not sure how to bet go at this.
H01

Commented:
Hi dlearman1,

If you want to keep track of the user behaviour you can use a movieclip in combine with SharedObject, SharedObject can keep track of user behaviour and movie clip we have more flexibility to control it, you can see the sample I attach.

SharedObject.txt

Author

Commented:
Thanks for your input.  I'm really not trying anything that exotic.  I just want to create a menu that will show visible states for visited and selected.
H01

Commented:
Hi dlearman1,

Do you mean that after a user click on the button you want to change the button state to show that the user have click that button before? Correct me if I am wrong, because I still dont really get what you trying to do.

Author

Commented:
Yes that's pretty much it
H01

Commented:
Hi dlearman1,

The flash it self cant really keep track of that because everytime when you refresh the page the flash will reload it self and everything will reset. unless you use sharedObject to keep track of which button being click b4 then when everytime your flash is reload it will go to check the sharedobject data first to determind which button should be show as previously visited state or selected state.

Author

Commented:
I'm not trying to track behavior from previous visits.  I just want to show two additional states (selected and visited) during the current visitor session. This is analogous to the up, over down states already built into SimpleButton.
Commented:
Hi dlearman1,

To my understanding you cant control the simple button behaviour because its behaviour is build in and you cant add 2 more states to it. The simple work around will be using movieclip as a button.

I attach a sample for you hope help you out
Button.txt

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.