Flex :: Adding A BitmapImage To A Canvas?
Sep 4, 2011
I am trying to load a BitmapImage from an embedded source image and add this to a UIComponent. I am attaching the code that I have below. I have not been able to get this to work.
var bitmap:BitmapImage = new BitmapImage();
bitmap.source ="@Embed('sample.jpg')";
var graphic:Graphic = new Graphic();
graphic.addElement(bitmap);
thumbHolder.addChild(graphic);
When I run this I dont get an error, but no image appears in thumbHolder (My UIComponent).
View 1 Replies
Similar Posts:
Apr 30, 2011
First off I have this MXML:
<mx:Panel x="270" y="10" width="690" height="680" id="mainContainerPanel">
<mx:Canvas x="270" y="10" width="670" height="640" id="canvas" initialize="onInit()">
[Code]....
The circCentre Sprite never appears on screen and I don't understand how I can get it to appear.
View 1 Replies
Dec 24, 2009
I am new to flex, and do not know how to add an image (or other ui component) to canvas, so user can select it (and see that it's selected), also I want to add a possibility for example to click backspace and remove selected image from scene. How to do that?
View 1 Replies
Jan 5, 2010
I am adding DisplayObjects to a Canvas using
ContentContainer.addChild(c);
Where ContentContainer is my Canvas object and c is the DisplayObject I have created at run-time. Some of these DisplayObjects also have children of there own which are added at run-time prior to the DisplayObject being added to the Canvas.
I then need to iterate over all the children of ContentContainer but the first time I do this, it says that ContentContainer has no children (i.e., ContentContainer.numChildren = 0). If I do it again tho then it is fine and returns the correct number of children. Is there something I need to call to get ContentContainer to recalculate how many children it has?
View 2 Replies
Apr 8, 2010
I currently am trying to add a custom class which subclasses UIComponent to both a tree and a canvas, but when I try to re-order the tree by dragging I get this error:[code]When I do not add the UIComponent to the canvas, this error does not occur, anyone have any knowledge as to why this happens?
View 2 Replies
Aug 4, 2011
I've a custom component where I do some graphics (e.g draw a line) and dynamically add a subcomponent (e.g a label) to it.
If I base the component off Group (which is recommended as per docs since its a spark component) then when I dynamically add a label the graphics part disappears.
However if I base it off Canvas this doesn't happen.
Why is that the case?
Here is the code.
MyComponent.as
public class MyComponent extends Group
{
public var x1:int;
[Code].....
View 2 Replies
Aug 29, 2011
I need to scale and clip images into square sized tiles to put into a tile list. Here's how
For each image, I want to scale the shorter side (either width or height) to fit in the tile using the "letterbox" scaleMode (so that it maintains aspect ratio).Then I want to position the image in the center and clip away anything left over from either both sides or the top and bottom.
I have an image with width=600px and height=1200px. First I want to scale the image to width=300px and height=600px (notice that aspect ratio is maintained), then center the image vertically and clip the image to 300 x 300.
Is this possible? This is actually a pretty standard way of displaying square thumbnails in many photo-based web sites, but I can't find a way to make it work in flex.
View 1 Replies
Jan 12, 2012
I am using Bitmapimage in my code.After a lot of seach on google i could not find How tooltip can be used with Bitmapimage.
View 1 Replies
Mar 31, 2011
this.container.addElement(myCustomImageInstance as GraphicElement) must display the test image.
package com.www
{
import spark.primitives.BitmapImage;
import spark.primitives.supportClasses.GraphicElement;
public class BaseTest extends GraphicElement
[Code]...
View 1 Replies
Dec 11, 2010
I've trawled the net trying to find a solution, but everything seems to be mxml-centric. What I want is to dynamically create a series of Graphics objects each with a child BitmapImage.[code]...
View 1 Replies
Jun 5, 2009
I have the following code in my flex project.
[Code]...
I want to dynamically add different items to thumbContent canvas and use scroller canvas to scroll. I see than the height of thumbContent bigger than 7977 it truncate from scrolling. So - I see the scroller canvas with empty space on top. Then I scroll to bottom - I see the content of thumbContent and at bottom scrolling I see empty space too.
View 1 Replies
Apr 9, 2011
I'm trying to skin a canvas with an image (which is essentially a custom border for the canvas). I've been trying the backgroundImage style as well as the borderSkin style. I can't get the image to scale to the full size of the canvas though. I was wondering what the best way to go about this is.[code]...
View 2 Replies
Sep 9, 2011
I am going nuts! I have a canvas which I am trying to add a background image to. I am not setting the Y position, but after I add it to the canvas it always starts about 40 px down. If I trace the Y position it still says 0, even after a timer. I have tried to move it to the parent canvas and got the same results.
View 1 Replies
Apr 2, 2009
I am working on application similar to [URL] how to add multiple clipart to the center rectangle. I can add one clipart but then adding second clipart/image replaces the first one.
View 1 Replies
Mar 14, 2010
I am trying to use BitmapImage spark class instead of mx image class.Image loads the same, fine
<s:BitmapImage id="img" source="sample.jpg">
</s:BitmapImage>
But I have an issue with adding mouse events on it, eg:
img.addEventListener(MouseEvent.CLICK,clicked);
do not trigger any mouse events when clicking on the image
View 1 Replies
Jan 17, 2010
Flex charts, like AreaChart, have wonderful built-in support for displaying data "tool tips" when a user hovers over a point supplied in the data of a graph. You can hover over any of the bar graph examples on this page for a demonstration. I have a graph situation where I optionally draw in some dots as reference points on CartesianDataCanvases supplied to my AreaChart through it's <mx:annotationElements> and <mx:backgroundElements> tags.
I would like to have the same hover data-tip functionality that the AreaChart has, but applied to these dots. I realize that I am just drawing on canvas, and that no actual dataProvider supports these dots, but if there was a way to supply the CartesianDataCanvas with an array of data values or something to that effect,
View 1 Replies
Jan 20, 2010
I'm developing an engine to generate components.I been wanting to get my xml script that read and create a component to be load into 'content' canvas. I not sure how do I get the addChild work correctly as in 'content'.addChild instead of the one shown below:[code]
View 1 Replies
Dec 27, 2009
The basis for the chat window is a canvas. I've got that showing, but how do I make it scroll up? I want to clip the window so only the last 15 lines are shown.[code]...
View 1 Replies
Dec 8, 2010
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas width="100%" height="100%">
<mx:Canvas backgroundColor="#A8A8A8" height="100%" right="0" top="0" width="100">
</mx:Canvas>
[Code]...
My code above works absolutely fine, until i resize my browser window to a size below 800px width. When the browser window is make of lesser width than 800px, the canvas with background color #A8A8A8 is on the right of the window, but the problem is, when I move the scroll bar, the canvas should remain on the right of the window. Which does not happen, and that is what my problem is.
How can I solve this issue. What should I do to keep my canvas be on the right=0 all the time.
View 1 Replies
May 18, 2011
I want to lie two canvas at one Tab Navigator. when I use <mx:local it created multiple tab.
View 1 Replies
Dec 23, 2009
I'm trying to write some code to an animated images of squares on a Flex Canvas There's something wrong with my code below because it becomes progressively slowerI assume I'm supposed to clear the old squares or something.What am I doing wrong below?:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();">
<mx:Script>
[code].....
View 1 Replies
Feb 24, 2011
Basically I want to go to frame2 when the cursor leaves the canvas. The code below contains no errors when tested but it still does not work.
[Code]...
We know that the function gotoAndStop(frame2); works in multiple situations which means the first 3 line is fine. I don't know if the problem is the MOUSE_LEAVE event or this.stage which i suppose is the identifier for the canvas. I sure that there must be an alternative code for the identifier this.stage or the whole code. Any solution on how to fire the given function in the event when the cursor leaves the canvas?
View 2 Replies
Jun 19, 2009
i am required to zoom a canvas through Hslider. The problem is after zooming the canvas i cannot scroll to the extreme left and top of the canvas i.e some part of left and top canvas are not visible. i cannot find the reason. The source code for the example is given below.
[Code]...
View 3 Replies
Jul 27, 2009
Is there a way in Flex by which a disabled canvas looks exactly the same as an enabled canvas? I haven't been able to make sense of disabledOverLayAlpha and disabledColor properties for a Canvas component.
View 1 Replies
Jul 29, 2009
a .fla is 500 x 300. Inside, content moves OUT of the 500 x 300 stage so that it appears like it hides or moves off of the screen. .fla complied... loaded into Flex via SWFLoader:
<mx:Conainer width="500" height="300">
<mx:SWFLoader width="100%" height="100%" />
</mx:Conainer>
Loaded .swf file shows outside of the 500 x 300 Container in Flex. How can i get it so that only what is INSIDE of the Container is visible?
View 3 Replies
Aug 3, 2009
Is there a way to programmatically scroll the canvas to its topmost position?
View 2 Replies
Dec 13, 2009
I am creating a canvas in actionscript like :
private var cvs_preview:Canvas = null;
[Code]....
So on the focus change i want to run the "end_preview_on_focus_change()" but this is not working. As per my understanding, i think the canvas not getting any focus in the first place. I was trying to use focusManager.setFocus to do that after the canvas's creation complete. but even that is giving me an error.
[Code]...
View 3 Replies
Jul 26, 2010
In flex, I am using
canvasEdit.setStyle("borderColor", 0x0134FF);
canvasEdit.setStyle("borderThickness", 3);
note: canvasEdit is of type Canvas.
But I am not able to put border on the sides of canvas.
View 1 Replies
Aug 4, 2010
I'm trying to create a custom tab navigator that has to look like. Also, when there's a rollover, the borders of the arrow have to be in blue (like the label in the current tab). For that purpose, I've created a custom component: a hbox containing a label and a canvas with 3 images inside (for the arrow tip that has to change depending on the currentState). Then, I thought of overlapping the components in order to get the blue highlight color (ex: arrow button 3 is over arrow button 4. The image of the arrow tip in button 3 will be transparent outside the arrow, so that we can see the black color of the following button).
I'm now trying to position the components inside the canvas ... but I cannot. After the creationComplete event, I assign the label text and I was calculating the coordonates of the component but it doesn't take into account the label width... -_-'
View 1 Replies
Oct 6, 2010
The problem is when background of top or below label is changed, the top or below button is erased.
<mx:Canvas width="100%" height="100%">
<mx:LinkButton icon="{icon1}" width="25" x="10" y="10"/>
<mx:LinkButton icon="{icon2}" width="25" x="10" y="100" />
<s:VGroup width="100%" height="100%" id="lst" click="highlight(event.target as Label)" gap="0">
<s:Label />
[Code]...
So do anyone know the possible solution for this problem?
View 1 Replies