Actionscript 3 吐温问题和标签

Actionscript 3 吐温问题和标签,actionscript-3,flash,as3crypto,Actionscript 3,Flash,As3crypto,我实际上是一名多媒体设计专业的学生,我们有一个项目要在3周内完成,叫做交互式动画 嗯,我正试图产生不同的效果 Glowing with easing Scaling with easing using alpha 我只使用Adobe手册,一些答案已经发布在这里 这是我的密码 stop(); import fl.transitions.*; import fl.transitions.easing.*; // START :: BULLET Link Glowing ONCLICK- MOUSE

我实际上是一名多媒体设计专业的学生,我们有一个项目要在3周内完成,叫做交互式动画

嗯,我正试图产生不同的效果

Glowing with easing
Scaling with easing
using alpha
我只使用Adobe手册,一些答案已经发布在这里

这是我的密码

stop();
import fl.transitions.*;
import fl.transitions.easing.*;
// START :: BULLET Link Glowing ONCLICK- MOUSE EVENT delay declaration //

var glowONColor:Number = 0xFFFFFF;
var glowONAlpha:Number = 0.3;
var glowONBlurX:Number = 20;
var glowONBlurY:Number = 20;
var glowONStrength:Number = 3;
var glowONQuality:Number = BitmapFilterQuality.HIGH;
var glowONInner:Boolean = false;
var glowONKnockout:Boolean = false;
var gfON:GlowFilter = new GlowFilter(glowONColor, glowONAlpha, glowONBlurX, glowONBlurY, glowONStrength, glowONQuality, glowONInner, glowONKnockout);

var glowOFFColor:Number = 0x000000;
var glowOFFAlpha:Number = 0;
var glowOFFBlurX:Number = 0;
var glowOFFBlurY:Number = 0;
var glowOFFStrength:Number = 0;
var glowOFFQuality:Number = BitmapFilterQuality.HIGH;
var glowOFFInner:Boolean = false;
var glowOFFKnockout:Boolean = false;
var gfOFF:GlowFilter = new GlowFilter(glowOFFColor, glowOFFAlpha, glowOFFBlurX, glowOFFBlurY, glowOFFStrength, glowOFFQuality, glowOFFInner, glowOFFKnockout); 


mc_bullet_7mm.addEventListener(MouseEvent.CLICK, go_to_item1);
function go_to_item1(event:MouseEvent):void
{
    gotoAndStop("Item1");
    mc_bullet_7mm.filters = [gfON]; 
}
mc_bullet_280mm.addEventListener(MouseEvent.CLICK, go_to_item2);
function go_to_item2(event:MouseEvent):void
{
    gotoAndStop("Item2");
    mc_bullet_280mm.filters = [gfON];
}
mc_bullet_270mm.addEventListener(MouseEvent.CLICK, go_to_item3);
function go_to_item3(event:MouseEvent):void
{
    gotoAndStop("Item3");
    mc_bullet_270mm.filters = [gfON];
}
mc_bullet_30_06mm.addEventListener(MouseEvent.CLICK, go_to_item4);
function go_to_item4(event:MouseEvent):void
{
    gotoAndStop("Item4");
    mc_bullet_30_06mm.filters = [gfON];
}
mc_bullet_300_mag.addEventListener(MouseEvent.CLICK, go_to_item5);
function go_to_item5(event:MouseEvent):void
{
    gotoAndStop("Item5");
    mc_bullet_300_mag.filters = [gfON];
}
mc_bullet_7_64mm.addEventListener(MouseEvent.CLICK, go_to_item6);
function go_to_item6(event:MouseEvent):void
{
    gotoAndStop("Item6");
    mc_bullet_7_64mm.filters = [gfON];
}
mc_bullet_300mm.addEventListener(MouseEvent.CLICK, go_to_item7);
function go_to_item7(event:MouseEvent):void
{
    gotoAndStop("Item7");
    mc_bullet_300mm.filters = [gfON];
}
mc_bullet_308mm.addEventListener(MouseEvent.CLICK, go_to_item8);
function go_to_item8(event:MouseEvent):void
{
    gotoAndStop("Item8");
    mc_bullet_308mm.filters = [gfON];
}


// END:: BULLET OVER Link Glowing  - MOUSE EVENT declaration //

//--------------------------------------------------------------------//

