Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Flex (http://www.flasher.ru/forum/forumdisplay.php?f=84)
-   -   Приминение одного Эфекта к другим объектам. (http://www.flasher.ru/forum/showthread.php?t=141932)

mvdteam 08.07.2010 14:34

Приминение одного Эфекта к другим объектам.
 
Можно создав один єффект, при событиях других элементов применять к элементу события?

Собсно загвоздка в том что получаеться нужно повторять єфект для каждого єлемента со своим ID и Target.

Примерчик
Код AS3:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          minWidth="939"
                          minHeight="665"
                          width="939"
                          height="665"
                          creationComplete="application1_creationCompleteHandler(event)"
                          creationComplete.Key1="application1_creationCompleteHandler(event)"
                          initialize.State1="application1_initializeHandler(event)">
 
        <fx:Style source="VCSXX.css"/>
 
        <fx:Script>
                <![CDATA[
                        import mx.events.FlexEvent;
 
                        protected function N0_clickHandler(event:MouseEvent):void
                        {
                                bigImage.alpha = 0.0;
                                bigImage.source = "../data/1/Big1.png";
                                fadeON.end();fadeON.play();                                                               
                        }
 
                        protected function application1_creationCompleteHandler(event:FlexEvent):void
                        {               
                                moveLeft1.end();moveLeft1.play();
                                moveLeft2.end();moveLeft2.play();                       
                        }
 
                        protected function N0_mouseOverHandler(event:MouseEvent):void
                        {
                                scaleVPlayer1.end();scaleVPlayer1.play();
                        }
 
                        protected function N1_mouseOverHandler(event:MouseEvent):void
                        {
                        /*        vpl0.text = dataXml.children()[1].children()[0];
                                vpl1.text = dataXml.children()[1].children()[1];
                                vpl2.text = dataXml.children()[1].children()[2];
                                vpl3.text = dataXml.children()[1].children()[3];
                                vpl4.text = dataXml.children()[1].children()[4];
                                vpl5.text = dataXml.children()[1].children()[5];
                                vpl6.text = dataXml.children()[1].children()[6];*/

 
                                bigImage.alpha = 0.0;
                                bigImage.source = "../data/2/Big2.png";
                                fadeON.end();fadeON.play();                               
                                scaleVPlayerN1_1.end();scaleVPlayerN1_1.play();fadeON_N1.end();fadeON_N1.play();                               
                        }
 
                        protected function N1_mouseOutHandler(event:MouseEvent):void
                        {
                                scaleVPlayerN1_2.end();
                                scaleVPlayerN1_2.play();
                                fadeOFF_N1.end();
                                fadeOFF_N1.play();
                                pnl_data.visible = false;                               
                        }
 
                ]]>
        </fx:Script>
        <s:states>
                <s:State name="State1"/>
                <s:State name="Key1"/>
        </s:states>
 
        <fx:Declarations>
 
                <s:Fade id="fadeON"
                alphaFrom="0.1"
                alphaTo="1.0"
                target="{bigImage}"
                duration="300"/>               
 
                <s:Fade
                id="fadeOFF"
                alphaFrom="1.0"
                alphaTo="0.0"
                target="{bigImage}"
                duration="300"/>
 
                <s:Fade id="fadeON_N1"
                alphaFrom="0.1"
                alphaTo="1.0"
                target="{bigImage}"
                duration="300"/>               
 
                <s:Fade id="fadeOFF_N1"
                alphaFrom="1.0"
                alphaTo="0.0"
                target="{bigImage}"
                duration="300"/>
 
 
                <!--s:Bounce id="bounceEasing"/-->
                <s:Power id="powerEasing" exponent="4"/>
                <s:Move id="moveLeft1"
                xFrom="531"       
                xTo="70"
                yTo="66"
                duration="2000"       
                easer="{powerEasing}"
                target="{N0}"/>
 
                <s:Move id="moveLeft2"
                xFrom="655"       
                xTo="190"
                yTo="66"
                duration="2000"       
                easer="{powerEasing}"
                target="{N1}"/>
 
                <s:Bounce id="bounce"/>
                <s:Scale3D id="scaleVPlayer1"
                autoCenterTransform="true" 
                duration="500"
                scaleXFrom="1.0"
                scaleXTo="1.5
                scaleYFrom="1.0
                scaleYTo="1.5
                scaleZFrom="1.0
                scaleZTo="1.5
                target="{N0}
                easer="{bounce}"/>                               
 
                <s:Scale3D id="scaleVPlayer2"
                autoCenterTransform="true" 
                duration="500"
                scaleXFrom="1.5"
                scaleXTo="1.0"
                scaleYFrom="1.5"
                scaleYTo="1.0"
                scaleZFrom="1.5"
                scaleZTo="1.0"
                target="{N0}"
                easer="{bounce}"/>
 
                <s:Scale3D id="scaleVPlayerN1_1"
                autoCenterTransform="true" 
                duration="500"
                scaleXFrom="1.0"
                scaleXTo="1.5
                scaleYFrom="1.0
                scaleYTo="1.5
                scaleZFrom="1.0
                scaleZTo="1.5
                target="{N1}
                easer="{bounce}"/>                               
 
                <s:Scale3D
                id="scaleVPlayerN1_2"
                autoCenterTransform="true" 
                duration="500"
                scaleXFrom="1.5"
                scaleXTo="1.0"
                scaleYFrom="1.5"
                scaleYTo="1.0"
                scaleZFrom="1.5"
                scaleZTo="1.0"
                target="{N1}"
                easer="{bounce}"/>
 
                <!-- Разместить невизуальные элементы (например, службы или объекты значений) -->       
                <fx:XML id="dataXml" source="../data/data.xml" />               
        </fx:Declarations>
 
        <mx:Image
        x="531"
        y="29"
        width="90"
        height="100"
        id="N0"
        source="../data/1/Small1.png"
        x.Key1="70"
        y.Key1="66"
        mouseOver.State1="{N0_clickHandler(event);scaleVPlayer1.end();scaleVPlayer1.play();fadeON.end();fadeON.play();}"
        mouseOut.State1="{scaleVPlayer2.end();scaleVPlayer2.play();fadeOFF.end();fadeOFF.play();}"
        click.State1="N0_clickHandler(event)"/>
 
        <mx:Image
        x="655"
        y="29"
        width="90"
        height="100"
        id="N1"
        source="../data/2/Small2.png"
        x.Key1="190"
        y.Key1="66"
        mouseOver.State1="N1_mouseOverHandler(event)"
        mouseOut.State1="N1_mouseOutHandler(event)"/>
 
        <mx:Image
        includeIn="State1"
        x="537"
        y="28"
        width="320"
        height="340"
        id="bigImage"/>
 
</s:Application>

<s:Bounce id="bounce"/>
<s:Scale3D id="scaleVPlayer1"
autoCenterTransform="true"
duration="500"
scaleXFrom="1.0"
scaleXTo="1.5"
scaleYFrom="1.0"
scaleYTo="1.5"
scaleZFrom="1.0"
scaleZTo="1.5"
target="{N0}"
easer="{bounce}"/>
<s:Scale3D id="scaleVPlayer2"
autoCenterTransform="true"
duration="500"
scaleXFrom="1.5"
scaleXTo="1.0"
scaleYFrom="1.5"
scaleYTo="1.0"
scaleZFrom="1.5"
scaleZTo="1.0"
target="{N0}"
easer="{bounce}"/>

Можно применить Один такой Эффект к изображению N0 и N2 ?

wvxvw 08.07.2010 17:35

Отформатируйте код как-нибудь, чтобы его можно было прочитать. Это неуважительно по отношению к другим постить код написаный весь в одну строчку, никто такое читать не будет.


Часовой пояс GMT +4, время: 06:13.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.