nkightley
09-18-2008, 04:02 PM
Hi all
I've created a Flex application that has several different screens, effects on each screen, scripts used throughout, etc & want to split all this lot up into different components.
How do I go about this?
Here's a simple example of what I've done & am try to achieve:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="clickButton1();clickButton2();">
<!-- TO BE CREATED AS A COMPONENT -->
<mx:Button id="btnTest1" label="Sequence MouseDown Test" mouseDownEffect="{btnEffect1}" />
<mx:Button id="btnTest2" label="Parallel Click Test" click="clickButton2();" />
<!-- TO BE CREATED AS EFFECT COMPONENTS -->
<mx:Sequence id="btnEffect1" target="{btnTest1}">
<mx:Fade alphaFrom="1.0" alphaTo="0.2" />
<mx:Rotate duration="1000" />
<mx:Fade alphaFrom="0.2" alphaTo="1.0" />
</mx:Sequence>
<mx:Parallel id="btnEffect2" target="{btnTest2}">
<mx:Fade alphaFrom="1.0" alphaTo="0.2" />
<mx:Rotate duration="1000" angleTo="-360"/>
<mx:Fade alphaFrom="0.2" alphaTo="1.0" />
</mx:Parallel>
<!-- TO BE CREATED AS A SCRIPT FILE -->
<mx:Script>
<![CDATA[
private function clickButton1():void {
btnEffect1.play();
}
private function clickButton2():void {
btnEffect2.play();
}
]]>
</mx:Script>
</mx:Application>
I want to have one component with the 2 buttons in, one component with the button effects in & one AS script file containing the script code.
I then want to link it all back together in the main MXML application file.
Any help would be appreciated!
Cheers
Neil
I've created a Flex application that has several different screens, effects on each screen, scripts used throughout, etc & want to split all this lot up into different components.
How do I go about this?
Here's a simple example of what I've done & am try to achieve:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="clickButton1();clickButton2();">
<!-- TO BE CREATED AS A COMPONENT -->
<mx:Button id="btnTest1" label="Sequence MouseDown Test" mouseDownEffect="{btnEffect1}" />
<mx:Button id="btnTest2" label="Parallel Click Test" click="clickButton2();" />
<!-- TO BE CREATED AS EFFECT COMPONENTS -->
<mx:Sequence id="btnEffect1" target="{btnTest1}">
<mx:Fade alphaFrom="1.0" alphaTo="0.2" />
<mx:Rotate duration="1000" />
<mx:Fade alphaFrom="0.2" alphaTo="1.0" />
</mx:Sequence>
<mx:Parallel id="btnEffect2" target="{btnTest2}">
<mx:Fade alphaFrom="1.0" alphaTo="0.2" />
<mx:Rotate duration="1000" angleTo="-360"/>
<mx:Fade alphaFrom="0.2" alphaTo="1.0" />
</mx:Parallel>
<!-- TO BE CREATED AS A SCRIPT FILE -->
<mx:Script>
<![CDATA[
private function clickButton1():void {
btnEffect1.play();
}
private function clickButton2():void {
btnEffect2.play();
}
]]>
</mx:Script>
</mx:Application>
I want to have one component with the 2 buttons in, one component with the button effects in & one AS script file containing the script code.
I then want to link it all back together in the main MXML application file.
Any help would be appreciated!
Cheers
Neil