第一帧中的类。

发布于 2024-12-11 15:26:04 字数 8247 浏览 1 评论 0原文

好吧,现在我准备得更充分了。我有非常好的网站。但是当把所有东西压缩到一帧时。它停止工作。我唯一改变的是在 IDE 中删除了补间。

框架中的代码

stop();
import flash.events.MouseEvent;
import fl.transitions.Tween;
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import flash.events.Event;
var vektor:Array = new Array(I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII);
var menu:Wyjazd = new Wyjazd(vektor,firmaBTN,kontaktBTN,ofertaBTN,naglowek,tekst,dane);

ofertaBTN.addEventListener(MouseEvent.CLICK, test);
function test(e:MouseEvent):void
{
    trace(String("click"));
}

Wyjazd 类中的代码

package 
{
    import fl.transitions.Tween;
    import fl.motion.easing.*;
    import flash.filters.*;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import flash.display.MovieClip;
    import flash.ui.Mouse;
    import flash.display.*;
    import flash.events.Event;
    public class Wyjazd extends MovieClip
    {
        public function Wyjazd(ar:Array=null,firma:Object=null,kontakt:Object=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null)
        {
            /*
            if (ar!=null)
            {

            init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
            }
            */
            if (stage)
            {
                init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
            }
            else
            {
                addEventListener(Event.ADDED_TO_STAGE, init);
            }

        }

        public function init(ar:Array,firma:Object=null,kontakt=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null):void
        {

            //Zmienne "globalne" dla funkcji
            var time:Number;
            var wciecie:Number;
            var wciecie2:Number;
            var offset:Number = 15.65;
            var offset2:Number = 20;
            var posX:Array = new Array(12);
            var posY:Array = new Array(12);
            var spr:Array = new Array(12);
            var targetLabel:String;
            var wybranyOb:Object = ar[0];
            var names:Array = new Array('Szkolenie wstępne BHP','Szkolenie okresowe BHP','Szkolenie P.Poż','Kompleksowa obsługa P.Poż','Pomiar środowiska pracy','Szkolenie z udzielania pierwszej pomocy','Ocena ryzyka zawodowego','Przeprowadzanie postępowań po wypadkowych','Przeprowadzanie audytów wewnętrznych ISO','Hałas w środowisku komunalnym','Medycyna pracy','Szkolenia dla kierowców');
            //Pobieranie pozycji
            for (var i:Number = 0; i<ar.length; i++)
            {
                posX[i] = ar[i].x;
                posY[i] = ar[i].y;
                trace(String("klasa"));

            }



            //Filtry
            function increaseBlur(e:MouseEvent,docPos:Number):void
            {
                var myBlur:BlurFilter =new BlurFilter();
                myBlur.quality = 3;
                myBlur.blurX = 10;
                myBlur.blurY = 0;
            }
            //Funkcje
            function startPos():void
            {
                time = 0.2;
                for (var i:Number = 0; i<ar.length; i++)
                {
                    //if (wybranyOb.name == ar[i].name)
                    //{
                    //var wybranyPos:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],0.01,true);
                    //wybranyPos = new Tween(ar[i],"y",Linear.easeOut,-30,posY[i],time,true);
                    //}
                    //else
                    //{
                    var position:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                    position = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                    //}
                    //time = 0.2;
                }
                position = new Tween(naglowek,"x",Linear.easeOut,naglowek.x,2000,time,true);
                position = new Tween(tekst,"x",Linear.easeOut,tekst.x,2000,time,true);
                position = new Tween(dane,"x",Linear.easeOut,dane.x,2000,0.25,true);
            }

            //Nasłuchy
            oferta.addEventListener(MouseEvent.CLICK, wyskokOferta);
            oferta.addEventListener(MouseEvent.MOUSE_OVER,glowOferta);
            oferta.addEventListener(MouseEvent.MOUSE_OUT,unglowOferta);
            kontakt.addEventListener(MouseEvent.CLICK,wyskokKontakt);
            kontakt.addEventListener(MouseEvent.MOUSE_OVER,glowKontakt);
            kontakt.addEventListener(MouseEvent.MOUSE_OUT,unglowKontakt);
            firma.addEventListener(MouseEvent.CLICK,wyskokFirma);
            firma.addEventListener(MouseEvent.MOUSE_OVER,glowFirma);
            firma.addEventListener(MouseEvent.MOUSE_OUT,unglowFirma);
            function glowFirma(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                firma.filters = [myGlow];
            }
            function unglowFirma(e:MouseEvent):void
            {
                firma.filters = [];
            }
            function glowKontakt(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                kontakt.filters = [myGlow];
            }
            function unglowKontakt(e:MouseEvent):void
            {
                kontakt.filters = [];
            }
            function glowOferta(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                oferta.filters = [myGlow];
            }
            function unglowOferta(e:MouseEvent):void
            {
                oferta.filters = [];
            }
            function wyskokKontakt(e:MouseEvent):void
            {
                startPos();
                var tweenKontakt = new Tween(dane,"x",Linear.easeOut,2000,350,0.25,true);

            }
            function wyskokFirma(e:MouseEvent):void
            {
                startPos();
                trace("Firma");
            }
            function wyskokOferta(e:MouseEvent):void
            {

                time = 0.2;
                wciecie = 52.5;
                wciecie2 = 67.45;
                for (var i:Number = 0; i < ar.length; i++)
                {

                    var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,oferta.x + wciecie,time,true);
                    tween = new Tween(ar[i],"y",Sine.easeOut,ar[i].y,oferta.y + wciecie2,time,true);

                    ar[i].addEventListener(MouseEvent.CLICK,onClick);
                    spr[i] = i;

                    time +=  0.02;
                    wciecie +=  offset;
                    wciecie2 +=  offset2;
                }
            }

            function onClick(e:MouseEvent)
            {
                startPos();
                time = 0.2;
                var k:Number = 0;
                targetLabel = e.currentTarget.name;

                for (var i:Number = 0; i < ar.length; i++)
                {
                    if (targetLabel==ar[i].name)
                    {
                        //wybranyOb = ar[i];
                        var tween:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                        tween = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                        tween = new Tween(naglowek,"x",Linear.easeOut,2000,60,0.2,true);
                        tween = new Tween(tekst,"x",Linear.easeOut,2000,500,0.25,true);
                        naglowek.text = names[i];


                    }
                    else
                    {
                        var tween1:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                        tween1 = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                    }
                    //time +=  0.02;
                }

            }


        }

    }
}

