Jump to content
Sign in to follow this  
onequickmemory

Action Script

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...