[RESOLVED] TransformColor
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] TransformColor

  1. #1
    Member
    Join Date
    Sep 2007
    Location
    Richmond, VA
    Posts
    45

    resolved [RESOLVED] TransformColor

    I'm doing an example from Friend of Ed's Foundation Actionscript 3.0 Animation and it is not working. Sadly, Ed isn't very responsive.

    Here is the class definition itself:
    Code:
    package
    {
    	import flash.display.Bitmap;
    	import flash.display.Sprite;
    	import flash.geom.ColorTransform;
    	
    	public class TransformColor extends Sprite
    	{
    		//[Embed(source="picture.jpg")]
    		//public var Picture:Class;
    		
    		public function TransformColor()
    		{
    			init();
    		}
    		
    		private function init():void
    		{
    			var pic:Bitmap = new Picture();
    			addChild(pic);
    			pic.transform.colorTransform = new ColorTransform(-1, -1, -1, 1,255, 255, 255, 0);
    		}
    	}
    }
    I coded out the Flex stuff. He says after this code, well if you are using the Flash IDE then just embed an image in your library, export it for actionscript, and call it the class "Picture" and everything will work.

    It doesn't.

    I'm getting:

    1136: Incorrect number of arguments. Expected 2. | var pic:Picture = new Picture();

    1067: Implicit coercion of a value of type Picture to an unrelated type flash.displayBig GrinisplayObject. | addChild(pic);

    or

    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at TransformColor/::init()
    at TransformColor$iinit()


    Any ideas? I just want to finish this off so I can get to the next chapter which is much more exciting.

  2. #2
    Member
    Join Date
    Sep 2007
    Location
    Richmond, VA
    Posts
    45
    The solution:

    Do not link to the bitmap itself in the library.
    Put the bitmap in a MovieClip and link to that.

    Solved. Program Works.

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    9
    Hey, I'm sure we are working from the same book and I too have this issue. However, I cant quite figure out how to do what you say. I know what needs to be done, (i think) but not how to code it. can you show sample code of how to make this work? I don't want to physically place it on the stage, I want to code it the right way. Meanwhile, moving on to the next chapter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com