它看起来如何像框架。 http://www.dropmocks.com/mbe3j

Ok now I am more prepared. I have perfectly fine site. But when compress every thing to one frame. It stop working. Only thing I change is that I remove tween in IDE.

Code in Frame

stop();
import flash.events.MouseEvent;
import fl.transitions.Tween;
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import flash.events.Event;
var vektor:Array = new Array(I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII);
var menu:Wyjazd = new Wyjazd(vektor,firmaBTN,kontaktBTN,ofertaBTN,naglowek,tekst,dane);

ofertaBTN.addEventListener(MouseEvent.CLICK, test);
function test(e:MouseEvent):void
{
    trace(String("click"));
}

Code in class Wyjazd

package 
{
    import fl.transitions.Tween;
    import fl.motion.easing.*;
    import flash.filters.*;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import flash.display.MovieClip;
    import flash.ui.Mouse;
    import flash.display.*;
    import flash.events.Event;
    public class Wyjazd extends MovieClip
    {
        public function Wyjazd(ar:Array=null,firma:Object=null,kontakt:Object=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null)
        {
            /*
            if (ar!=null)
            {

            init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
            }
            */
            if (stage)
            {
                init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
            }
            else
            {
                addEventListener(Event.ADDED_TO_STAGE, init);
            }

        }

        public function init(ar:Array,firma:Object=null,kontakt=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null):void
        {

            //Zmienne "globalne" dla funkcji
            var time:Number;
            var wciecie:Number;
            var wciecie2:Number;
            var offset:Number = 15.65;
            var offset2:Number = 20;
            var posX:Array = new Array(12);
            var posY:Array = new Array(12);
            var spr:Array = new Array(12);
            var targetLabel:String;
            var wybranyOb:Object = ar[0];
            var names:Array = new Array('Szkolenie wstępne BHP','Szkolenie okresowe BHP','Szkolenie P.Poż','Kompleksowa obsługa P.Poż','Pomiar środowiska pracy','Szkolenie z udzielania pierwszej pomocy','Ocena ryzyka zawodowego','Przeprowadzanie postępowań po wypadkowych','Przeprowadzanie audytów wewnętrznych ISO','Hałas w środowisku komunalnym','Medycyna pracy','Szkolenia dla kierowców');
            //Pobieranie pozycji
            for (var i:Number = 0; i<ar.length; i++)
            {
                posX[i] = ar[i].x;
                posY[i] = ar[i].y;
                trace(String("klasa"));

            }



            //Filtry
            function increaseBlur(e:MouseEvent,docPos:Number):void
            {
                var myBlur:BlurFilter =new BlurFilter();
                myBlur.quality = 3;
                myBlur.blurX = 10;
                myBlur.blurY = 0;
            }
            //Funkcje
            function startPos():void
            {
                time = 0.2;
                for (var i:Number = 0; i<ar.length; i++)
                {
                    //if (wybranyOb.name == ar[i].name)
                    //{
                    //var wybranyPos:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],0.01,true);
                    //wybranyPos = new Tween(ar[i],"y",Linear.easeOut,-30,posY[i],time,true);
                    //}
                    //else
                    //{
                    var position:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                    position = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                    //}
                    //time = 0.2;
                }
                position = new Tween(naglowek,"x",Linear.easeOut,naglowek.x,2000,time,true);
                position = new Tween(tekst,"x",Linear.easeOut,tekst.x,2000,time,true);
                position = new Tween(dane,"x",Linear.easeOut,dane.x,2000,0.25,true);
            }

            //Nasłuchy
            oferta.addEventListener(MouseEvent.CLICK, wyskokOferta);
            oferta.addEventListener(MouseEvent.MOUSE_OVER,glowOferta);
            oferta.addEventListener(MouseEvent.MOUSE_OUT,unglowOferta);
            kontakt.addEventListener(MouseEvent.CLICK,wyskokKontakt);
            kontakt.addEventListener(MouseEvent.MOUSE_OVER,glowKontakt);
            kontakt.addEventListener(MouseEvent.MOUSE_OUT,unglowKontakt);
            firma.addEventListener(MouseEvent.CLICK,wyskokFirma);
            firma.addEventListener(MouseEvent.MOUSE_OVER,glowFirma);
            firma.addEventListener(MouseEvent.MOUSE_OUT,unglowFirma);
            function glowFirma(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                firma.filters = [myGlow];
            }
            function unglowFirma(e:MouseEvent):void
            {
                firma.filters = [];
            }
            function glowKontakt(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                kontakt.filters = [myGlow];
            }
            function unglowKontakt(e:MouseEvent):void
            {
                kontakt.filters = [];
            }
            function glowOferta(e:MouseEvent):void
            {
                var myGlow:GlowFilter=new GlowFilter();
                myGlow.color = 0xe6da13;
                myGlow.inner = true;
                oferta.filters = [myGlow];
            }
            function unglowOferta(e:MouseEvent):void
            {
                oferta.filters = [];
            }
            function wyskokKontakt(e:MouseEvent):void
            {
                startPos();
                var tweenKontakt = new Tween(dane,"x",Linear.easeOut,2000,350,0.25,true);

            }
            function wyskokFirma(e:MouseEvent):void
            {
                startPos();
                trace("Firma");
            }
            function wyskokOferta(e:MouseEvent):void
            {

                time = 0.2;
                wciecie = 52.5;
                wciecie2 = 67.45;
                for (var i:Number = 0; i < ar.length; i++)
                {

                    var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,oferta.x + wciecie,time,true);
                    tween = new Tween(ar[i],"y",Sine.easeOut,ar[i].y,oferta.y + wciecie2,time,true);

                    ar[i].addEventListener(MouseEvent.CLICK,onClick);
                    spr[i] = i;

                    time +=  0.02;
                    wciecie +=  offset;
                    wciecie2 +=  offset2;
                }
            }

            function onClick(e:MouseEvent)
            {
                startPos();
                time = 0.2;
                var k:Number = 0;
                targetLabel = e.currentTarget.name;

                for (var i:Number = 0; i < ar.length; i++)
                {
                    if (targetLabel==ar[i].name)
                    {
                        //wybranyOb = ar[i];
                        var tween:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                        tween = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                        tween = new Tween(naglowek,"x",Linear.easeOut,2000,60,0.2,true);
                        tween = new Tween(tekst,"x",Linear.easeOut,2000,500,0.25,true);
                        naglowek.text = names[i];


                    }
                    else
                    {
                        var tween1:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                        tween1 = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                    }
                    //time +=  0.02;
                }

            }


        }

    }
}

