Flex :: Draw A Circular Arc In MXML Graphics?
Feb 20, 2011Is there a simple way to draw a circular arc in MXML graphics that doesn't involve beziers? Or should I create my own component?
View 4 RepliesIs there a simple way to draw a circular arc in MXML graphics that doesn't involve beziers? Or should I create my own component?
View 4 RepliesI'm trying to draw a box with actionscript 3 and flex 3.5. First a few things:
1) I am not using any IDE at all, just notepad and flex
2) I am not using any mxml file at all (yes this is possible with as3 apparently)
3) I am not using inheritance ie I'm not using an extends on my classes, I'm trying to get this particular bit of code to work only through composition
Anyway this is the code itself (the file name is MAIN.as):
[Code]...
how to position graphics in a circular pattern and they space out evenly depending on how many graphics are in a given array.So now, I want to be able to rotate the graphics in a clockwise or counter-clockwise pattern (not a sprite container that holds all of the graphics, but the graphics themselves.)
Code:
private function weaponChange(e:KeyboardEvent):void {
if(e.keyCode == LEFT_KEY1 || e.keyCode == LEFT_KEY2 || e.keyCode == DOWN_KEY1 || e.keyCode == DOWN_KEY2) {
for(var i:uint = 0; i < _weaponSymbols.length; i++) {[code]....
So this gets each graphic to the next location just fine. Now notice what I have in red... I want the graphics to animate along the parameter of the circle. All I need to do that is to identify the x,y coordinates between the two graphics. I can just subtract the y of one graphic from another... the x is something I have no idea how to do...
My basic requirement is to draw a circle inside a BorderContainer with the layout set to BasicLayout.I run this method in the CREATION_COMPLETE event of the BorderContainer object.[code]I know I must be missing something VERY basic here. Can I just draw like this OR should I draw in some other event? I know that I can create a Ellipse object and easily add it to the border container but I would like to know how I can do this using the graphics object.
View 3 RepliesI would like my spark ItemRenderer to be able to render a varying number of graphical objects that depends on the user input. As an example, let's say that I want to render a set of ellipses on a line.I've been using MXML for my most recent batch of ItemRenderers and have loved every minute of it, but I'm not sure how to accomplish the above goal with an MXML IR. In Actionscript I can acquire the list of ellipses locations and draw them programmatically in the updateDisplayList method. Is there an equivalent in MXML?
View 1 Repliesi have a movieClip. On it i draw a few rundedRects, when i resize the window i use graphics.clear to remove it, and then reDraw the Rects. Will this result in memory leakages? or will flash reuse the memory address as long as i draw on the same sprite?
View 1 RepliesWhat would be your recommendation for drawing shapes (rects, circles...) onto BitmapData, and how to effectively switch between colors.Draw shapes on BitmapData / getting its graphics context
Is there any way to get graphics context from BitmapData so I could easily paint shapes using graphics.draw...()?
I have a complex graphics data on a sprite or a shape (no matter which is exactly). But I want to draw shadow (inner too) for one Rect ( [10, 10, 240, 25] for example) or another path.
[Code]...
Is it possible to draw a Bitmap to a Graphics-Object like
this.graphics.beginBitmapFill(bitmapData, matrix, false);
this.graphics.drawRect(0, 0, w, h);
this.graphics.endFill();
with an offset?
A simple moveTo(x, y) call before beginBitmapFill does not work :/ Neither does changing the x and y value of drawRect... (That just seems to have the same effect as an translation with the matrix...) Additionally I don't want do draw that thing in a separate Graphics-Object and add that one into the other...
I need draw rectangle with two circle holes inside. The problem is in circles interception. I want them to join together and cut from background, but they seems to be XORed:
At first I tried drawRect and DrawCircle:
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, width, height);
graphics.drawCircle(width/2, height/2, 50);
[Code].....
here getCirclePath returns object with points to draw polygon which looks like circle. Also I tried different combinations of GraphicsPathWinding constants, but no luck.
how to draw two intersecting circle holes in graphics?
Does MXML get compiled down to as3 and then converted to flash bytecode? Also, is there a significant performance penalty to compiling mxml vs compiling as3?
View 3 RepliesI am working on a custom Flex 4 component which is an aggregation of two existing flex components. I would like to be able to specify my own custom properties for the component as well as access the existing public subcomponent properties via MXML. For instance I might want to adjust the font color or style for the label and text input. toy component which aggregates both a label and a text input:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[code]....
I have the following code to create a Sprite with a rectangle in it:
container = new Sprite();
container.graphics.beginFill(0x00CCFF, .5);
container.graphics.lineStyle(1, 0x00CCFF);[code].......
The only thing is, I'd like the registration point to be in the middle (not the top left corner). Is there a way to set up the registration point in the middle of the rectangle, but still have the position of the rectangle be correct?
i.e. not moved over so that the top left corner of the rectangle is in the "middle" of where I want the rectangle to be...
I am trying to override a Button class, i have a few properties which i wish directly initialise with the mxml description of the component, like :[code]which function is triggered ( in order to override it ) when all properties with mxml description is fully initialised with their values ?
View 1 Repliesclass A:
[SWF(width='800',height='600',frameRate='24')]
public class A extends MovieClip {
private var b:B;[code]....
this.graphics calls do nothing in draw method, but work fine inside B`s constructor, what i am doing wrong ?
for example:
var mc:MovieClip=new MovieClip();
mc.graphics.beginFill(0x000000,0.5);
mc.graphics.drawRect(0,0,100,100);
[code].....
What I'd like to do: create an MXML component with some children, then extend it via MXML to create a new component with more children, without losing the original set.In other words
create a component bc.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
[code].....
i have defined some functions in a component mxml file let us say addbutton() now i want to call this function in main mxml file.
View 2 Repliesmain.mxml
[Bindable]
private var _dp:ArrayCollection = new ArrayCollection([
[code].....
A Flex components values are initlized by init methord. In an application flow, How to refresh a mxml component data value ; as init is callled at the start up it self only.
eg. of mxml componet may be as simple as button label or text as complex as repeater whose data provider is a web service ( means a fresh quesy should be made to pull the data and refresh the dataprovider of repeater )
suppose i have 3 buttons(for example say, productin, marketing, sales ) on my main.mxml..once i click on one button it should take me to abc.mxml page with production data, once again if i click on second button it should take me to the same abc.mxml but with marketing data. same as for 3rd button also, how can i achieve this ?
View 2 RepliesI've been trying to create a custom mxml component that extends another custom mxml component (i.e.MyMXMLComponent -> BaseMXMLComponent -> Group). I've been reading that trying to add visual children to MyMXMLComponent caused error with Flex 3 but that's no longer the case with Flex 4.
What I want to know is whether this is a supported/fixed/documented feature of Flex 4? or just some undefined behavior in Flex 4 that may get changed with future updates?
if this is supported and documented feature, does anyone have link pointing to adobe document stating it as such?
I`m working on a app that you can draw lines.....like circles, rectangles... my problem is when a user draw a circle for example....i wanna be able to paint (change color) inside of this circle. I`ve tried working on Shapes with cacheAsBitmap = true and Bitmaps with BitmapData but it doesn`t seens to work.
View 4 RepliesI'm trying to draw PNGs onto BitmapData that is transparent.
I create my BitmapData like this (using ARGB for the color):
new BitmapData(width, height, true, 0x00000000);
And clean it by using the same ARGB value:
bitmapData.fillRect(bitmapData.rect, 0x00000000);
When I use copyPixels() to draw graphics onto the cleaned BitmapData, I get this result:
If I don't use ARGB for the BitmapData color, it works fine:
But I have to specify a solid fillColor, meaning I can't render what's behind the Bitmap.
How can I make my BitmapData transparent, but not have the above occur?
This is a project I'm working on for a simple demo tutorial application in Flex. I am using mxml pages. You can see to the left that I will have my main application and then other mxml files (In the Examples Package) as the examples that will be loaded into the main application mxml. How can I dynamically pull the value from the object in the list to load the child mxml file into the container that I have further down in the application?
View 1 RepliesI am a beginner in Flex. For my appln, I wanted to have the progress bar, but not the default that Flex Framework provides.
I wanted to have a circular loading "progressbar" that would move in circular fashion before completing one complete revolution to 100%.
Can I do that in Flex 3 ? If yes, how ?
I have two Flex libraries that reference each other. Both use link type "External", and I manually load then with the Loader class.I'm getting the error "A cycle was detected in the build path of project: foo".
View 2 RepliesI have a method in CustomPanel.mxml and I need to use id which is available in Main.mxml. Below is my sample code
Main.mxml
<local:CustomDivideBox id="div1">
Custompanel.mxml[code]....
I would like to include an MXML file in my MXML file in the same way you can include an external file in AS3 using the include directive. Using the include directive brings the code from the external file into the original file at compile time placing it in the same scope. For example,
Application.mxml:
<Application>
<source="external.mxml"/>
[code].......
I want to create a circular water ripple effect in Flex.
View 1 Replies