PDA

View Full Version : How to run function when loading swf


TheBigDaddy
01-24-2007, 02:56 PM
Is there anyway to do functions when the swf is loading?

I am building a accordion and i would like it load in the xml when the application is strating up.

Tink
01-24-2007, 03:05 PM
It's not possible to load something into something that isn't there, so the answer is no. You need to wait for the SWf to load, before its contents are created and you can load content into them.

TheBigDaddy
01-24-2007, 03:22 PM
But if you dont wont to you a button to call the function that fills the accordion , is there any other way, so that the accordion fills itself from a function.

Like the click="function();" whitout having to click:)

Tink
01-24-2007, 03:36 PM
when the Application has loaded and created its components in dispatches a creationComplete event. you can catch this like so.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete( event );".

<mx:Script>
<![CDATA[

import mx.events.FlexEvent;

private function onCreationComplete( event:FlexEvent ):void
{
// your code here
}

]]>
</mx:Script>

</mx:Application>

TheBigDaddy
01-24-2007, 03:52 PM
Many thanks!!