How it's looks like frame.
http://www.dropmocks.com/mbe3j

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转身以后 2024-12-18 15:26:04

您应该将所有(嵌套)函数从 init 中取出。

所以它更像是这样:

package 
{
import fl.transitions.Tween;
import fl.motion.easing.*;
import flash.filters.*;
import flash.events.MouseEvent;
import flash.display.Stage;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.display.*;
import flash.events.Event;
public class Wyjazd extends MovieClip
{
    public function Wyjazd(ar:Array=null,firma:Object=null,kontakt:Object=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null)
    {
        /*
        if (ar!=null)
        {

        init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
        }
        */
        if (stage)
        {
            init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
        }
        else
        {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
    }

    public function init(ar:Array,firma:Object=null,kontakt=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null):void
    {
        //Zmienne "globalne" dla funkcji
        var time:Number;
        var wciecie:Number;
        var wciecie2:Number;
        var offset:Number = 15.65;
        var offset2:Number = 20;
        var posX:Array = new Array(12);
        var posY:Array = new Array(12);
        var spr:Array = new Array(12);
        var targetLabel:String;
        var wybranyOb:Object = ar[0];
        var names:Array = new Array('Szkolenie wstępne BHP','Szkolenie okresowe BHP','Szkolenie P.Poż','Kompleksowa obsługa P.Poż','Pomiar środowiska pracy','Szkolenie z udzielania pierwszej pomocy','Ocena ryzyka zawodowego','Przeprowadzanie postępowań po wypadkowych','Przeprowadzanie audytów wewnętrznych ISO','Hałas w środowisku komunalnym','Medycyna pracy','Szkolenia dla kierowców');
        //Pobieranie pozycji
        for (var i:Number = 0; i<ar.length; i++)
        {
            posX[i] = ar[i].x;
            posY[i] = ar[i].y;
            trace(String("klasa"));
        }
        //Nasłuchy
        oferta.addEventListener(MouseEvent.CLICK, wyskokOferta);
        oferta.addEventListener(MouseEvent.MOUSE_OVER,glowOferta);
        oferta.addEventListener(MouseEvent.MOUSE_OUT,unglowOferta);
        kontakt.addEventListener(MouseEvent.CLICK,wyskokKontakt);
        kontakt.addEventListener(MouseEvent.MOUSE_OVER,glowKontakt);
        kontakt.addEventListener(MouseEvent.MOUSE_OUT,unglowKontakt);
        firma.addEventListener(MouseEvent.CLICK,wyskokFirma);
        firma.addEventListener(MouseEvent.MOUSE_OVER,glowFirma);
        firma.addEventListener(MouseEvent.MOUSE_OUT,unglowFirma);

    }

    public function glowFirma(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        firma.filters = [myGlow];
    }
    public function unglowFirma(e:MouseEvent):void
    {
        firma.filters = [];
    }
    public function glowKontakt(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        kontakt.filters = [myGlow];
    }
    public function unglowKontakt(e:MouseEvent):void
    {
        kontakt.filters = [];
    }
    public function glowOferta(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        oferta.filters = [myGlow];
    }
    public function unglowOferta(e:MouseEvent):void
    {
        oferta.filters = [];
    }
    public function wyskokKontakt(e:MouseEvent):void
    {
        startPos();
        var tweenKontakt = new Tween(dane,"x",Linear.easeOut,2000,350,0.25,true);
    }
    public function wyskokFirma(e:MouseEvent):void
    {
        startPos();
        trace("Firma");
    }
    public function wyskokOferta(e:MouseEvent):void
    {
        time = 0.2;
        wciecie = 52.5;
        wciecie2 = 67.45;
        for (var i:Number = 0; i < ar.length; i++)
        {
            var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,oferta.x + wciecie,time,true);
            tween = new Tween(ar[i], "y", Sine.easeOut, ar[i].y, oferta.y + wciecie2, time, true);

            ar[i].addEventListener(MouseEvent.CLICK,onClick);
            spr[i] = i;

            time +=  0.02;
            wciecie +=  offset;
            wciecie2 +=  offset2;
        }
    }


    //Filtry
    public function increaseBlur(e:MouseEvent,docPos:Number):void
    {
        var myBlur:BlurFilter =new BlurFilter();
        myBlur.quality = 3;
        myBlur.blurX = 10;
        myBlur.blurY = 0;
    }
    //Funkcje
    public function startPos():void
    {
        time = 0.2;
        for (var i:Number = 0; i<ar.length; i++)
        {
            //if (wybranyOb.name == ar[i].name)
            //{
            //var wybranyPos:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],0.01,true);
            //wybranyPos = new Tween(ar[i],"y",Linear.easeOut,-30,posY[i],time,true);
            //}
            //else
            //{
            var position:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
            position = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
            //}
            //time = 0.2;
        }
        position = new Tween(naglowek,"x",Linear.easeOut,naglowek.x,2000,time,true);
        position = new Tween(tekst,"x",Linear.easeOut,tekst.x,2000,time,true);
        position = new Tween(dane,"x",Linear.easeOut,dane.x,2000,0.25,true);
    }

    public function onClick(e:MouseEvent)
    {
        startPos();
        time = 0.2;
        var k:Number = 0;
        targetLabel = e.currentTarget.name;

        for (var i:Number = 0; i < ar.length; i++)
        {
            if (targetLabel==ar[i].name)
            {
                //wybranyOb = ar[i];
                var tween:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                tween = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                tween = new Tween(naglowek,"x",Linear.easeOut,2000,60,0.2,true);
                tween = new Tween(tekst,"x",Linear.easeOut,2000,500,0.25,true);
                naglowek.text = names[i];
            }
            else
            {
                var tween1:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                tween1 = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
            }
            //time +=  0.02;
        }
    }
}
}