// START :: BULLET menu Easing & Rotation - ENTER_FRAME delay declaration //
TransitionManager.start(mc_bullet_7mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_280mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_270mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_30_06mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_300_mag, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_7_64mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_300mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
TransitionManager.start(mc_bullet_308mm, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
function defaultrotate (event:Event)
{
    mc_bullet_7mm.rotation += 1;
    mc_bullet_280mm.rotation += 1;
    mc_bullet_270mm.rotation += 1;
    mc_bullet_30_06mm.rotation += 1;
    mc_bullet_300_mag.rotation += 1;
    mc_bullet_7_64mm.rotation += 1;
    mc_bullet_300mm.rotation += 1;
    mc_bullet_308mm.rotation += 1;
}
function continuerotate (event:MouseEvent)
{
    mc_bullet_7mm.addEventListener(Event.ENTER_FRAME, defaultrotate);
}
    mc_bullet_7mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_280mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_270mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_30_06mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_300_mag.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_7_64mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_300mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);
    mc_bullet_308mm.addEventListener(MouseEvent.MOUSE_OUT, continuerotate);

function stoprotate (event:MouseEvent)
{
    mc_bullet_7mm.removeEventListener(Event.ENTER_FRAME, defaultrotate);
}
    mc_bullet_7mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_280mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_270mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_30_06mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_300_mag.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_7_64mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_300mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);
    mc_bullet_308mm.addEventListener(MouseEvent.MOUSE_OVER, stoprotate);

// END:: BULLET menu Easing & Rotation - ENTER_FRAME delay declaration //

//--------------------------------------------------------------------//

// START :: Background Easing in the frame - ENTER_FRAME declaration //

var dest1:Number = 89.95;
addEventListener(Event.ENTER_FRAME, radar_country_enter);
function radar_country_enter(event:Event):void{
  if (dest1 != mc_radar_country.y){
    var easeNum:Number = 0.9
    mc_radar_country.x = mc_radar_country.x * easeNum + dest1 * (1-easeNum);
  }
}

var dest2:Number = 89.95;
addEventListener(Event.ENTER_FRAME, radar_rotation_enter);
function radar_rotation_enter(event:Event):void{
  if (dest2 != mc_radar_turning.y){
    var easeNum:Number = 0.9
    mc_radar_turning.x = mc_radar_turning.x * easeNum + dest2 * (1-easeNum);
  }
}


import flash.events.Event;
addEventListener(Event.ENTER_FRAME, radar_rotation);
function radar_rotation(event:Event):void
{
    mc_radar_turning.rotation +=1;
}

var dest3:Number = 667.85;
addEventListener(Event.ENTER_FRAME, bottom_tween);
function bottom_tween(event:Event):void{
  if (dest3 != mc_bottom.y){
    var easeNum:Number = 0.9
    mc_bottom.y = mc_bottom.y * easeNum + dest3 * (1-easeNum);
  }
}

var dest4:Number = 160.2;
addEventListener(Event.ENTER_FRAME, top_tween);
function top_tween(event:Event):void{
  if (dest4 != mc_top.y){
    var easeNum:Number = 0.8
    mc_top.y = mc_top.y * easeNum + dest4 * (1-easeNum);
  }
}

var backsound_enter:Sound = new ENTER_FRAME_SONG();
backsound_enter.play();


// END :: Background Easing in the frame - ENTER_FRAME declaration //
问题是,当我点击另一个项目符号按钮时,它会标记为Item1。它不会播放标签AS3中的缩放

而且当我点击另一个子弹按钮时,它也不会发光

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.Event;

var  tweenGrowX:Tween = new Tween(background_items, "scaleX", Elastic.easeIn, 10, 400, 0.2, true);
var  tweenGrowY:Tween  = new Tween(background_items, "scaleY", Elastic.easeIn, 10, 400, 0.2, true);


function grow_background_items(event:Event)
{
tweenGrowY.start();
tweenGrowX.start();
}
background_items.addEventListener(Event.ENTER_FRAME, grow_background_items);
stop();

function bullet_glow_off(event:MouseEvent):void
{
    mc_bullet_7mm.filters = [gfOFF];
    mc_bullet_280mm.filters = [gfOFF];
    mc_bullet_270mm.filters = [gfOFF];
    mc_bullet_30_06mm.filters = [gfOFF];
    mc_bullet_300_mag.filters = [gfOFF];
    mc_bullet_7_64mm.filters = [gfOFF];
    mc_bullet_300mm.filters = [gfOFF];
    mc_bullet_308mm.filters = [gfOFF];
}
mc_bullet_280mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_270mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_30_06mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_300_mag.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_7_64mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_300mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);
mc_bullet_308mm.addEventListener(MouseEvent.CLICK, bullet_glow_off);

stop();

我有一个明显的印象,您正在将代码放入主时间轴上的各个帧中。这是一个必须避免的头痛问题

正如前面所建议的,您不需要执行类似任务的同一函数的多个副本。相反,您可以通过使用在循环期间引用每个对象的变量来简化代码,从而在循环中执行类似的任务

根据显示列表层次结构中后台_项的位置,您需要更改相对于代码运行的主时间线框架的路径。您可能希望在每次重新加载动画时重置背景项的缩放,否则它看起来不会进行变换

