Canvas BackgroundImage

var v:canvas;
v.setStyle("backgroundImage","url");
Instead of passing url , can we pass the image that was captured.( I mean we have an image and the changes to the image is been made by us, either width,height,x,y etc.)  so we need to capture this image and pass it to the above statement in place of url.
Is this possible or not?
Can any one help me with this?
Thanks and Regards,
Rajesh.

Well i was also in the same situation what i did was that..i created an empty image file say empty.png 0 kb in my src folder of project then  write the avaiable bytearray to this file using filestream and set the background using the setstyle method..hope it helps..my app was an AIR app

Similar Messages

  • Setting Canvas backgroundImage to a ByteArray

    Is it possible to set a canvas backgroundImage to a ByteArray?  It looks like it has to be a url, but if it's loaded from FileReference, I don't have a url.
    Any ideas??

    Well i was also in the same situation what i did was that..i created an empty image file say empty.png 0 kb in my src folder of project then  write the avaiable bytearray to this file using filestream and set the background using the setstyle method..hope it helps..my app was an AIR app

  • Problem with change of backgroundImage

    Hi,
    i'm new in Flex and i'm having a problem changing the
    backgroundImage property of a component.
    I create a component (Canvas) that changes it's
    backgroundImage on mouseOver and mouseOut events.
    The problem is that if i make a fast move with the mouse
    through the component, the backgroundImage doesn't disapear. It
    shows the image of the mouseOver event, but the image doesn't
    disapear when the mouseOut event set the other backgroundImage. We
    can see that the backgroundImage of the mouseOut event has been
    showed behind the mouseOver image, but the backgroundImage of the
    mouseOver event, hasn't been hidden.
    It doesn't happen only with the mouseOver image, it happens
    with the mouseOut image too. It also happens with the both image at
    the same time if i keep moving the mouse over and out the
    component.
    I did a lot of tests and noticed that it happens only with
    the backgroundImage property. If i change any other property of the
    component, it works fine in any mouse speed.
    I really don't know what to do.
    The code is very simple:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas
    backgroundImage="imagens/background_etiqueta.png"
    width="300"
    height="140"
    mouseOver="{mouseOverHandler(event)}"
    mouseOut="{mouseOutHandler(event)}"
    >
    <mx:Script>
    <![CDATA[
    private function mouseOverHandler(event:MouseEvent):void
    this.setStyle("backgroundImage",
    "imagens/background_etiqueta_selecionada.png");
    private function mouseOutHandler(event:MouseEvent):void
    this.setStyle("backgroundImage",
    "imagens/background_etiqueta.png");
    ]]>
    </mx:Script>
    </mx:Canvas>
    Does anyone knows anything about a Flex bug, browser bug or
    anything else ?
    OR
    Does anyone knows what am i doing wrong ?

    The client decides to which network it is connecting to. My guess is that the client is configured for both SSID's and that the client is switching between the two because of some slight signal strength difference. Are both SSID's enabled for the same radio bands? (so 802.11b/g/n and 802.11a/n/ac). Another option is that some connectivity is not possible on the corp SSID which triggers the client to look for a "better" network.
    In the end the solution to this problem is to (technically) prohibit your own clients to use the guest or change the security policy so that your users don't need to do this anyway. Then remove the configured guest profile on the clients (or change your guest SSID) so that they won't try to connect anymore.

  • Change background canvas

    Hello,
    I have the following question:
    In my application I have a canvas. I would like to change the background image of that canvas through 2 buttons.
    Example:
    - Button 1: The background changes to grass.
    - Button 2: The background changes to a wooden floor.
    So if you click on the buttons, the background image will change.
    I've already tried to change the background color of the canvas. I've did that with the code of Flex Examples:
    public function colorize(value:Number):void
    var colorTrans:ColorTransform = new ColorTransform();
    colorTrans.color = value;
    starImage.transform.colorTransform = colorTrans;
    But I don't have any idea how to change the background image. Does anybody has an idea?
    Thanks,
    Peter

    canvas.setStyle( "backgroundImage", urlToImage );
    Let me know if that does the trick...
    Ben Edwards

  • BackgroundImage bug?

    I'm having an issue with the backgroundImage style of a canvas and would appreciate any help.
    I have a tilelist with a selection of png images listed and when one is selected from the list it is set as the backgroundImage of a larger canvas on the page. Occasionally when selecting images quickly from the tilelist the canvas ends up displaying more than one of the png's.
    The png's are loading from a server and while they are small they don't load instantly. The issue seems to happen most often when selecting png's from the tilelist that haven't loaded yet.
    I have tried setting the backgroundImage with .setStyle() and by binding the backgroundImage property to a string and setting that string to the path to the image and both ways have the same problem.
    Any ideas as to how I can avoid or correct this?
    Thanks,
    Scott F.

    Is it not possible to gather nodes in groups? Or why dont have nobody an answer?
    Would be great to konw if it is possible in anyway to group nodes.
    Anyway to show that they are from one specific typ/group.
    Thanks anyway, even if there is no solution.

  • Change backgroundImage on rollOver

    Hello
    I am quite new to flex,
    I've desperatly been trying to change the backgroundImage of
    a canvas through a rollOver event.
    Can anyone help me out?
    Thank you

    Try this (sorry untested, but looks okay):
    Default is c:\image1.jpg.
    Rollover is c:\image2.jpg.
    <mx:Canvas id="myCanvas" backgroundImage="c:\image1.jpg"
    mouseOver="myCanvas.backgroundImage='c:\image2.jpg';"
    mouseOut="mouseOver="myCanvas.backgroundImage='c:\image1.jpg';"/>

  • Changing the background image of a canvas at runtime

    =========
    [Bindable]protected var bgImage:Image; private
    private   function GetConfigurationResult( event:WsVCIGetConfigurationDataResultEvent):void
    var simage:String = event.result.Image; 
    var decoded:ByteArray; 
    decoder.decode( simage );
    decoded = decoder.toByteArray( );
    bgImage.data = decoded;
    setStyle(
    "backgroundImage", "assets/images/marshes2.jpg" ); 
    =========
    The code above is the result event from a call to a web service to get the contents of an image file from and SQL database.
    Works ok up to bgImage.data = decoded;
    But using "setStyle" has no parameter for passing the bytearray data block of the image.
    The above code, calling [ ("backgroundImage", "assets/images/marshes2.jpg" ] does something, but not what I want.
    The web service is called from the canvas [ initialize="init();"] function.
    When I set canvas feature [ backgroundImage="{bgImage}" ] it resolves, but I get some error trap from some low level image handling module.
    How do I resolve a background  image during load at runtime?

    Since setStyle takes a string and an object for inputs, one would expect that the following would work
    ===========
    private function GetConfigurationResult( event:WsVCIGetConfigurationDataResultEvent):void
    {// retrieve the 64base encoded image from the web service by ResultEvent
    var  
    bgImage:Image =new Image();
    var simage:String = event.result.Image; 
    var decoded:ByteArray;
    var  
    decoder:Base64Decoder = new Base64Decoder(); 
    decoder.decode( simage );
    decoded = decoder.toByteArray( );
    bgImage.data = decoded;
     setStyle(
    "backgroundImage", bgImage );
    ============
    But this generates the following error:
    ==========
    Error: Unable to load 'Image52'.
    at mx.skins::RectangularBorder/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\fr amework\src\mx\skins\RectangularBorder.as:237]
    at mx.skins.halo::HaloBorder/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\fram ework\src\mx\skins\halo\HaloBorder.as:222]
    at mx.skins::ProgrammaticSkin/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\skins\ProgrammaticSkin.as:421]
    at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:622]
    at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:677]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
    at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]
    ==============
    But passing a filename to setStyle works!!!!
    But I need the image to come from a database!!!!!!
    Help!

  • CSS backgroundImage and borderSkin conflict with ClassReference

    I've spent several hours trying to figure this out.  I have a programmatic skin that paints a gradient and sets it as a backgroundImage ClassReference in css.  In that same stylesheet declaration I set the borderSkin to a ClassReference of a class that extends border and draws a line.  A canvas is referencing the declaration.  I'm confused because if I only use the background image style it draws the gradient.  If I add the border skin style, it won't draw the gradient but draws the lines in the border skin.  The interesting part is if I set breakpoints, I never even hit the breakpoint in the updateDisplayList method for my background image class, only the border class, so all I ever get is a line.  Does the borderskin in css override other skins like backgroundImage?  Are there documents that explain this somewhere on adobe's site? 

    I don't think any of those items would affect the behavior of that tabbed region.  They are all pointing at some unprotected javascript on the page - ordinarily placing those bits of embedded script between CDATA  lines will eliminate these validator complaints.  If that were done, this page would probably validate.
    As for the original question, I am not sure why the symptoms reported are occurring in IE.  Perhaps someone else will spot the reason....

  • Canvas overlapping

    Is it possible to do canvas overlapping? Eg, draw a smaller canvas onto a larger one that contains only a backgroundimage.
    And if not, what would be my alternatives?
    Thx in advance.

    Nevermind,
    add(<component> , <z-index>) does the trick.

  • Display image in full screen canvas

    Hi frndz
    I have an Image, which either bigger in size of a canvas or small
    I want to give an option of a full screen view
    So its a kind of zoomIn/ zoomOut function in one method
    how can I convert such small/big images into full screen canvas size
    thanks
    alpesh

    This question has been asked already several times here: http://onesearch.sun.com/search/onesearch/index.jsp?qt=resizing+image&subCat=siteforumid%3Ajava76&site=dev&dftab=siteforumid%3Ajava76&chooseCat=javaall&col=developer-forums
    There is no method in MIDP which rescales a picture for you, so you have to write it on your on (or use existing code). But usually this would be pretty slow. Mostly it is better to offer different versions of your application for different devices (screen resolutions) where the images have already the appropriate size within your jar-file.

  • Can I draw *.bmp, *.png in java.awt.canvas ?

    In paint method of my program, I get image from Toolkit like this:
    public class CanCanvas extends Canvas{
    //In loadImage method
    Toolkit.getDefaultToolkit().getImage(
                        getClass().getClassLoader().getResource(
                                  resource.getString("bg.jpg")));
    //.... In paint method
    if (image != null && image.size() > 0) {
                   for (int j = 0; j < image.size(); j++) {
                        Image image1 = (Image) image.elementAt(j);
                        Rectangle rectangle = (Rectangle) imgLocation.elementAt(j);
                        g.drawImage(image1, rectangle.x, offset + rectangle.y,
                                  rectangle.width, rectangle.height, null);
                        i = i <= rectangle.y + rectangle.height + 7 ? rectangle.y
                                  + rectangle.height + 7 : i;But there is something very strange, if my image is *.jpg or *.gif, it runs ok, otherwise -*.bmp, *.png-, it can't draw the image.
    Would anyone tell me why ? Is the reason java.awt.canvas ?
    Thanks in advance ^ ^

    If you'd bother to read the documentation of the methods you're using, you'd know:
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Toolkit.html#getImage(java.lang.String)
    Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG.

  • Runtime tab canvas does not look the same as designed in layout editor.

    I created a tab canvas with the following physical properties:
    Corner Style - Chamfered
    Width Style - Variable
    Active Style - Bold
    The canvas looks nice in the layout editor, with the above properties. However, at runtime, the tab canvas seems to ignore the above properties and instead shows up with non-chamfered looking (whatever chamfered means) fixed-width rectangular tabs and the active tab page label is not in bold font. Is there a runtime setting that I'm missing here?
    null

    I am experiencing the exact same thing. The width of the tabs in the layout editor is varied depending on the length of the text. However, at run-time, the width of the tabs is fixed, causing the tabs to be wider than the window and a set of VCR buttons to appear in the upper right corner of the canvas. Personally, I think this is a Forms bug. Why would they intentionally let us set the width to variable at design-time only to force a fixed width at run-time?

  • Oracle Forms 10G(tabbed canvasses not working the same as in Forms 6i)

    Hi everyone,
    I have a form which gets called from another form through a list of value. The called form(second form) has a group of tabbed canvases which get displayed depending on the parameters passed from the first form.
    The Form is working prefectly fine in Forms 6i but when I converted the same form in to forms 10G it does not seem to work the same way. The tabbed canvasses are not getting displayed. I am manually having to press the execute query to get data displayed in the tabbed canvasses. I checked the parameters that are being passed and they are the same as that in Forms 6i.
    Please let me know where my 10G Form is going wrong. Appreciate your help, please send me an email on [email protected]
    Thanks

    duplicate
    Re: Oracle Forms 10G not working as Oracle Forms 6i

  • How can I use the print module to print different size images on one large "canvas"?

    How can I use the print module to print different size images on one large "canvas"? An example would be in Photoshop, go to file>new, and create the size paper I want, and move images of different sizes onto it.
    I was thinking the print module would do this automatically for me.

    You can't, at present. It's been a requested feature, so we'll see if it shows up in a future version, but it's not there at present.

  • Wacom tablet pressure sensitivity, dont work outside canvas

    Hi.
    I wonder, if i'm the only one, who are having problems to start a stroke outside the canvas and follow it on the canvas, without the pressure sensitivity is all on max.
    seems the same is happing, if you have marked an area and start at stroke outside that area. kinda like the brush only start recognize the pressure level when on the canvas or marking.
    does it make sense?
    running windows7 64bit intous3 A4.
    tested in on my my laptop too on the intous3 A5, same problem.
    /cheers
    Heino

    Hi JJMack
    thx for your comment
    - i'm on photoshop cs5, any brush thats pressure sensitivity, did it with both docked and floating canvas.
    I think i've fixed the issue.
    Apprently its a problem with the newest version of the wacom driver. And somehow it only affects photoshop.
    i've downloaded the march 2010 driver from wacom. And installed that. seems to be fixed.
    /cheers

Maybe you are looking for