如果这没有帮助,您应该发布更多详细信息。我不知道您如何将所有内容“压缩”到单个框架中,但我建议您阅读更多有关面向对象编程的内容。

在 Google 上快速搜索后,找到了这篇文章,其中可能会帮助您在 Action Script 3 中进行面向对象编程。

You should take all the (nested) functions out of init.

So it is more like this:

package 
{
import fl.transitions.Tween;
import fl.motion.easing.*;
import flash.filters.*;
import flash.events.MouseEvent;
import flash.display.Stage;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.display.*;
import flash.events.Event;
public class Wyjazd extends MovieClip
{
    public function Wyjazd(ar:Array=null,firma:Object=null,kontakt:Object=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null)
    {
        /*
        if (ar!=null)
        {

        init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
        }
        */
        if (stage)
        {
            init(ar,firma,kontakt,oferta,naglowek,tekst,dane);
        }
        else
        {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
    }

    public function init(ar:Array,firma:Object=null,kontakt=null,oferta:Object=null,naglowek:Object=null,tekst:Object=null,dane:Object=null):void
    {
        //Zmienne "globalne" dla funkcji
        var time:Number;
        var wciecie:Number;
        var wciecie2:Number;
        var offset:Number = 15.65;
        var offset2:Number = 20;
        var posX:Array = new Array(12);
        var posY:Array = new Array(12);
        var spr:Array = new Array(12);
        var targetLabel:String;
        var wybranyOb:Object = ar[0];
        var names:Array = new Array('Szkolenie wstępne BHP','Szkolenie okresowe BHP','Szkolenie P.Poż','Kompleksowa obsługa P.Poż','Pomiar środowiska pracy','Szkolenie z udzielania pierwszej pomocy','Ocena ryzyka zawodowego','Przeprowadzanie postępowań po wypadkowych','Przeprowadzanie audytów wewnętrznych ISO','Hałas w środowisku komunalnym','Medycyna pracy','Szkolenia dla kierowców');
        //Pobieranie pozycji
        for (var i:Number = 0; i<ar.length; i++)
        {
            posX[i] = ar[i].x;
            posY[i] = ar[i].y;
            trace(String("klasa"));
        }
        //Nasłuchy
        oferta.addEventListener(MouseEvent.CLICK, wyskokOferta);
        oferta.addEventListener(MouseEvent.MOUSE_OVER,glowOferta);
        oferta.addEventListener(MouseEvent.MOUSE_OUT,unglowOferta);
        kontakt.addEventListener(MouseEvent.CLICK,wyskokKontakt);
        kontakt.addEventListener(MouseEvent.MOUSE_OVER,glowKontakt);
        kontakt.addEventListener(MouseEvent.MOUSE_OUT,unglowKontakt);
        firma.addEventListener(MouseEvent.CLICK,wyskokFirma);
        firma.addEventListener(MouseEvent.MOUSE_OVER,glowFirma);
        firma.addEventListener(MouseEvent.MOUSE_OUT,unglowFirma);

    }

    public function glowFirma(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        firma.filters = [myGlow];
    }
    public function unglowFirma(e:MouseEvent):void
    {
        firma.filters = [];
    }
    public function glowKontakt(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        kontakt.filters = [myGlow];
    }
    public function unglowKontakt(e:MouseEvent):void
    {
        kontakt.filters = [];
    }
    public function glowOferta(e:MouseEvent):void
    {
        var myGlow:GlowFilter=new GlowFilter();
        myGlow.color = 0xe6da13;
        myGlow.inner = true;
        oferta.filters = [myGlow];
    }
    public function unglowOferta(e:MouseEvent):void
    {
        oferta.filters = [];
    }
    public function wyskokKontakt(e:MouseEvent):void
    {
        startPos();
        var tweenKontakt = new Tween(dane,"x",Linear.easeOut,2000,350,0.25,true);
    }
    public function wyskokFirma(e:MouseEvent):void
    {
        startPos();
        trace("Firma");
    }
    public function wyskokOferta(e:MouseEvent):void
    {
        time = 0.2;
        wciecie = 52.5;
        wciecie2 = 67.45;
        for (var i:Number = 0; i < ar.length; i++)
        {
            var tween:Tween = new Tween(ar[i],"x",Sine.easeOut,ar[i].x,oferta.x + wciecie,time,true);
            tween = new Tween(ar[i], "y", Sine.easeOut, ar[i].y, oferta.y + wciecie2, time, true);

            ar[i].addEventListener(MouseEvent.CLICK,onClick);
            spr[i] = i;

            time +=  0.02;
            wciecie +=  offset;
            wciecie2 +=  offset2;
        }
    }


    //Filtry
    public function increaseBlur(e:MouseEvent,docPos:Number):void
    {
        var myBlur:BlurFilter =new BlurFilter();
        myBlur.quality = 3;
        myBlur.blurX = 10;
        myBlur.blurY = 0;
    }
    //Funkcje
    public function startPos():void
    {
        time = 0.2;
        for (var i:Number = 0; i<ar.length; i++)
        {
            //if (wybranyOb.name == ar[i].name)
            //{
            //var wybranyPos:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],0.01,true);
            //wybranyPos = new Tween(ar[i],"y",Linear.easeOut,-30,posY[i],time,true);
            //}
            //else
            //{
            var position:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
            position = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
            //}
            //time = 0.2;
        }
        position = new Tween(naglowek,"x",Linear.easeOut,naglowek.x,2000,time,true);
        position = new Tween(tekst,"x",Linear.easeOut,tekst.x,2000,time,true);
        position = new Tween(dane,"x",Linear.easeOut,dane.x,2000,0.25,true);
    }

    public function onClick(e:MouseEvent)
    {
        startPos();
        time = 0.2;
        var k:Number = 0;
        targetLabel = e.currentTarget.name;

        for (var i:Number = 0; i < ar.length; i++)
        {
            if (targetLabel==ar[i].name)
            {
                //wybranyOb = ar[i];
                var tween:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                tween = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
                tween = new Tween(naglowek,"x",Linear.easeOut,2000,60,0.2,true);
                tween = new Tween(tekst,"x",Linear.easeOut,2000,500,0.25,true);
                naglowek.text = names[i];
            }
            else
            {
                var tween1:Tween = new Tween(ar[i],"x",Linear.easeOut,ar[i].x,posX[i],time,true);
                tween1 = new Tween(ar[i],"y",Linear.easeOut,ar[i].y,posY[i],time,true);
            }
            //time +=  0.02;
        }
    }
}
}

If this doesn't help, you should post more details. I don't know how you 'compressed everything' into a single frame, but I suggest you read more about Object Oriented Programming.

A quick Google search resulted in this article, which might help you out with Object Oriented programming in Action Script 3.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文