How do i 'gray' picture/object in flex 4

Hi All,
Is there a way to make a picture 'gray' in Flash Builder? For example i have a png color picture and i want to 'take out the colors' and show it grayed.
Any ideas?

animated code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
<fx:Declarations>
<s:Animate target="{gs_filter}" id="loop" repeatCount="1" duration="3000">
<s:SimpleMotionPath property="scale" valueFrom="0.00" valueTo="1.00"/>
</s:Animate>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import spark.filters.ShaderFilter;
[Embed(source="GreyScale.pbj")] private var GrayScaleClass:Class;
private var gs_filter:ShaderFilter = new ShaderFilter(new GrayScaleClass());
private function changeColor():void
gs_filter.scale=0.01;
img.filters = [gs_filter];
loop.play();
protected function hs_changeHandler(event:Event):void
gs_filter.scale=[hs.value/100];
]]>
</fx:Script>
<mx:Image id="img" x="85" y="83" width="305" height="229" source="flower.jpg"/>
<s:Button x="85" y="27" label="Add Filter" click="changeColor()"/>
<s:HSlider id="hs" x="86" y="339" width="303" minimum="1" maximum="100" liveDragging="true" change="hs_changeHandler(event)"/>
</s:Application>

Similar Messages

  • How do I instantiate an object in FLEX or AIR?

    Hi,
    There must be something that I don't know that makes instantiation of an object different when doing it from <mx:WindowedApplication></mx:WindowedApplication> class and in the normal XXXX.as class.
    For example I couldn't connect to SQLite. I put all the connection code into the function. Then I put this function into the both mentioned places. When putting the same function into the Application class it worked but putting it to the XXXX.as class it didn't work.
    What is it, that I don't know about that prevents executing this function correctly. Code of the function works correctly. Maybe there are some hidden variables, paths etc.
    Yesterday, a similar problem appeared with 3rd party code that I've added to my application. And the same happened, it works in the Application class but doesn't work in XXXX.as class.
    Please help,
    Christoferek

    Hi Christoferek,
    you probably know this already, but the basic rule for instantiation is something like
    import mx.controls.List;
    protected function my_function():void
      var my_list: List
      my_list = new List();
      my_list.id = "my_list";
    Setting the id is prtty much essential if you are going to refer to the new object somewhere later (if it's just some static text, you may not want to bother).
    the above should work whether you're in an MXML file or AS - you just need to get the import right each time you use it.
    But maybe what you are meaning is not the instantiation part, but that the new object does not function as expected?
    Richard

  • How to dynamically add an object into flex and animate it.

    im planning to implement a dynamic animation which can be used to show some trend of a variable
    this is my case..
    suppose i have data in a table
    Y      |      X
    12       |     3
    32       |     5
    34       |      10
    what i want to do is i want to insert a circle to (3,12) i.e. the first point.. then animate it with the time to next points
    (3,12) --> (5,32) --> (10,34)
    this process hv to be totally dynamic.. becos im planning to fetch data from a table.. so the no of rows also can be any amount.
    is thr a method to do those stuff in flex. ?
    thanks in advance

    Anyone got any suggestions?

  • How do you remove an object from a picture.  Newbie to program CS6

    how do you remove an object from a picture.  Newbie to program CS6

    Well, generally you can use the clone-stamp tool for one, shortcut is S. It basically allows you to take data from any part of the image and copy that over. What I do is draw on a new layer above the one to modify- make sure you select Sample:"This layer and below" in the top toolbar when doing so. Other ways include blending something on top of the object too, using different blending modes. Painting over it works too at times (rarely). It'd be easier if we knew a specific case though...

  • How to display a continuously updating mesh object with the Labview 3D Picture Object

    I have a continously updating stream of 3D images that can be represented in a mesh (a 3D movie if you will). I want to display this in the 3D Picture object so that everytime I acquire a new 3D image it is displayed. Examples are scarce and I couldn't find anything that dealt with this specific issue.
    Currently (within a FOR/WHILE loop) for each iteration I create a scene object, set the geometry as a newly created mesh object, set the texture and eventually wire it to the 3D Picture. This implementation seems to leak memory (the taskmanager shows the used memory continously increasing and eventually processing speed will drop). I assume it's because I recreate the object for each iteration. Trouble is, I can't find anything that would let me release/delete the object once I'm done with the frame. All examples that I found only deal with creating the 3D object once and manipulating it.
    What's the appropriate way to code this? 
    Solved!
    Go to Solution.

    You just need to use the 'Close Reference" VI on the 3D Picture Reference as this code below. It runs inside the loop.
    Now, if you are dealing with mesh, then you should use the Set Mesh Parameters to change the points inside the loop and then, just closed the reference after the code is done. Look at this code below. The trick is to get the reference back from object using Typecast ( To More Specific Reference VI).
    Also, look at the shipping examples in:
    C:\nivs_dev\2013\InstallTo\ProgramFiles\National Instruments\LabVIEW\examples\picture\3D Picture Control
    and specially the Using Meshes.vi.
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • How do I move an object from one photo to another and then change the scene, i.e.  winter to sum?

    How do I move an object from one photo to another and then change the scene, i.e.  winter to summer?

    OK.
    Open the picture with the new scene. This will be your canvas.
    Open the picture with object A, select it with one of the selection tools, go to Edit>copy
    Go back to the new scene/canvas, Go to Edit>paste
    Repeat for object B
    Use the move tool to position A & B, each on its own layer. Use the corner handles of the bounding box to resize, if necessary
    You should have 3 layers: Background layer, and the 2 layers with A & B
    Note: It's best if the resolution of the 3 picture files is the same value.

  • How to fetch Employee Picture in Smartforms

    Hi Experts
    Please help me out in getting employee picture in Smartforms
    I have used the following FMs
    1. HR_IMAGE_EXISTS
    2. SCMS_DOC_URL_READ
    By using these two FM i got the URL and i am able to get the picture in my Report Program,by using FM 'ISM_URL_SHOW'.
    But Please tell how to get this picture in Smartform .
    As i am generating Employee Biodata and in that i need employee Picture.
    Please HELP me ....
    Thanks & Regards
    Shaveta Prabhakar

    Hi Shaveta,
    The question has been raised earlier as well on SDN.
    Please search for 'Smartforms dynamic picture' on sdn and you will get a good number of solutions.
    The one answer which i found to be promising one is the one which mentioned somethig like:
    <b>Create a graphic node in the Smartform and under the tab 'General Attributes' fill the Name, Object and Id with variables (e.g. &NAME&, &OBJECT& and &ID&) and fill these parameters to get the picture you want at runtime.</b>
    See if this helps.
    check this link too
    smartforms dynamic logo
    and revert for more clarifications if any.
    <b>Always reward points to useful suggestions.</b>
    regards,
    Vikas

  • How to make a picture fit an entire page in a pages

    how to make a picture fit an entire page in a pages

    Hello belluchis,
    Thanks for using Apple Support Communities.
    After inserting your image into your Pages document, follow the instructions in the Pages help section below to learn how to manipulate the object:
    Resize, rotate, and flip an object - Pages Help for Mac
    http://help.apple.com/pages/mac/5.2/#/tan114930688
    Take care,
    Alex H.

  • How to Process a picture from a Camera to Labview

    I want to try and get a picture processed through Labview from a camera. For example I want to take a picture of a cup on a table and process it through Labview so that I can write a program for a robotic arm to pick up the cup from the table. I would like someone to advice me on how to process the picture from the camera and display it on Labview. Are there any examples in Labview, or the internet that can help put me in the right direction?  

    I would recommend starting small and have clear objectives in mind.  For example clearly define what you want your robot to do.  Do you want it to pick up "a" cup or anything that looks like a cup.   Things like learning algorithms, image processing, IMAQ, 3D motion control all come to mind.  These are subjects outside the scope of Labview but may be required in addition to understanding how to program your task in Labview.  There are dozens of examples in Labview on these subjects.  Take the task one step at a time and move from there.  It may also be helpful in the forum to give people an idea of your background.   If you are new to Labview this may be a very hard first program.  SS 

  • How to enlarge the picture at the same scale(proportion) of what

    the fontpanel enlarged when you dbclick the title bar to enlarge the fontpanel to entire screen,but the other objects (for example,the button,the string,and so on)on the fontpanel not enlarged with the varity of the fontpanel, only keep the original size.Can anyone help me! my first question is :
    how to enlarge the picture at the same scale(proportion) of what the fontpanel enlarged when you dbclick the title bar to enlarge the fontpanel to entire screen,but the other objects (for example,the button,the string,and so on)on the fontpanel not enlarged with the varity of the fontpanel, only keep the original size. i thank it is a representional question although it may be very simple,in
    my around ,no one can solve it !
    i have offered the vi and a jpeg file underside,who can help me amend the vi? greatly thanks!!! noticed that what i use is lv6.1,if you can solve the problem but need some other vi or lib files ,please offered all together!!!
    thanks!
    the second question is :whether there are some free package can application for image process! i have download some vi at the code library,but when some vi run,it need to open a "vision" folder ,then open display.lib,management.lib, pixel manipulation.lib ,files.lib of the "vision" older,finally to invoke vi named "imaq draw.vi","imaq winddraw.vi" "imaq readfile.vi" and so on ,i can not understand these! why my lv 6.1 did not have the lib files! is the edition not same?
    Attachments:
    how_to_enlarge_the_picture_at_the__same__scale_of_what_the_fontpanel__enlarged_when_you_dbclick_the_title_bar_to_enlarge_the_fontpanel_to_entire_screen.vi ‏30 KB
    Test.jpg ‏21 KB

    the fontpanel enlarged when you dbclick the title bar to enlarge the fontpanel to entire screen,but the other objects (for example,the button,the string,and so on)on the fontpanel not enlarged with the varity of the fontpanel, only keep the original size.To answer your first question:
    To change the size of only the Picture you can use the Draw Area Size like you already have. However if you want to move the other controls around the picture, you may need to use their Position Properties.
    On to question 2:
    All of the VIs you are discussing come with the NI-IMAQ driver and NI�s Vision package. To use those VIs you will need to have the IMAQ driver and have purchased our Vision software. Machine Vision and then you can click on the Machine Vision Software link to learn more about the package.
    Evan
    National Instruments

  • Mapping Objects in Flex Data Services

    Hi My Dear Friends
    This is yogans, i am working in flex for the last 15 days
    and i learned the basic things like syntax, tags, scripts. and i am
    doing
    some data services work now. especially with the help of
    Java Remote objects. I dont know http services and
    webservices(WSDL).
    My doubt here is, I created a user defined object in java
    and i want to send this object through Remote call from flex. how
    can i
    type cast the java object to flex. And i want to add these
    objects to the dataprovider of a datagrid. Please help me in
    acheiving
    this. i will be very thank ful to you in my life. I know
    that i have to create same kind of object in flex. But i dont have
    concrete idea
    please explain me with very simple example step by step . I
    am awaiting in hope that God will send some one to help me.
    Thanks and Regards
    Yogans.s

    Hi,
    If you want to map your actionscript class to your server's
    Java class. You can run a util function
    registerClassAlias("dev.echoservice.Book",Book);
    where "dev.echoservice.Book" is the fully qualify name of
    your java class. Book is your actionscript class.
    Calling this util before you make your remoteobject call. You
    can put this in your actionscript class constructor, it makes this
    call whenever you create your class. However, it seems to be better
    to call it when the class is loaded. To do so you can declare it as
    static
    public static var a:* =
    registerClassAlias("dev.echoservice.Book",Book);
    OR
    You can also declare it as metaData in your class as:
    [RemoteClass(alias="dev.echoservice.Book")]
    However, I found someone saying that it didn't work in sdk
    compilation, but webtier compilation. It might be some
    configuration issue. I haven't tried it yet.
    To display the properties in the dataGrid, you just have to
    either use Array or ArrayCollection. If databinding is involved,
    the datagrid need to know the Collection.Change event. It is better
    to use ArrayCollection, therefore, adding new item to
    arrayCollection the datagrid get repopulate.
    hope it helps!
    William Chan

  • How can I send pictures not embedded, but as an attachment? THX

    How can I send pictures not embedded, but as an attachment? THX

    I had the same problem. I closed  the message, tried again selecting the correct imessage contact number and it worked.
    I'm guessing I first selected a non-imessage phone number and it got stuck in a gray/can't send mode (bug).

  • How to bring these pictures to front?

    How to get these pictures to front?
    As the attachement showing, I have used the "bring to front" option. I also used "send to back" on the blue box. There is no text wrapping on.
    For some reason my images and text now have green and red frames on them, they used to be blue I think, no clue why they changed, or what it means.

    Hi Kamos,
    InDesign displays a different color for selection for different layers. Since you mention that you see some objects with green and some with red selection I am sure this is because your object lie on different layers. In this case an object on lower layer cannot be brought over an object lying on the layer above it. You can move the lower layer over the top layer or you can cut the object from lower layer and then select the layer on which your other object lies and 'paste in place' the object.
    You can change the layers by opening the layers palette (Window>Layers)

  • Picture Object in CR XI not showing on run time

    Hello.
    I made a report design using CR XI, I attached an image using Picture Object and selected the image, It shows in Main Report View but when I run the program and click the button that executes the report, it shows no image.

    Ho Bob
    See if updating to CR XI R2 will help. This blog has how to.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center
    Canada
    Follow us on Twitter

  • How does one upload a file from flex to a cfc

    How does one upload a file from flex to a cfc?   Can you do the file upload via remote object? I usually do uploads cia cfm but prefer the asnc capabilities of remote object calls.

    Hi,
    The issue here is myFile. For flex we need to pass this name as paramenter becuase it's not html form item like:
    <cfcomponent>
        <cffunction name="uploadFile" access="remote" output="false" returntype="void">
        <cfargument name="file" required="Yes" type="any">
            <cffile action="upload" filefield="#arguments.file#" destination="C:\temp\" nameconflict="makeunique">
        </cffunction>
    </cfcomponent>
    From flex I'm getting the file using fileReference like:
    private function browseAndUpload():void
                    fileReference = new FileReference();
                    fileReference.addEventListener(Event.SELECT,fileReference_Select);
                    fileReference.addEventListener(Event.CANCEL,fileReference_Cancel);
                    fileReference.browse();
                private function fileReference_Select(event:Event):void
                    fileReference.addEventListener(ProgressEvent.PROGRESS,fileReference_Progress);
                    fileReference.addEventListener(Event.COMPLETE,fileReference_Complete);
                    fileReference.addEventListener(IOErrorEvent.IO_ERROR,onLoadError);
                    //fileReference.upload(request);
                    fileName = fileReference.name;
                    myFile.htmlText = fileReference.name;
                    SM_RO.importNSA();
    filerReference have an upload method to upload the file but I can't use that becuase I need to process my upload with my cfc.
    I'm getting an error:
    Failed to import the file. The cffile action="upload" requires forms to use enctype="multipart/form-data". Please also make sure the file is not open.
    I can't find the way to setup the enctype becuase again i can have html form items in flex, or I can?
    Thanks
    Johnny

Maybe you are looking for