• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

BUG: Changing "alpha" with AS breaks other property changes on timeline

Community Beginner ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

I've discovered a bug in AS3 where a Movie Clip that spans 2 different frames, but its properties are different in each frame (i.e. it has been repositioned on the 2nd frame but the instance name is the same), and the MC's alpha is changed using ActionScript prior to moving the timeline from one frame to the other, the timeline moves, but the MC does NOT actually move.

I'm experiencing this error in a professional project that I'm working on so I cannot post the actual FLA, but here is a little mock up that I made:

stop()

currentFrameTxt.text = currentLabel

var alphaChange:Number = .1
var alphaMax:Number = 1
var alphaMin:Number = 0

alphaUpBtn.addEventListener(MouseEvent.CLICK, alphaUp)

function alphaUp(evt:MouseEvent) {
    box.alpha += alphaChange
    if (box.alpha > alphaMax) {
        box.alpha = alphaMax
    }
}

alphaDownBtn.addEventListener(MouseEvent.CLICK, alphaDown)

function alphaDown(evt:MouseEvent) {
    box.alpha -= alphaChange
    if (box.alpha < alphaMin) {
        box.alpha = alphaMin
    }
}

leftBtn.addEventListener(MouseEvent.CLICK, gotoLeft)

function gotoLeft(evt:MouseEvent) {
    if (currentLabel != "left") {
        gotoAndStop("left")
    }
    currentFrameTxt.text = currentLabel
}

rightBtn.addEventListener(MouseEvent.CLICK, gotoRight)

function gotoRight(evt:MouseEvent) {
    if (currentLabel != "right") {
        gotoAndStop("right")
    }
    currentFrameTxt.text = currentLabel
}

On Frame 1 (labeled "left") is an MC with the instance name "box" and the box's position is on the left side of the stage. On Frame 11 (labeled "right") is the same instance "box", but its position has been moved to the right side of the stage.

I have a pair of buttons ('leftBtn" and "rightBtn") that toggle the timeline between the "left" frame and the "right" frame.

I also have a pair of buttons ("alphaUpBtn" and "alphaDownBtn") that change the box's "alpha" property.

If you click "leftBtn" or "rightBtn" before you click the "alphaUp" or "alphaDown" buttons, the box moves left or right as one would expect. BUT if you click either "alphaUpBtn" or "alphaDownBtn", the box does NOT move if you then click "leftBtn" or "rightBtn" even though the timeline is indeed moving (which I am confirming using the "currentFrameTxt" dynamic text box).

I have tried this example by changing other properties on the 2 frames and they too stop working once you change the "alpha" using AS. I have also tried change other propeties using AS, but alpha is the only property to breaks the other properties changed by moving the timeline.

Why would changing the "alpha" property suddenly break all other property changes on the timeline?

Now I know that one work-around for this bug is to simply change the box's position dynamically by setting the x and y positions, but this is NOT an option for this project because it is very important that the client be able to manually position the artwork on each frame by hand.

This is a serious bug and I'm wondering if anyone else has encountered it before and if they know of a viable workaround.

TOPICS
ActionScript

Views

751

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

Can you make the fla file of your example version available (as a CS3 file)... I'm curious if this involves a pre-existing issue with Flash... I'm also curious if it's limited to AS3.

You can usually attach an fla here if you rename it with a 'txt' file extension.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

Ned,

Here is the CS3 FLA file:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

What you say seems to be the case, even using Flash 10 tweens. One work around is to have the animation be inside another movieclip, and then set the alpha of the outer movieclip. The inner one continues to animate ok then.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

I did some more testing by changing other properties of the box with AS and it appears that for most properties, like alpha, x, y, rotation, width, height, etc, if they are changed with AS, then the properties of the MC can no longer be changed by the timeline settings. Changing the "visible" property has no effect, however.

It seems that this "bug" is not really bug so much as it is a fundamental misunderstanding on my part about the fact that you CANNOT change the properties of a symbol using BOTH ActionScript and timeline properties. I can only change the properties of using either the timeline OR ActionScript because as soon as I change the properties using AS, the MC becomes an AS-controlled object and can no longer be controlled via the timeline. I guess that makes sense, but it is frustrating nonetheless.

Colin, your suggestion to nest the MC inside another MC is indeed a successful workaround, at least for this little box example (see fixed FLA attached with the "left" and "right" timeline property changes nested inside the box itself) and I will see if it is a viable solution for my actual application. I'm guessing it will not be a problem for my client to simply navigate inside a parent MC in order to adjust the positions of the now-nested MC in question.

Thanks for the help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

LATEST

With some of these cases where the features don't quite match what you'd like, you have to use a work around for now. But you might want to enter a feature request here:

http://bugs.adobe.com/flashplayer/

Since Flash 10 can let any property of a movieclip have independent key framing, it seems reasonable to me that AS changes should work without disturbing properties that the AS is not changing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines