The short answer to your question is that parent.currentState = 'touchOptions' would work (but see caveats below). If you're just doing a quick and dirty prototype, this might be enough.
The long answer to your question is that if you want to build a large scale app, you probably don't want the menu directly setting the current state of its parent, because it would be fragile. For example, if you decided to put the sidebar menu inside of a VBox for layout reasons, the code above would break.
For the "real" answer, you probably want to send an event from the sidebar menu, which is then caught by the parent, which should change its current state in response to that.
I don't have time to write working code right now, as I have to meet people for dinner (east coast time.. working in Boston this week), but it would look something like this:
SendSidebarMenu.mxml
--
<Script>
public function sendNavigateMessage(var where : String)
{
var event : Event = new Event("navigate");
event.where = where; // might need to cast to Object here to avoid compiler warning.
dispatchEvent(event);
}
</Script>
...<LinkButton click="dispatchEvent(new Event("navigate")
SendStates.mxml
--
<HBox initialize="onInit()">
<Script>
public function onInit()
{
sendMenu.addEventListener("navigate", onNavigate);
}
public funciton onNavigate(event: Event) : void
{
currentState = event.where; // might need to cast to Object here.
}
</Script>
</HBox>
-Sho
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ethan Miller
Sent: Tuesday, May 23, 2006 1:05 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Referencing States from Custom Components
On May 23, 2006, at 12:47 PM, Tim Hoff wrote:
> Can you provide code?
Yes, and thanks for the help! Attached are two files:
SendStates.mxml
This file defines the various view states. This file sources in the
second file using the tag <nf:SendSidebarMenu> (note the custon "nf"
name space).
SendSidebarMenu.mxml
ThIs file includes linkButtons which attempt to load various stats in
SendStates.mxml
As reminder, I've tried the following in the click handlers.
parentDocument.touchOptions
outerDocument.touchOptions
SendStates.touchOptions
(touchOptions being one of the named states in SendStates.mxml)
cheers, ethan
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

