Highlighted

Serializing and Deserializing ColorTransform produces incorrect results

Community Beginner ,
May 07, 2014

Copy link to clipboard

Copied

I've filed a bug for this, Bug#3754128 - Serializing and Deserializing ColorTransform produces incorrect results

But I just wanted to bring it to attention here,

package

{

    import flash.display.Sprite;

    import flash.geom.ColorTransform;

    import flash.net.registerClassAlias;

    import flash.utils.ByteArray;

    import flash.utils.getQualifiedClassName;

   

    public class Main extends Sprite

    {

        public function Main()

        {

            registerClassAlias(getQualifiedClassName(ColorTransform), ColorTransform);

            var a:ColorTransform = new ColorTransform(.11, .22, .33, .44, .55, .66, .77, .88);

            var b:ByteArray = new ByteArray();

            b.writeObject(a);

            b.position = 0;

            trace( '', a, '\n', b.readObject(), '\n', JSON.stringify(a) );

        }

    }

}

This *should* print out

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

{"redOffset":0.55,"alphaMultiplier":0.44,"greenOffset":0.66,"alphaOffset":0.88,"blueOffset":0.77,"blueMultiplier":0.33,"greenMultiplier":0.22,"redMultiplier":0.11,"color":0}

But actually prints out

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0, alphaMultiplier=0.44, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0.88)

{"redOffset":0.55,"alphaMultiplier":0.44,"greenOffset":0.66,"alphaOffset":0.88,"blueOffset":0.77,"blueMultiplier":0.33,"greenMultiplier":0.22,"redMultiplier":0.11,"color":0}

Losing the information for all of blueMultiplier, and all the colour offsets, red, green and blue.

I'm using the latest 14.0 AIRSDK.

TOPICS
Performance issues

Views

139

Likes

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

Serializing and Deserializing ColorTransform produces incorrect results

Community Beginner ,
May 07, 2014

Copy link to clipboard

Copied

I've filed a bug for this, Bug#3754128 - Serializing and Deserializing ColorTransform produces incorrect results

But I just wanted to bring it to attention here,

package

{

    import flash.display.Sprite;

    import flash.geom.ColorTransform;

    import flash.net.registerClassAlias;

    import flash.utils.ByteArray;

    import flash.utils.getQualifiedClassName;

   

    public class Main extends Sprite

    {

        public function Main()

        {

            registerClassAlias(getQualifiedClassName(ColorTransform), ColorTransform);

            var a:ColorTransform = new ColorTransform(.11, .22, .33, .44, .55, .66, .77, .88);

            var b:ByteArray = new ByteArray();

            b.writeObject(a);

            b.position = 0;

            trace( '', a, '\n', b.readObject(), '\n', JSON.stringify(a) );

        }

    }

}

This *should* print out

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

{"redOffset":0.55,"alphaMultiplier":0.44,"greenOffset":0.66,"alphaOffset":0.88,"blueOffset":0.77,"blueMultiplier":0.33,"greenMultiplier":0.22,"redMultiplier":0.11,"color":0}

But actually prints out

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0.33, alphaMultiplier=0.44, redOffset=0.55, greenOffset=0.66, blueOffset=0.77, alphaOffset=0.88)

(redMultiplier=0.11, greenMultiplier=0.22, blueMultiplier=0, alphaMultiplier=0.44, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0.88)

{"redOffset":0.55,"alphaMultiplier":0.44,"greenOffset":0.66,"alphaOffset":0.88,"blueOffset":0.77,"blueMultiplier":0.33,"greenMultiplier":0.22,"redMultiplier":0.11,"color":0}

Losing the information for all of blueMultiplier, and all the colour offsets, red, green and blue.

I'm using the latest 14.0 AIRSDK.

TOPICS
Performance issues

Views

140

Likes

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
May 07, 2014 0

Have something to add?

Join the conversation