此外,我鼓励您将RunOnce片段折叠成单个函数。特别是当你开始重新设置你的舞台时,把它们放在一个地方将是无价的

试试这个

stop();
init();
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;

// Whether the 7mm should be allow the other clips to rotate.
var rotate7mm:Boolean = true;

// This array holds references to the clips we'll handle, and their related goto frames.
var bullets:Array = [
    {
        "clip":mc_bullet_7mm,
        "frame":"Item1"
    },
    {
        "clip":mc_bullet_280mm,
        "frame":"Item2"
    },
    {
        "clip":mc_bullet_270mm,
        "frame":"Item3"
    },
    {
        "clip":mc_bullet_30_06mm,
        "frame":"Item4"
    },
    {
        "clip":mc_bullet_300_mag,
        "frame":"Item5"
    },
    {
        "clip":mc_bullet_7_64mm,
        "frame":"Item6"
    },
    {
        "clip":mc_bullet_300mm,
        "frame":"Item7"
    },
    {
        "clip":mc_bullet_308mm,
        "frame":"Item8"
    }
]

function init():void {
    // Everything that should happen once
    var backsound_enter:Sound = new ENTER_FRAME_SONG();
    backsound_enter.play();
    addEventListener(Event.ENTER_FRAME, tick);

    for each {var entry:Object in bullets} {
        entry.clip.addEventListener(MouseEvent.CLICK, go_to_item)
        entry.clip.addEventListener(MouseEvent.MOUSE_OUT, toggleRotation);
        entry.clip.addEventListener(MouseEvent.MOUSE_OVER, toggleRotation);
        TransitionManager.start(entry.clip, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
    }
}

function go_to_item(e:MouseEvent):void {
    // Handles glowing the clicked button, and turning off the glow to the ones not selected.
    var gfON:GlowFilter = new GlowFilter(
        0xFFFFFF,       // Color
        0.3,            // Alpha
        20,             // BlurX
        20,             // BlurY
        3,              // Strength
        BitmapFilterQuality.HIGH,   // Quality
        false,          // Inner
        false           // Knockout
    );

    var gfOFF:GlowFilter = new GlowFilter(
        0x000000,       // Color
        0,              // Alpha
        0,              // BlurX
        0,              // BlurY
        0,              // Strength
        BitmapFilterQuality.HIGH,   // Quality
        false,          // Inner
        false           // Knockout
    );

    for each (var entry:Object in bullets) {
        if (e.currentTarget == entry.clip) {
            gotoAndStop(entry.frame)
            entry.clip.filters = [gfON];

            // Animate the background in
            var  tweenGrowX:Tween = new Tween(background_items, "scaleX", Elastic.easeIn, 10, 400, 0.2, true);
            tweenGrowX.start();

            var  tweenGrowY:Tween  = new Tween(background_items, "scaleY", Elastic.easeIn, 10, 400, 0.2, true);
            tweenGrowY.start();
        } else {
            entry.clip.filters = [gfOFF]
        }
    }
}

function toggleRotation(e:Event):void {
    // Rather than registering another function for enterframe events, we simply set a boolean which tells the existing tick() function to run the rotation transforms.
    switch (e.type) {
        case "mouseOut":
            rotate7mm = true;
            break;
        case "mouseOver":
            rotate7mm = false;
            break;
    }
}

function tick(e:Event):void {
    // Anything that needs to happen in a frame update occurs in this function.
    mc_radar_turning.rotation +=1;

    var radarDest:Number = 89.95;   // Radar Dest
    var bottomDest:Number = 667.85; // Bottom Dest
    var topDest:Number = 160.2;     // Top Dest
    var easeNumSlow:Number = 0.9
    var easeNumFast:Number = 0.8

    // Country Enter
    if (radarDest != mc_radar_country.y) {
        mc_radar_country.x = mc_radar_country.x * easeNumSlow + radarDest * (1-easeNumSlow);
    }

    // Radar Rotation
    if (radarDest != mc_radar_turning.y) {
        mc_radar_turning.x = mc_radar_turning.x * easeNumSlow + radarDest * (1-easeNumSlow);
    }

    // Bottom Tween
    if (dest3 != mc_bottom.y) {
        mc_bottom.y = mc_bottom.y * easeNumSlow + dest3 * (1-easeNumSlow);
    }

    // Top Tween
    if (topDest != mc_top.y) {
        mc_top.y = mc_top.y * easeNumFast + topDest * (1-easeNumFast);
    }

    // 7mm Rotation
    if (rotate7mm) {
        for each (var entry:Object in bullets) {
            entry.clip.rotation += 1;
        }
    }
}

AS3=/=JavaScript。标记已删除。您有太多输入帧侦听器。这不会正常工作,而且我也看不到你移除它们。首先,使用单个输入框并将所有相关代码放入其中。完成后把它拿走。非常感谢,我要去看看这个。我会让你知道的。