You could try setting up a show event listener to trigger your
initialization code. Something like this:
<mx:ViewStack>
<mx:Canvas show="handleShowEvent()"/>
</mx:ViewStack>
Whenever the ViewStack makes the canvas the visible/active one, the show
event would fire.
or if your Canvas is an mxml component, it could handle the show event
internally:
<mx:ViewStack>
<view:MyCanvas/>
</mx:ViewStack>
MyCanvas.mxml
<mx:Canvas show="handleShowEvent()">
<mx:Script>
private function handleShowEvent(event:FlexEvent):void
{
// call initialize code
}
</mx:Script>
</mx:Canvas>
Then each of your components in the ViewStack would manage their respective
show events.
Tim
On 23 Mar 2007 17:02:56 -0700, wdsnapper <[EMAIL PROTECTED]> wrote:
I am using a ViewStack to contain a set of Canvas'. I switch between
items in the stack by clicking on buttons. I want to be able to
detect when a Canvas gains focus and run a method to initialize
content on that Canvas.
What is the correct event to monitor to achieve this behavior?
Thanks in advance.
--
Tim
timwalling.com