Jump to content

Action Script


onequickmemory

Recommended Posts

I have toyed around with Action script. Could someone answer this: Is there an Action script solution to getting a pixel value(background color) for a bitmap instance(.jpg) and then calling a function to replace that single pixel value with a new pixel value for the entire image? Since only one color is to be changed(background color) and the .jpg image is a single layer(flattened image, was a .gif previously), it would be ideal if a pixel color change could be scripted. Any words would be appreceiated.Thanks,Onequickmemory.

Link to comment
Share on other sites

Im lost!You want to change a colour of a bitmap? or a background (but not the bitmap's)I know how to change a background but thats about it!-----------------------If you wanted to change a backgound of an imagefor example: heykids2.pngTo turn this images background in flash i would first open flashFile> Import > Import To Stage (Ctrl+G) > heykids2.png > OKI would then trace the bitmap.Modify > Bitmap > Trace Bitmap > From there i would then choose 1, 1, 100 and pixels as my settings but this is up too you.When the computer has FINALLY decided to complete the trace i would select all the white area and press F8 to convert it to a movie clip.Call the movie clip "colors" and the instance name "shape" (no " 's)Then make a button with the fill the color you want the shaoe to change too...for example Red.Then paste the following code into the buttons

on (release) {var colorful = new Color("_root.shape");colorful.setRGB(0xFF0000);}

Now to edit this code to create different colors you will need to change the

(0xFF0000);

as FF0000 - Is the Hex Code for Red.To make the shape turn blue use this code on a new button:

on (release) {var colorful = new Color("_root.shape");colorful.setRGB(0x0000FF);}

Test your movie to see if this has worked.

Link to comment
Share on other sites

  • 3 weeks later...

Hit F1 in Flash to bring up help and search for "bitmap". You'll see a description of the BitmapData class in Actionscript. If you can programmatically change a pixel value, you should find it there. It looks like most of the class is for creating a new bitmap programmatically, not altering an existing one.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...